apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
namespace: production
name: redis-cart-allow-from-cartservice
spec:
policyTypes:
- Ingress
podSelector:
matchLabels:
app: redis-cart
ingress:
- from:
- podSelector:
matchLabels:
app: cartservice
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: production-network-policy
namespace: production
spec:
podSelector: {}
egress:
- to:
- namespaceSelector: {}
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- port: 53
protocol: UDP
- to:
- namespaceSelector: {}
- to:
- podSelector: {}
- to:
- ipBlock:
cidr: 0.0.0.0/0
ports:
- port: 443
- port: 80