CoreDNS in EKS
CoreDNS provides in-cluster DNS so pods can find each other by service name.
CoreDNS is the cluster DNS server. It lets a pod reach a service by name — for example web.default.svc.cluster.local — instead of a hard-coded IP. EKS installs and manages it as an add-on.
How service discovery works
- Every Service gets a stable DNS name in the form
<service>.<namespace>.svc.cluster.local. - Pods query CoreDNS (running in
kube-system) for these names. - CoreDNS returns the service's cluster IP, which forwards to healthy pods.
Operating it
CoreDNS runs as a Deployment. On busy clusters you may scale its replicas up so DNS lookups don't become a bottleneck. Because it's a managed add-on, you can update it with a single command.
Example
# CoreDNS runs as a Deployment in kube-system
kubectl get deployment coredns -n kube-system
# Update the managed CoreDNS add-on to a specific version
aws eks update-addon --cluster-name demo \
--addon-name coredns --addon-version v1.11.1-eksbuild.9When to use it
- A developer uses the Service DNS name my-service.default.svc.cluster.local to connect microservices without hardcoding IP addresses.
- A platform team scales CoreDNS from 2 to 4 replicas to handle the increased DNS query load after a 3x cluster growth.
- An SRE uses kubectl exec to run nslookup inside a pod against CoreDNS to diagnose why a service cannot be resolved by name.
More examples
Check CoreDNS deployment status
Verifies that CoreDNS pods are running and ready, which is required for all in-cluster service discovery.
kubectl get deployment coredns -n kube-system
kubectl get pods -n kube-system -l k8s-app=kube-dnsTest DNS resolution from a pod
Launches a temporary pod to test DNS resolution of the Kubernetes API service, confirming CoreDNS is working correctly.
kubectl run dns-test --image=busybox:1.36 --rm -it --restart=Never -- \
nslookup kubernetes.default.svc.cluster.localScale CoreDNS for high load
Increases CoreDNS replica count to reduce DNS query latency under heavy in-cluster service discovery load.
kubectl scale deployment coredns \
--replicas=4 \
-n kube-system
kubectl rollout status deployment/coredns -n kube-system
Discussion