apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: mysql
spec:
  podSelector:
    matchLabels:
      io.kompose.network/mysql: "true"
  policyTypes:
    - Ingress
    - Egress
  ingress:
    - from:
        - podSelector:
            matchLabels:
              io.kompose.network/mysql: "true"
  egress:
    - to:
        - podSelector:
            matchLabels:
              io.kompose.network/mysql: "true"
    - to:
        - namespaceSelector: { }
          podSelector:
            matchLabels:
              k8s-app: kube-dns
      ports:
        - port: 53
          protocol: UDP
