R:
Clarification request for lecture - Developing network policies at 10:33 -10:44 min mark
Given that the network policy is created in prod namespace:
- Ingress from pods in test and dev namespaces is not allowed for the below policy. The first rule only allows traffic from api-pod in the prod namespace as the network policy is created in prod namespace and policy doesn’t mention the namespaceSelector. Is it correct understanding ?
- If yes, then two dotted lines from pods in test and dev namespaces shouldn’t be there. “Almost traffic from anywhere is allowed to db pod” as mentioned in the lecture might not be clear given the policy below:
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: NetworkPolicy
metadata:
name: db-policy
namespace: prod
spec:
podSelector:
matchLabels:
role: db
policyTypes:
- Ingress
ingress:
- from:
- podSelector:
matchLabels:
name: api-pod
- namespaceSelector
matchLabels:
name: prod
- ipBlock:
cidr: 192.168.5.10/32
ports:
- protocol: TCP
port: 3306