Interview Prep/Networking/DNS & Service Discovery

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 →

  1. Check CoreDNS pods and logs: kubectl -n kube-system logs deploy/coredns and metrics for latency
  2. Look at the pod /etc/resolv.conf: options ndots:5 means api.example.com is tried with 4 search suffixes first
  3. Lower it per pod with dnsConfig: options: [{name: ndots, value: "2"}] or use fully qualified names ending with a dot
  4. Deploy NodeLocal DNSCache to cut latency and avoid conntrack
  5. 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.

All Networking questions Roadmap: Networking for DevOps

More on DNS & Service Discovery