Ran into this pattern on a lot of clusters, so here's the write-up I wish I'd had. (I work at a Kubernetes consultancy, Agency 42. Nothing to sell here: the manifests are public on GitHub.)
Symptom. You apply a "default deny" policy as a security baseline and within seconds everything in the namespace starts failing with lookup postgres... i/o timeout , ;; connection timed out; no servers could be reached , EAI_AGAIN , UnknownHostException . Readiness probes fail, apps that connect at startup go into CrashLoopBackOff, and someone declares the database down. It isn't. Your pods just can't resolve names any more.
Why. Once any policy selects a pod and lists Egress in policyTypes , all egress is denied unless allowed. DNS is just UDP/TCP egress to CoreDNS. No exceptions.
Confirm in 30 seconds:
kubectl -n my-app run dns-test --rm -it --restart=Never --image=busybox:1.36 -- nslookup kubernetes.default.svc.cluster.local
Times out in your namespace but works in a fresh namespace with no policies?…