In Kubernetes, external lookups from pods are slow and CoreDNS logs show many NXDOMAIN queries like `api.stripe.com.default.svc.cluster.local`.
IntermediateTroubleshootingDNS resolution failures
Answer
Likely causes → ndots:5 in pod resolv.conf. Any name with fewer than five dots is tried with every search domain first, so one external lookup becomes up to 4–5 queries times A and AAAA.
Diagnose →
kubectl exec -it pod -- cat /etc/resolv.conf
kubectl -n kube-system logs -l k8s-app=kube-dns | grep NXDOMAIN | head
Fix → Use fully qualified names with a trailing dot (api.stripe.com.), or lower ndots per pod:
dnsConfig:
options:
- name: ndots
value: "2"
Prevent → Deploy NodeLocal DNSCache and enable CoreDNS autopath if it fits; set ndots in workload templates.
More on DNS resolution failures
`dig app.example.com` returns `status: NXDOMAIN`.Beginner`dig` returns `status: SERVFAIL` for one domain while other domains resolve fine.Intermediate`curl: (6) Could not resolve host: api.example.com` inside a container but it resolves on the host.BeginnerA DNS change was made 2 hours ago, but some users still reach the old IP.BeginnerJava service keeps connecting to an old IP long after the DNS record changed.IntermediatePods intermittently log `dial tcp: lookup orders on 10.96.0.10:53: i/o timeout`, about 5 seconds per failure.Advanced