DNS resolution inside the cluster is slow and causing timeouts. How do you debug it?
IntermediateScenarioScaling and performance
Answer
Situation read → CoreDNS overload or the ndots:5 default causing several lookups per external name.
What I'd do →
- Test from a pod:
kubectl run dnstest --rm -it --image=busybox:1.36 -- nslookup api.example.com
kubectl -n kube-system logs -l k8s-app=kube-dns --tail=50
- Check CoreDNS CPU, replicas and errors; scale it (or use the autoscaler) for cluster size.
ndots:5makesapi.example.comtry several search-domain suffixes first. Use fully qualified names with a trailing dot, or setdnsConfig.optionsndots: "2"for apps that mostly call external names.- Deploy NodeLocal DNSCache to cut latency and conntrack races.
- On EC2, check the per-ENI limit of 1,024 packets per second to the VPC resolver.
Why → Every external lookup can turn into five queries with default ndots, multiplying DNS load.
Interview tip → ndots:5 and NodeLocal DNSCache are the two specifics interviewers look for.
More on Scaling and performance
Traffic is expected to 10x for a sale next week. How do you prepare the platform?IntermediateThe HPA is configured but pods don't scale even though the app is slow. Why?BeginnerPods are Pending during a traffic spike because the cluster is out of capacity. What do you do now and long term?IntermediateThe database CPU is at 95% and the API is timing out. What's your approach?Intermediate"Too many connections" errors from Postgres after scaling the app out. How do you fix it?IntermediateLatency is fine on average but p99 is terrible. Where do you look?Advanced