skip to content
Alvin Lucillo

Default deny netpol

/ 1 min read

💻 Tech

To deny all incoming and outgoing connections in a namespace, just declare a network policy with following specs:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: default-deny-all
  namespace: default
spec:
  podSelector: {}
  policyTypes:
  - Ingress
  - Egress