← Policy catalog
</> NetworkPolicy · Apache-2.0

Deny All Traffic

networkpolicy-deny-any-any

productKubernetes

Deny all ingress and egress traffic for all pods in the namespace.

What this is

A reference manifest to copy and adapt, not a rule cenroq enforces for you. It carries no severity, belongs to no bundle, and nothing on your cluster changes until you apply it yourself.

Manifest

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: deny-any-any
  annotations:
    cenroq.io/displayName: "Deny All Traffic"
    cenroq.io/description: "Deny all ingress and egress traffic for all pods in the namespace."
spec:
  podSelector: {}
  policyTypes:
  - Ingress
  - Egress

Save it as networkpolicy-deny-any-any.yaml — the commands below assume that name.

Apply it

This is a manifest, not an admission policy, so there is nothing for kubeapt validate to check it against. Adapt the selectors and namespace first, then:

$ kubectl apply -f ./networkpolicy-deny-any-any.yaml