kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
  annotations:
    gardener.cloud/description: |
      Allows Egress from pods labeled with 'networking.gardener.cloud/to-dns=allowed'
      to DNS running in the 'kube-system' namespace.
  name: gardener.cloud--allow-to-dns
  namespace: kube-system
  labels:
    origin: gardener
spec:
  podSelector:
    matchLabels:
      networking.gardener.cloud/to-dns: allowed
  policyTypes:
  - Egress
  egress:
  - to:
    - podSelector:
        matchExpressions:
        - {key: k8s-app, operator: In, values: [kube-dns,coredns]}
    ports:
    - protocol: UDP
      port: 53
    - protocol: TCP
      port: 53
    - protocol: UDP
      port: 8053
    - protocol: TCP
      port: 8053