K8s Network Policies

Default-deny.

Default-deny baseline

Default Kubernetes networking lets every pod reach every other pod. NetworkPolicy resources turn that into an explicit allowlist; the CNI choice decides whether the policies actually enforce. Without enforcement, NetworkPolicy is documentation, not security.

Ingress policies

Ingress policies define who is allowed to talk to a pod. Namespace selectors, pod selectors, and IP blocks are the primitives; explicit ports keep accidental wide-open rules from happening.

Egress policies

Egress policies define what a pod is allowed to call out to. Often skipped; high security value, especially for blocking SSRF and metadata-endpoint attacks.

Rolling out default-deny

The rollout is the high-risk step where premature default-deny breaks production. Audit, add policies, then flip the default; never the other way around.

Operating network policies

Operating network policies is a discipline in itself. Git source-of-truth, quarterly review, and a regular drill keep the policies useful instead of stale.