Menu

Default-deny NetworkPolicy silently breaks DNS, and on OpenShift the port you need to allow is 5353, not 53

Reddit r/kubernetes·u/Agency42_Sweden·6 days ago
#V3FyFw4E
#openshift#egress#default#namespace#port
Reading 0:00
15s threshold

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?…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.