apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: web-netpol spec: podSelector: matchLabels: app: web policyTypes: - Ingress - Egress ingress: - from: [] ports: - port: 80 protocol: TCP egress: - to: - podSelector: matchLabels: app: api ports: - port: 3000 protocol: TCP - to: - namespaceSelector: matchLabels: name: kube-system podSelector: matchLabels: k8s-app: kube-dns ports: - port: 53 protocol: UDP