Kubernetes Network Policy: Why Your Pods Can't Talk

Kubernetes Network Policy: Why Your Pods Can't Talk

A deep dive into debugging Kubernetes network policies when pods suddenly lose connectivity.

The Case of the Missing Connectivity

Last Tuesday, our production API pods went silent. Not crashed, not OOMKilled - just couldn’t talk to the database anymore.

The Symptom

$ kubectl exec api-pod-7d8f9 -- curl db-service:5432
curl: (7) Failed to connect to db-service port 5432: Connection refused

But the pods were running. They were healthy. They just couldn’t reach each other.

The Investigation

Turns out someone had applied a NetworkPolicy during the morning deployment that blocked ALL ingress traffic with no exceptions.

The Fix

We needed to allow database connections from API pods with proper egress rules.

The Lesson

Always test NetworkPolicies in staging first. And never apply “deny-all” policies in production without a rollback plan.


Debugging time: 2 hours | Root cause: Overzealous security policy