Q: How does DNS resolution work step-by-step from domain name to Kubernetes pod, and what role do root servers and CoreDNS play?
The definitive step-by-step journey of a DNS lookup: resolving root servers, TLD nameservers, authoritative nameservers, local recursive caches, and Kubernetes CoreDNS ndots:5 search path amplification.
Want to master this scenario in a live sandbox? KodeKloud's Istio Service Mesh & Advanced Kubernetes Networking Course covers this exact problem with hands-on terminal drills.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: DNS resolution is a hierarchical distributed database lookup. A lookup traverses local cache, recursive resolvers, root nameservers, TLD nameservers, and authoritative nameservers, with special search path amplification inside Kubernetes.
Browser Cache & Recursive Resolver
Browser checks local memory cache -> OS resolver checks /etc/hosts and systemd-resolved -> forwards query to recursive resolver (e.g., 8.8.8.8 or AWS VPC Route 53 Resolver at VPC Base + 2).
Iterative Hierarchy: Root (.) -> TLD (.com) -> Authoritative Nameserver
Recursive resolver queries Root Nameserver (.) -> returns TLD nameserver for .com -> queries TLD nameserver -> returns Authoritative Nameserver (e.g., Route 53 ns-xxx.awsdns.com) -> returns the final A/AAAA/CNAME record with TTL.
Kubernetes Pod CoreDNS & ndots:5 Amplification
Inside Kubernetes, /etc/resolv.conf has ndots:5 and search paths (default.svc.cluster.local, svc.cluster.local, cluster.local). Any domain with fewer than 5 dots causes CoreDNS to query internal search domains first, generating up to 4 failed NXDOMAIN lookups before trying the external internet.
# /etc/resolv.conf in a pod
nameserver 10.96.0.10
search default.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
- Browser checks local OS cache before sending query to recursive resolver.
- Recursive resolver queries Root (.), then TLD (.com), then Authoritative nameserver for the A record.
- In Kubernetes, CoreDNS handles internal cluster service discovery (.cluster.local).
- Beware ndots:5: append a trailing dot (api.stripe.com.) in pods to bypass 4 redundant NXDOMAIN lookups.
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
- Treating stateless Network ACLs as stateful firewalls without specifying outbound ephemeral return ports when addressing step-by-step Security Groups track connection state automatically, whereas stateless Network ACLs require explicit ephemeral port rules (1024-65535) for return traffic.
- Opening short-lived non-pooled TCP client connections, exhausting ephemeral ports in TIME_WAIT state when addressing kubernetes Rapidly opening and closing short-lived TCP sockets without connection pooling exhausts ephemeral ports, causing connection refusal errors.
- Directing load balancer health checks to heavy computational endpoints rather than dedicated health routes Deep health check paths amplify database load during traffic spikes and risk cascading eviction of healthy application nodes.
- Triggering BGP route dampening by rapidly announcing and withdrawing multihomed network prefixes Rapidly flapping BGP route announcements triggers upstream ISP route dampening, effectively blackholing network traffic for hours.