`nslookup` works but the application says `Name or service not known`.
IntermediateTroubleshootingDNS resolution failures
Answer
Likely causes → nslookup talks to the DNS server directly; the app goes through glibc NSS (/etc/nsswitch.conf, /etc/hosts, search domains). A broken hosts entry, missing dns in nsswitch, or a short name without the right search domain breaks the app only.
Diagnose →
getent ahosts myservice # resolves the same way the app does
grep hosts /etc/nsswitch.conf
cat /etc/resolv.conf
Fix → Fix nsswitch/hosts/search domains, or use FQDNs in app config.
Prevent → Test with getent, not nslookup/dig, when debugging application resolution.
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.IntermediateIn Kubernetes, external lookups from pods are slow and CoreDNS logs show many NXDOMAIN queries like `api.stripe.com.default.svc.cluster.local`.Intermediate