DNS Query Failures in Kubernetes

I run applications and a few add-ons in a Kubernetes cluster, and DNS query failures were intermittently causing Pods to die.

I had experienced something similar on AWS before. I knew that running a DNS server ourselves or using a DNS cache could help avoid overloading Route 53 Resolver with queries.

If you would like more details about the AWS case, the links below should be helpful.


Drawing on that experience, I looked for a similar approach and learned that NodeLocal DNSCache can reduce DNS query load in Kubernetes as well.

Deploying NodeLocal DNSCache is straightforward using the official Kubernetes documentation. It also seems that managed Kubernetes services from cloud providers may offer NodeLocal DNSCache as an add-on.


First, I changed the CoreDNS logging level to Debug, then compared the logs in the CoreDNS Pods before and after deploying NodeLocal DNSCache.

The number of log entries in CoreDNS clearly decreased after deploying NodeLocal DNSCache. During about a month of monitoring, no query failure issues occurred.


If you have a similar problem, give NodeLocal DNSCache a try. If you know a better approach, please share it! 🫡

Diagram

100%

Drag to pan; pinch or use the wheel to zoom. Keyboard: arrow keys pan, + − zoom, 0 fits, Esc closes. The same content is in “Read the diagram as text” below the figure.