Kubernetes cluster DNS service investigation cheat sheet
Inspect the cluster DNS Service, EndpointSlices, DNS pods and logs when workloads cannot resolve names.
Kubernetes with kubectl read access to kube-system DNS resources. The common DNS Service is named kube-dns even when CoreDNS provides it.
Updated · Kubernetes · 6 min read
| Command | What it does |
|---|---|
kubectl config current-context | Confirm the selected cluster |
kubectl get service kube-dns -n kube-system -o wide | Inspect the cluster DNS Service |
kubectl describe service kube-dns -n kube-system | Inspect DNS Service configuration |
kubectl get endpointslice -n kube-system -l kubernetes.io/service-name=kube-dns | Inspect DNS EndpointSlices |
kubectl get pods -n kube-system -o wide | Inspect system pod readiness |
kubectl logs -n kube-system deployment/coredns --since=30m --tail=100 | Review bounded CoreDNS logs |
Walkthrough
Confirm the target cluster and authorized access. Labels and deployment names can vary; check the Service selector and pod labels before filtering. Commands inspect resources and logs without changing DNS configuration.
Step 1: Confirm the selected cluster
kubectl config current-context
Compare the local context with the approved cluster inventory. Context names are local labels and do not independently establish the target environment.
Step 2: Inspect the cluster DNS Service
kubectl get service kube-dns -n kube-system -o wide
Record the ClusterIP, exposed ports and selector. An assigned address does not prove that the service has ready backends or that clients can reach them.
Step 3: Inspect DNS Service configuration
kubectl describe service kube-dns -n kube-system
Review the actual selector, ports and endpoint summary. Use the selector returned by your environment rather than assuming every cluster uses the same DNS pod label.
Step 4: Inspect DNS EndpointSlices
kubectl get endpointslice -n kube-system -l kubernetes.io/service-name=kube-dns
Compare the returned addresses and ports with the expected DNS backends. No endpoints can indicate a selector or readiness issue, but must be interpreted with the pod and Service state.
Step 5: Inspect system pod readiness
kubectl get pods -n kube-system -o wide
Identify the actual DNS pods from their names and labels, then check readiness, restarts and node placement. A running pod is not necessarily ready or answering queries.
Step 6: Review bounded CoreDNS logs
kubectl logs -n kube-system deployment/coredns --since=30m --tail=100
Use this only if deployment/coredns exists in your environment; otherwise select the appropriate DNS workload. Redact internal names before sharing logs and correlate with the incident time.
WORKED INCIDENT
Practical case: Workloads cannot resolve service names
Fictional teaching scenario; observations are examples, not captured production output.
Situation
Multiple pods report DNS timeouts while their applications remain running.
Investigation sequence
1. Confirm the selected cluster
kubectl config current-contextVerify the cluster context before examining system resources.
2. Inspect the cluster DNS Service
kubectl get service kube-dns -n kube-system -o wideConfirm the kube-dns Service and its expected address and ports.
3. Inspect DNS Service configuration
kubectl describe service kube-dns -n kube-systemRead the Service selector and compare it with the actual DNS pods.
4. Inspect DNS EndpointSlices
kubectl get endpointslice -n kube-system -l kubernetes.io/service-name=kube-dnsInspect the EndpointSlices for ready backend addresses.
5. Inspect system pod readiness
kubectl get pods -n kube-system -o wideReview DNS pod readiness and recent restarts in the same namespace.
Example findings
Illustrative findings: the DNS Service exists but its EndpointSlice has no ready addresses because the selected DNS pods are unready.
Interpret the findings
Missing ready backends can explain failed queries through the Service in this example. Pod logs and readiness events are needed to establish why the DNS pods are unready.
Verify the outcome
After the platform owner restores the DNS workload, verify ready EndpointSlices and repeat an approved name lookup from an affected workload.
Escalation handoff
Provide cluster, DNS Service selector, endpoint state, pod readiness and sanitized timestamps to the platform owner.
Primary references
Documented reference; examples above are teaching scenarios. Confirm behavior against your deployed version.