criticalIntermediateSymptom-first#dns#coredns#networking

DNS resolution failing inside pods — CoreDNS issues

curl: Could not resolve host inside pods

Likely source:connectivityavailability

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-dns
  • Pod 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-dns
READ

Check CoreDNS replicas

Fix

kubectl rollout restart deployment/coredns -n kube-system
CHANGE

Restart 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.

1
kubectl run dns-test --image=busybox:1.35 --rm -it -- nslookup kubernetes.default
READ

Isolate: cluster-wide vs single pod DNS failure

2
kubectl get pods -n kube-system -l k8s-app=kube-dns
READ

CoreDNS replica status

3
kubectl rollout restart deployment/coredns -n kube-system
CHANGE

Restart if CoreDNS is degraded

4
kubectl exec <pod> -n <namespace> -- cat /etc/resolv.conf
READ

Check 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.

Commands marked READ CHANGE DESTRUCTIVE — never run DESTRUCTIVE commands against production data you cannot restore. Copy → verify → execute.