apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: {{ include "api-gateway.fullname" . }}-network-policy labels: {{- include "api-gateway.labels" . | nindent 4 }} spec: podSelector: matchLabels: {{- include "api-gateway.selectorLabels" . | nindent 6 }} policyTypes: - Ingress - Egress ingress: - from: - podSelector: matchLabels: app.kubernetes.io/name: api-gateway ports: - port: http protocol: TCP egress: # Allow DNS resolution - to: [] ports: - port: 53 protocol: UDP - port: 53 protocol: TCP