apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  labels:
    app: api
    project: demo
    service: network-policy
  name: demo-network-policy
spec:
  egress:
  - to:
    - podSelector:
        matchLabels:
          app: web
  - ports:
    - port: 53
      protocol: TCP
    - port: 53
      protocol: UDP
    - port: 80
      protocol: TCP
  ingress:
  - from:
    - podSelector:
        matchLabels:
          app: api
          project: demo
  - ports:
    - port: 80
      protocol: TCP
  podSelector:
    matchLabels:
      app: api
      project: demo
  policyTypes:
  - Ingress
  - Egress
