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. 1.Check CoreDNS ConfigMap:
  2. 2.```bash
  3. 3.kubectl get configmap coredns -n kube-system -o yaml
  4. 4.`
  5. 5.Look for syntax errors in the Corefile.
  6. 6.Test internal DNS from a debug pod:
  7. 7.```bash
  8. 8.kubectl run dns-test --rm -it --image=busybox:1.28 --restart=Never -- nslookup kubernetes.default
  9. 9.`
  10. 10.Fix CoreDNS memory limits:
  11. 11.```bash
  12. 12.kubectl edit deployment coredns -n kube-system
  13. 13.# Increase:
  14. 14.# resources:
  15. 15.# limits:
  16. 16.# memory: 256Mi
  17. 17.`

Prevention - Monitor CoreDNS query metrics (coredns_dns_requests_total) - Set CoreDNS memory limits based on cluster size - Validate Corefile changes with `coredns -conf Corefile` - Use multiple CoreDNS replicas (at least 2) - Test DNS after any ConfigMap changes