DNS resolution failing inside pods — CoreDNS issues
curl: Could not resolve host inside pods
Focused incident mode — strips away everything but this runbook.
Symptoms
- curl: Could not resolve host inside pods
- getaddrinfo: Name or service not known
- Services reachable by ClusterIP but not by name
Evidence to grab
Collect these artifacts before you change anything — they prove (or rule out) each cause.
CoreDNS pod health
kubectl get pods -n kube-system -l k8s-app=kube-dnsPod resolv.conf
kubectl exec <pod> -n <namespace> -- cat /etc/resolv.conf
Diagnostic flow
Run the steps in order, marking each claim confirmed or refuted. The evidence you gather feeds the ranked causes below.
Guided decision tree is ready.
Steps with commands, expected output, and pass/fail branches.
Ranked root causes
Evidence checklist
- No resolution from any pod
- CoreDNS pods CrashLoopBackOff or nearly exhausted
- High CoreDNS error metrics (coredns_dns_responses_total{rcode=SERVFAIL})
Confirm before fixing
kubectl get pods -n kube-system -l k8s-app=kube-dnsCheck CoreDNS replicas
Fix
kubectl rollout restart deployment/coredns -n kube-systemRestart CoreDNS
Expected: deployment.apps/coredns restarted
Resolution runbook
Apply from top to bottom after the cause is confirmed. Review every command before running it — risk tags are shown on each.
kubectl run dns-test --image=busybox:1.35 --rm -it -- nslookup kubernetes.defaultIsolate: cluster-wide vs single pod DNS failure
kubectl get pods -n kube-system -l k8s-app=kube-dnsCoreDNS replica status
kubectl rollout restart deployment/coredns -n kube-systemRestart if CoreDNS is degraded
kubectl exec <pod> -n <namespace> -- cat /etc/resolv.confCheck ndots and nameserver for per-pod failures
Prevention
- Scale CoreDNS (or use NodeLocal DNS) for large clusters.
- Set ndots:2 and reasonable timeouts cluster-wide via CoreDNS configMap.
- Alert on CoreDNS SERVFAIL and latency with coredns_dns_request_duration_seconds.
- Use FQDNs (<svc>.<ns>.svc.cluster.local) in app configs.
Related runbooks
Same stack, same failure family — worth a skim.
Commands marked READ CHANGE DESTRUCTIVE — never run DESTRUCTIVE commands against production data you cannot restore. Copy → verify → execute.