>DevOps Interview KB

How does NodeLocal DNSCache in Kubernetes actually reduce DNS-related failures, mechanically?

AdvancedConceptualKubernetesDNS7 min read

Short Answer

Without it, every Pod's DNS query travels through the cluster network to a small, shared set of CoreDNS Pod replicas, competing with every other Pod's DNS traffic and subject to the same conntrack/UDP-connection-tracking issues that cause intermittent failures at scale. NodeLocal DNSCache runs a DNS caching agent as a DaemonSet (one per node), so each node's Pods query a resolver running locally on their own node instead — most queries are served from that local cache without ever traversing the cluster network to CoreDNS at all, and the ones that do miss the cache go out over a more reliable, dedicated connection to the upstream CoreDNS service.

Detailed Explanation

In a default Kubernetes cluster, every Pod's DNS queries go to CoreDNS via a cluster-internal Service (kube-dns), meaning the traffic actually travels across the cluster's network, through iptables/IPVS load-balancing rules, to whichever CoreDNS Pod replica handles it — the same conntrack (connection tracking) mechanism kube-proxy uses for all Service traffic. At high query volume (many Pods doing many lookups), this shared path can hit real, well-documented problems: conntrack table exhaustion or race conditions specifically affecting UDP traffic (DNS's primary transport) can cause queries to silently fail or time out intermittently, disproportionately affecting DNS traffic because of its high volume and connectionless nature — this is a large part of why "DNS resolution works sometimes, fails other times" is a genuinely common Kubernetes cluster symptom at scale, not an application bug.

NodeLocal DNSCache restructures this path: it deploys a DNS caching agent as a DaemonSet, meaning exactly one instance runs on every node, listening on a link-local IP address bound specifically on that node (avoiding the cluster network's Service-routing/conntrack path entirely for the local hop). Pods are configured (via a modified /etc/resolv.conf, or transparently via iptables rules the DaemonSet sets up) to query this node-local resolver instead of going to CoreDNS's cluster Service IP directly. Most queries are then served from the node-local cache without any cluster-network traversal or conntrack involvement at all — a query answered from cache never leaves the node. For queries that do miss the local cache (not yet cached, or genuinely uncacheable), NodeLocal DNSCache forwards them upstream to CoreDNS, but does so over a dedicated, typically TCP-based connection (rather than the original UDP path) specifically to avoid the same conntrack/UDP issues that caused problems in the first place.

The net effect: the large majority of DNS traffic (repeat lookups, which dominate real workloads since the same few hostnames get resolved constantly) never touches the problematic shared cluster-network path at all, and what does still need to reach CoreDNS goes over a more robust connection — directly addressing the specific mechanism (conntrack/UDP issues at scale) that causes the intermittent failure pattern, rather than just adding more CoreDNS replicas to spread load (which helps but doesn't eliminate the underlying conntrack mechanism).

Interview Follow-Up Questions

  • Why does NodeLocal DNSCache specifically switch to TCP for the upstream connection to CoreDNS, rather than staying on UDP?
  • How would you verify NodeLocal DNSCache is actually working correctly on a cluster, rather than just assuming it's deployed and functioning?
  • What are the trade-offs or limitations of NodeLocal DNSCache — are there scenarios where it doesn't fully solve the problem?

Key Takeaways

  • Without NodeLocal DNSCache, every Pod's DNS query travels the cluster network to a shared CoreDNS Service, subject to conntrack/UDP issues at scale that cause intermittent failures.
  • NodeLocal DNSCache runs a per-node caching DaemonSet, serving most queries locally without any cluster-network traversal at all.
  • Cache misses are forwarded upstream to CoreDNS over a more robust (typically TCP-based) connection specifically to avoid the same conntrack/UDP issues.
  • This addresses the root mechanism of the intermittent-failure pattern, rather than just adding more CoreDNS capacity to spread the same problematic load.

References

Last updated August 21, 2026 · Last reviewed August 21, 2026