The yaml proposed as solution is:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: allow-app1-app2
namespace: apps-xyz
spec:
podSelector:
matchLabels:
tier: backend
role: db
ingress:
- from:
- podSelector:
matchLabels:
name: app1
tier: frontend
- podSelector:
matchLabels:
name: app2
tier: frontend
Whereas I used:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-app1-app2
namespace: apps-xyz
spec:
podSelector:
matchLabels:
role: db
policyTypes:
- Ingress
ingress:
- from:
- podSelector:
matchExpressions:
- key: name
operator: In
values: ["app1", "app2"]
Shouldn’t that still be accepted?