Introduction CoreDNS is responsible for internal Kubernetes DNS resolution. When CoreDNS fails, pods cannot discover services by name, breaking all microservice communication that relies on DNS-based service discovery.
Symptoms - `nslookup kubernetes.default` inside pod returns SERVFAIL - Applications cannot connect to other services by name - CoreDNS pods in CrashLoopBackOff or Pending - CoreDNS logs show configuration errors or upstream failures - DNS queries timing out from pods
Common Causes - CoreDNS ConfigMap has syntax errors - CoreDNS pods OOMKilled (default 170Mi memory limit) - Upstream DNS server unreachable - CoreDNS not bound to the kube-dns service - Network policy blocking DNS traffic (UDP 53, TCP 53)
Step-by-Step Fix 1. **Check CoreDNS pod status**: ```bash kubectl get pods -n kube-system -l k8s-app=kube-dns kubectl logs -n kube-system -l k8s-app=kube-dns --tail=50 ```
- 1.Check CoreDNS ConfigMap:
- 2.```bash
- 3.kubectl get configmap coredns -n kube-system -o yaml
- 4.
` - 5.Look for syntax errors in the Corefile.
- 6.Test internal DNS from a debug pod:
- 7.```bash
- 8.kubectl run dns-test --rm -it --image=busybox:1.28 --restart=Never -- nslookup kubernetes.default
- 9.
` - 10.Fix CoreDNS memory limits:
- 11.```bash
- 12.kubectl edit deployment coredns -n kube-system
- 13.# Increase:
- 14.# resources:
- 15.# limits:
- 16.# memory: 256Mi
- 17.
`