CoreDNS is slow and the cluster makes thousands of external lookups. How do you reduce the load?
AdvancedScenarioServices, Ingress and DNS
Answer
Situation read → Latency spikes and CoreDNS CPU is high, and many queries are for external names with long search-path expansions.
What I'd do →
- Lower
ndotsin poddnsConfigto 2 for apps that call external hosts, or use trailing-dot FQDNs - Deploy NodeLocal DNSCache as a DaemonSet
- Scale CoreDNS with the cluster-proportional-autoscaler
- Enable the
cacheplugin with a sensible TTL in the Corefile - Watch
coredns_dns_request_duration_secondsin Prometheus
Why → With ndots:5, an external name like api.stripe.com is tried against four search domains first, multiplying queries.
Interview tip → Also mention conntrack races on UDP DNS that NodeLocal DNSCache avoids.
More on Services, Ingress and DNS
A Service has no endpoints. How do you find out why?BeginnerWhen do you use ClusterIP, NodePort, LoadBalancer and ExternalName?BeginnerTraffic to a Service works from some pods but times out from others. How do you debug it?AdvancedYou want to expose three HTTP services under one hostname with different paths. How?Intermediateingress-nginx returns 404 for a new host. What do you check?Intermediateingress-nginx returns 502 or 503 intermittently. What are the likely reasons?Intermediate