DNS inside the cluster is failing intermittently. Debug it.
AdvancedHands-onLive debugging tasks
Answer
kubectl -n kube-system get pods -l k8s-app=kube-dns -o wide
kubectl -n kube-system logs -l k8s-app=kube-dns --tail=50
kubectl run dnstest --rm -it --image=nicolaka/netshoot -- bash
# cat /etc/resolv.conf # nameserver, search domains, ndots:5
# dig api.default.svc.cluster.local
# for i in $(seq 50); do dig +short google.com >/dev/null || echo fail; done
kubectl -n kube-system top pods -l k8s-app=kube-dns
Common causes: too few CoreDNS replicas (CPU throttling), conntrack races on UDP, ndots:5 multiplying external lookups, or NetworkPolicy blocking port 53 egress. Fixes: scale CoreDNS or use NodeLocal DNSCache, set dnsConfig.options ndots: 2, and use FQDNs with a trailing dot for external names.
Key trick → ndots:5 means api.stripe.com is first tried against every search domain, so one lookup becomes 4 to 5 queries. Mentioning it shows real production experience.
More on Live debugging tasks
A pod is in CrashLoopBackOff. You have 10 minutes. Walk through your commands.BeginnerThe pod shows `OOMKilled`. Diagnose and fix it.BeginnerA pod is stuck in `ImagePullBackOff`. Fix it.BeginnerA pod is `Pending` forever. What do you check?AdvancedThe Service returns "connection refused" but pods are Running. Debug it.IntermediateA Docker container exits immediately after `docker run -d`. Find out why.Beginner