diff --git a/Network-Policy/Assignment/db-network-policy.yaml b/Network-Policy/Assignment/db-network-policy.yaml index 921c075..ef65e1b 100644 --- a/Network-Policy/Assignment/db-network-policy.yaml +++ b/Network-Policy/Assignment/db-network-policy.yaml @@ -1,10 +1,32 @@ -# Hey there future Kubernetes experts! - -# We heard you're working on your db-network-policy assignment. Nice! We can't wait to see what you've come up with. - -# And don't worry, we're not just sitting around eating popcorn. We'll be posting our own solution soon, so stay tuned. - -# Keep calm and Kube on! - -# Love, -# The DevOps Pro Admin Squad ❤️ \ No newline at end of file +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: db-network-policy +spec: + podSelector: + matchLabels: + role: db-pod + policyTypes: + - Ingress + - Egress + ingress: + - from: + - podSelector: + matchLabels: + role: internal-db + namespaceSelector: + matchLabels: + name: dev + ports: + - protocol: TCP + port: 8080 + egress: + - to: + - ipBlock: + cidr: 172.17.0.0/16 + except: + - 172.17.1.0/24 + ports: + - protocol: TCP + port: 30000 + endPort: 32768