Skip to content

DNS resolution failure in pods

Name resolution inside pods fails or takes seconds. The errors depend on the client: could not resolve host, no such host, Temporary failure in name resolution, or dial udp 10.96.0.10:53: i/o timeout.

  1. Is CoreDNS healthy? kubectl -n kube-system get pods -l k8s-app=kube-dns and their logs. (CoreDNS keeps the kube-dns label.)

  2. Does it fail everywhere or in one namespace? Test from a pod in a healthy namespace and in the affected one:

    Terminal window
    kubectl -n <ns> run dnstest --rm -it --restart=Never --image=busybox:1.36 -- nslookup kubernetes.default
  3. One namespace only: look for NetworkPolicies there that block egress to kube-system on port 53: kubectl get networkpolicy -n <ns>.

  4. Slow, not failing: check /etc/resolv.conf in the pod for ndots:5, and compare timings for example.com versus example.com. (with the trailing dot).

Symptom Cause
Fails everywhere, CoreDNS pods crashing CoreDNS misconfiguration (Corefile), or a forwarding loop to itself
Fails in one namespace only Egress NetworkPolicy without a DNS allow rule
i/o timeout to the DNS Service IP kube-proxy or CNI not forwarding to CoreDNS pods
Internal names fine, external names fail Upstream resolvers unreachable from CoreDNS
Everything slow ndots:5 causing several failed lookups per external name, or CoreDNS under-scaled

Fix the layer that fails. For policies, add an egress rule to CoreDNS on UDP and TCP port 53. For slowness, set dnsConfig.options ndots: 2 on workloads that call external names, and scale CoreDNS with the cluster.

Read next: Services, DNS, and kube-proxy and Network policies.