DNS not working inside a Kubernetes pod (could not resolve host / nslookup: can't resolve)
Pods can’t resolve service names or external hosts — CoreDNS is down, blocked by NetworkPolicy, or the upstream resolver fails.
Seen on:
Kubernetes
Meaning
Pods use CoreDNS (kube-dns service). Problems: CoreDNS pods crashing or overloaded, NetworkPolicies blocking UDP/TCP 53, wrong ndots search behaviour causing slow lookups, or the node’s upstream DNS failing.
Common causes
- CoreDNS pods not running/crashlooping (often a loop with host resolv.conf)
- NetworkPolicy blocks egress to kube-dns port 53
- Upstream DNS unreachable from nodes
- Using short names across namespaces (svc instead of svc.namespace)
⚡ Quick fix
- Test from a debug pod: nslookup kubernetes.default
- Check CoreDNS pods and logs
- Allow DNS egress in NetworkPolicies
Detailed fix by platform
Kubernetes
- bash
kubectl run dns-test --rm -it --image=busybox:1.36 --restart=Never -- nslookup kubernetes.default kubectl -n kube-system logs -l k8s-app=kube-dns --tail=50
How to diagnose
- CoreDNS — Pods Running? Logs?
- Policy — Egress to port 53 allowed?
- Name — Using svc.namespace.svc.cluster.local?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Kubernetes
- error converting YAML to JSON error converting YAML to JSON: yaml: line 12: did not find expected key
- is waiting to start Error from server (BadRequest): container "x" in pod "y" is waiting to start: ContainerCreating
- kubectl connection refused kubectl: The connection to the server localhost:8080 was refused — did you specify the right host or port?
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026