Kubernetes NodeLocal DNSCache Explained 🚀
When it comes to performance, Every DNS lookup in Kubernetes matters.
Without NodeLocal DNSCache, Pods send DNS queries to the kube-dns/CoreDNS Service IP.
These requests go through kube-proxy, DNAT rules, and conntrack before reaching CoreDNS.
In busy clusters, this can add latency and increase pressure on the conntrack table.
NodeLocal DNSCache solves this by running a local DNS cache on every node as a DaemonSet.
So, instead of talking to CoreDNS directly, Pods send DNS queries to the local cache on the same node.
Here are its key benefits,
- It Reduces average DNS lookup time as the DNS queries are resolved locally using DNS cache
- It reduces load on CoreDNS
- It prevents conntrack table exhaustion as Connections from Pods to their local cache don't create conntrack table entries
- DNS queries for external URLs fcan be forwarded directly without involving CoreDNS
We share deep dives on Kubernetes, DevOps, MLOps, Cloud and GitOps
→ 𝗝𝗼𝗶𝗻 𝗛𝗲𝗿𝗲 (𝟭𝟬𝟬% 𝗳𝗿𝗲𝗲):
newsletter.devopscube.com/su…
♻️ PS: Repost and share it with the DevOps community.
Note: NodeLocal DNSCache it is not enabled by default in Kubernetes.
It must be deployed manually as a DaemonSet (except on managed platforms like GKE Autopilot where it's now default).
Got any tips?
⬇️ Share and discuss in the comments below! ⬇️
#devops #kubernetes