Examples of network policies

Deny external traffic to Pods in the namespace, but allow traffic to external resources from within the namespace

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: delete
spec:
  podSelector: {}
  egress:
  - {}
  ingress:
  - from:
    - podSelector: {}
  policyTypes:
  - Ingress
  - Egress

More examples are available in this repository.