Kubernetes
NetworkPolicy Generator
Build a NetworkPolicy with ingress and egress peers, and the DNS exception egress rules need.
Policy
Leave empty to select every pod in the namespace.
Declares the policy types with no rules, which blocks everything in those directions.
Allow ingress from
Peer 1
Allow egress to
Peer 1
Without this, every name lookup from the selected pods fails — usually seen as connection timeouts rather than a policy error.
Output · NetworkPolicy
- A NetworkPolicy is additive and deny-by-default per direction: once any policy selects a pod, only traffic explicitly allowed by some policy is permitted in the listed policyTypes. Pods no policy selects stay fully open.
- NetworkPolicy is enforced by the CNI plugin. Flannel ignores it entirely; Calico, Cilium and the major managed CNIs enforce it. Verify yours does before relying on this.