apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: sample-network-policy-4
namespace: default
spec:
podSelector:
matchLabels:
app: webapp
app3: webapp3
policyTypes:
- Egress
- Ingress
ingress:
- from:
- podSelector:
matchLabels:
app: webapp
ports:
- port: 443
- port: 80
- from:
- podSelector: {}
- from:
- ipBlock:
cidr: 172.16.0.0/16
ports:
- port: 443
- port: 80
- from:
- ipBlock:
cidr: 0.0.0.0/0
ports:
- port: 443
- port: 80
egress:
- to:
- namespaceSelector: {}
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- port: 53
protocol: UDP
- to:
- podSelector: {}
- to:
- podSelector:
matchLabels:
app: webapp
ports:
- port: 443
- port: 80