---
  apiVersion: networking.k8s.io/v1
  kind: NetworkPolicy
  metadata:
    name: deny-db-traffic
    labels:
      app: reddit
  spec:
    podSelector:
      matchLabels:
        app: reddit
        component: mongo
    policyTypes:
    - Ingress
    ingress:
    - from:
      - podSelector:
          matchLabels:
            app: reddit
            component: comment
      - podSelector:
          matchLabels:
            app: reddit
            component: post
