Mohammad Karim:
Allow traffic from all the pods in "web" namespace and from pods
with lebel "type=monitoring" to the pods matching lable "app:db"
My Understanding :
----------------------
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: NetworkPolicy
metadata:
name: test-network-policy
namespace: default
spec:
podSelector:
matchLabels:
app: db
policyTypes:
- Ingress
ingress:
- from:
- podSelector:
matchLabels:
type: monitoring
Answers Says :
----------------------
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: NetworkPolicy
metadata:
name: test-network-policy
namespace: default
spec:
podSelector:
matchLabels:
app: db
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
app: web
- podSelector:
matchLabels:
type: monitoring