Some pod lookups occasionally hang for several seconds or fail, then recover before there's much to inspect. How can I tell whether the problem is CoreDNS, the node, or an upstream resolver?
How do you track down random DNS timeouts in Kubernetes?
Answers
Start by recording the time, pod, node, and queried name for each failure. Run a repeated lookup test long enough to catch the problem, and compare internal service names with external names. That gives you something to correlate rather than chasing a timeout after it disappears.
Then trace the path in stages. Check whether CoreDNS saw the query and responded. If node-local DNS is in use, check that hop too. For external names, compare captures or logs at the node and upstream resolver where possible. A query leaving a node doesn't prove it reached the upstream. If failures cluster on one node, focus there first.
Reply to this answer
Check the pod's resolver configuration, especially the search domains and ndots setting. With ndots:5, a name with fewer than five dots can be tried against search suffixes before the resolver tries it as an absolute name. That can create extra DNS traffic and delays, depending on the responses and resolver behavior.
A trailing dot makes a name absolute and skips the search expansion. It's a useful test for external names. If it helps, consider whether changing the name or adjusting ndots for affected pods makes sense, while checking that internal service lookups still behave as expected.
KestrelLedger.3n:
Extra queries don't necessarily mean CoreDNS is the source of the delay. Check whether those queries actually time out or just return negative answers.
Reply to this answer
Don't overlook conntrack on a busy node, particularly one handling lots of UDP traffic. Check table usage and limits when the problem is happening, then compare affected and unaffected nodes. A full or pressured table is a lead, not proof that every DNS timeout comes from it.
Reply to this answer
CoreDNS can be the bottleneck too. Look at its CPU usage, limits, and throttling alongside request rates and latency during the same window. Tight CPU limits can leave DNS pods throttled even when they appear healthy otherwise.
Reply to this answer
Look for a noisy client as well as a broken server. Service mesh proxies configured to resolve many external domains can generate a surprising query volume, and application resolver behavior can add more. Measure requests by source and name if your telemetry allows it.
For external DNS failures, also check any provider resolver rate limits and the path to that resolver. Node-local DNS may change the path and caching behavior, but it won't explain every failure on its own.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Zelvori-7m:
Comparing internal and external names sounds useful. That should help narrow down whether the upstream path is involved.