Your Kubernetes pods see slow DNS and sometimes SERVFAIL on external names. Where do you look?
IntermediateScenarioDNS & Service Discovery
Answer
Situation read → Typical CoreDNS issues: ndots, resolver overload, conntrack race on UDP.
What I'd do →
- Check CoreDNS pods and logs:
kubectl -n kube-system logs deploy/corednsand metrics for latency - Look at the pod
/etc/resolv.conf:options ndots:5meansapi.example.comis tried with 4 search suffixes first - Lower it per pod with
dnsConfig: options: [{name: ndots, value: "2"}]or use fully qualified names ending with a dot - Deploy NodeLocal DNSCache to cut latency and avoid conntrack
- Scale CoreDNS by replicas
Why → With ndots 5 every external lookup generates several failing queries, multiplying load on CoreDNS.
Interview tip → Say you check kubectl exec -it pod -- nslookup api.example.com timing before and after.
More on DNS & Service Discovery
A customer types www.example.com in a browser. Walk through how DNS resolves it.BeginnerWhat is the difference between an A record and a CNAME, and when do you use each?BeginnerWhy can't you put a CNAME at the zone apex, and what do you use instead?BeginnerYou are moving a site to a new server. What do you do with DNS to make the cutover smooth?BeginnerHow do you find which nameservers are authoritative for a domain and query them directly?BeginnerWhat DNS records do you set up for company email?Beginner