How do you troubleshoot "DNS resolution failed"?
⚡
Quick Answer
A hostname cannot be resolved to an IP. Check the resolver config (/etc/resolv.conf), query the name directly with nslookup/dig, and verify the DNS server is reachable and returning records.
Detailed Answer
Causes: wrong or unreachable DNS server, a missing record, or a broken /etc/resolv.conf (or, in Kubernetes, a CoreDNS issue). Diagnose with dig <name> / nslookup <name> (try an explicit server: dig @8.8.8.8 <name>), cat /etc/resolv.conf, and in clusters check CoreDNS pods/logs and the pod dnsPolicy. Confirm the record exists and TTLs are sane.
Code Example
dig <domain> nslookup <domain> cat /etc/resolv.conf
💡
Interview Tip
In Kubernetes, add CoreDNS to the checklist — a lot of "DNS failed" incidents are CoreDNS, not upstream.
linuxdnstroubleshooting