apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: q5-networkpolicy
  namespace: question5
spec:
  podSelector: {}
  policyTypes:
    - Ingress
    - Egress
  ingress:
  - from:
    - podSelector:
        matchLabels:
          app: frontend
  egress:
    - to:
      - namespaceSelector: {}
        podSelector:
          matchLabels:
            k8s-app: kube-dns
      ports:
      - protocol: TCP
        port: 53
      - protocol: UDP
        port: 53
    - to:
      - podSelector:
          matchLabels:
            app: backend