Why Kubernetes DNS resolution fails and how to isolate the cause
When pods cannot reach a Service by name but connecting to its ClusterIP still works, the problem is almost always in name resolution rather than in routing or the workload itself. Kubernetes runs a cluster DNS service, which in current clusters is typically CoreDNS, that answers queries for Service and Pod names under the cluster domain and forwards everything else to upstream resolvers. Teams usually need this troubleshooting path when an application fails on startup or intermittently after a deployment, when a new namespace or cluster behaves differently from an existing one, or when a change to network policy, node DNS settings or the upstream resolver coincides with errors. Confirm in your own cluster which DNS add-on is installed and which namespace it runs in before you start, because the names you check depend on it.
Four layers can break a lookup, and the goal of the first hour is to separate them. The first is the pod resolver configuration, the /etc/resolv.conf file the kubelet writes into each container, which holds the search domains and the ndots value that decide how short names are expanded and how many queries a single lookup generates. The second is CoreDNS itself: its pods, its configuration and its logs. The third is the upstream resolvers that CoreDNS forwards to for external names, which sit outside the cluster and may be managed by another team. The fourth is network policy, which can block UDP and TCP port 53 traffic from application pods to the DNS pods even when everything else is healthy. Test each layer separately, starting from a throwaway pod such as one built from a dnsutils image, so that a failure can be assigned to one layer before any configuration is changed.
How to test DNS from a dnsutils pod step by step
This sequence gives you a repeatable way to separate cluster DNS failures from application failures by testing service names, external names and pod IPs from inside the cluster. The result is a short record of which lookups succeed and where resolution breaks.
Confirm the failing lookup and namespace
Before you start a test pod, write down the exact name the application uses, such as a short service name or a fully qualified name, the namespace of the calling workload, and the error it returns. Ask the application owner to reproduce the failure and capture the time it happens. This gives you a baseline to compare against once the test pod is running. You know this step is done when you have one failing name, one namespace and one observed error message written down.
Deploy a dnsutils test pod
Create a short-lived pod that runs an image containing nslookup and dig, such as a dnsutils image from a registry you can reach, in the same namespace as the failing workload. Use a pod spec with a sleep command so the container stays up for interactive testing. If your cluster pulls images only from an approved private registry, confirm the image is mirrored there first. You know this step is done when
kubectl get podshows the test pod in the Running state.Check the pod resolv.conf
Open a shell in the test pod and read
/etc/resolv.conf. Confirm that the nameserver line points to the cluster DNS service address, which you can compare with the ClusterIP reported for the kube-dns service in the kube-system namespace. Also note the search domains and the ndots value, because they decide how short names expand before a query leaves the pod. You know this step is done when the nameserver matches the DNS service ClusterIP and you have recorded the search list and ndots setting.Query the kubernetes service name
From inside the test pod, run
nslookup kubernetes.defaultanddig kubernetes.default.svc.cluster.local. These names are created by the cluster itself, so a failure here points to cluster DNS, not to your application or your upstream resolvers. Record the answer address and the server that responded. You know this step is done when both commands return an address for the kubernetes service and the responding server is the cluster DNS service.Query an external name
Run
nslookupordigagainst a public name that your organization is allowed to resolve, and also against an internal name your applications depend on, if one exists. Success for the cluster service name but failure for external names usually indicates a forwarding or upstream resolver problem, which is covered in the next topic. Confirm the expected answer with your network team before you treat any result as a fault. You know this step is done when you have a clear success or failure record for each external name.Compare with a direct pod IP lookup
Get the IP address of a running pod with
kubectl get pod -o wide, then reverse-query it from the test pod withdig -xagainst the cluster DNS service, or check that a headless service returns pod addresses. Also test the failing service name directly with its full form. If the full name works and the short name fails, the problem is usually search domain expansion or ndots, not the service itself. You know this step is done when you can state whether the short name, the full name and the pod-level lookup each succeed or fail.Record results and remove the test pod
Write a table with each name tested, the command used, the answer or error, and the server that responded. Share it with the application owner and attach it to the incident or change record. Then delete the test pod with
kubectl delete podusing its name and namespace, and confirm it no longer appears inkubectl get pods. Leaving debug pods running adds clutter and may leave image pull or RBAC permissions in place longer than intended. You know this step is done when the record is saved and the test pod is gone.
How resolv.conf and ndots change which names pods query
When a pod resolves a short service name such as api and gets no answer, the first thing to inspect is whether the pod's search path contains the namespace and cluster suffixes it expects. Kubelet writes a resolv.conf into each pod that lists the cluster DNS service as nameserver and a set of search domains built from the pod's namespace, the service domain and the cluster domain. A short name only resolves if the search list produces a matching fully qualified name, so a pod in the wrong namespace, or one whose search list was overridden, will fail on names that work elsewhere.
- Namespace mismatch: A short name resolves only within its own namespace unless the caller uses
service.namespace, so confirm the target Service exists in the same namespace. - Search list overwritten: Check
/etc/resolv.confinside the failing pod withkubectl exec, not the node's file, because the pod copy is what matters. - Cluster domain differs: Some clusters use a cluster domain other than the default, so compare the search suffixes with the kubelet configuration.
- Headless or missing endpoints: A name can resolve but return no usable address if the Service has no ready endpoints, which is a separate check.
- Exact defaults: Confirm the search list and cluster domain against your cluster's Kubernetes version and kubelet settings before relying on them.
Compare the pod's search line with the Service's namespace and the cluster domain you configured.
External names are the most common source of slow DNS in clusters. Because the ndots option controls when the resolver tries the bare name before appending search domains, a name with fewer dots than the threshold is first sent through every search suffix. Each suffix produces a query that returns NXDOMAIN, and the resolver only then asks for the original name. Each extra round trip adds latency and load on CoreDNS, and when a name is also queried for both IPv4 and IPv6 records, the number of lookups multiplies.
- Search expansion: A name such as
api.example.comhas two dots, so it may be expanded through each cluster search suffix before the bare name is queried. - Trailing dot: Writing the name as
api.example.com.marks it fully qualified and skips search expansion in most resolvers. - Lower ndots for a workload: Setting a smaller
ndotsvalue throughdnsConfigreduces the extra queries for workloads that mostly call external hosts, with the trade-off that short internal names need full names. - Upstream failures: If the bare name also fails, the problem may sit in the upstream resolver that CoreDNS forwards to, so check CoreDNS logs and its forward configuration.
- Measure first: Time a lookup from a debug pod with and without a trailing dot to see whether expansion is the cause.
Before changing any setting, confirm whether the slow names are external and how many search suffixes each lookup tries.
A name that contains dots can resolve to something unexpected when a search suffix happens to match a real record. For example, a host name that contains the namespace or the cluster domain as a suffix may be answered by an internal Service when the caller meant an external host. This is less a fault in CoreDNS than a consequence of how the search list is applied, and it often appears after a namespace is renamed or a new Service is created with a name that collides with an external host.
- Accidental internal match: A query for
db.internal.example.commay be expanded and matched against a Service name when a search suffix lines up. - Ambiguity after new Services: Creating a Service whose name matches a common external host label can change answers for pods that already use that label.
- Fully qualified names: Ending the name with a dot forces the lookup to be treated as absolute, which removes this ambiguity for that call.
- dnsPolicy and dnsConfig: A pod with
dnsPolicyset toNoneuses only thednsConfigyou supply, which changes both the search list and the nameserver for that pod. - Review ownership: Record which namespaces and zones own each name so that collisions are caught before deployment.
When a result looks wrong, query the exact name with a trailing dot from the same pod to separate search expansion from the record itself.
A pod spec can override resolver behavior through dnsConfig, which accepts nameservers, searches and options entries, including ndots. Setting dnsPolicy to None requires that dnsConfig supply the nameservers, while other policies merge the custom values with the defaults the kubelet generates. Because the setting lives in the workload manifest, it is easy to apply to one deployment and forget that other teams copy the same template.
- Merge behavior: Confirm whether the chosen
dnsPolicyreplaces or extends the default search list before writing the override. - ndots in options: Set it as an option entry in the pod spec, then verify with
cat /etc/resolv.confinside the pod. - Rollout scope: Changing the template restarts pods, so plan the change with the owning team.
- Consistency: Keep the setting in a shared Helm value or policy so it is not drifted per namespace.
- Version checks: Field behavior and defaults can change between releases, so confirm them against your cluster's Kubernetes version.
After any dnsConfig change, exec into a restarted pod and confirm the resolver file reflects the intended search list and ndots value.
Reading CoreDNS health, logs and configuration
Start with the CoreDNS pods before reading any query output. Run kubectl -n kube-system get pods -l k8s-app=kube-dns and check that every replica is Running and Ready, and that the restart count is not climbing. A pod that restarts repeatedly usually points to a crash on startup, a failing health probe, or memory pressure, and the kubectl describe pod events and previous container logs (--previous) will show which. Confirm the label selector first, because some distributions name the deployment and labels differently. Then read the logs for the failure patterns that matter in DNS work: SERVFAIL and timeout lines from the forward plugin, and the loop detection error that CoreDNS prints when it finds a forwarding cycle, which typically means the upstream resolver sends queries back into the cluster. Logs are quiet by default, so expect little unless the log plugin is enabled, and enable it only for a short debugging window because it adds volume.
Next, review the Corefile in the coredns ConfigMap in kube-system. The lines to inspect are the kubernetes block (cluster domain, reverse zones and pods mode), the forward or proxy directive that defines upstream resolvers, the cache settings, the loop plugin, and the health and ready endpoints that the kubelet and Service rely on. Compare the ConfigMap with what your distribution documents, since a manual edit can be overwritten by the next install or upgrade, and reloading the configuration may require a restart depending on the reload setup in your version. CoreDNS load and placement also shape lookup latency. Replica count, CPU limits that throttle under bursts, and pods packed onto one node all create slow or failed lookups that look like application errors. Check whether the replicas spread across nodes and whether node-local DNS caching is in use. Finally, confirm the CoreDNS version shipped with your chosen distribution, since the Corefile syntax, plugin set and defaults differ between releases. Ask your distribution vendor for the exact image tag and its release notes, and check the upstream CoreDNS project documentation for the plugins you rely on.
Upstream resolvers and network policies that block DNS
When service lookups fail, the cause often sits outside CoreDNS itself, in the path between CoreDNS and the resolvers it forwards to, or in policy that quietly drops DNS traffic. The cards below cover the failure causes we see most often in self-managed clusters, each with the symptom to look for and the first check to run. Work through them in order so you separate a broken forwarder from a blocked port or a missing policy rule.
Unreachable upstream resolvers
CoreDNS forwards queries it cannot answer from the cluster to the upstream resolvers defined in its configuration. If those addresses are not reachable from the nodes where CoreDNS runs, external names fail while in-cluster service names still resolve. Run a lookup from a dnsutils pod against an external name, then query the upstream address directly from a node with nslookup or dig. If the direct query times out, the problem is routing or the resolver itself, not Kubernetes.
Firewall rules blocking port 53
DNS uses UDP port 53 for most queries and TCP port 53 for large responses and zone transfers, so a firewall that allows only one of them can produce intermittent failures. Host firewalls, cloud security groups and appliances between the nodes and the resolvers are common sources of this. Confirm both protocols with dig +tcp and dig against the same resolver from a node, and compare the results with a lookup from inside a pod. A query that works on the node but fails from the pod points at the pod network path.
Default-deny policy missing DNS egress
A NetworkPolicy with a default-deny egress rule stops pods from reaching anything not explicitly allowed, and DNS is one of the first casualties. Lookups then fail in the namespace while the same service works from another namespace without the policy. List the policies in the namespace with kubectl get networkpolicy -n and confirm that some egress rule allows traffic to the cluster DNS service on port 53 over both UDP and TCP. Also check that the rule selects the DNS pods' namespace and labels correctly.
Node-local DNS or CNI faults
Node-local DNS caches and CNI plugins sit between the pod and CoreDNS, so a fault there can look like a DNS outage. Symptoms include lookups that succeed on one node and fail on another, or failures that start after a node restart or CNI change. Check whether the affected pod's node runs a local cache, inspect its logs and confirm the cache can reach CoreDNS. Then check the CNI daemonset pods on that node, since a crashed or stale CNI agent can break pod networking without any DNS change.
Forwarding loops
A forwarding loop happens when CoreDNS sends queries to a resolver that eventually forwards them back to the cluster DNS service, or to itself. Queries then bounce until they time out, and CoreDNS logs may show repeated forwarding or loop-detection messages. Review the forward plugin targets in the Corefile, and check whether the node's /etc/resolv.conf points at the cluster DNS address. Remove any upstream that resolves back into the cluster, and confirm the resolvers are external servers.
Which fix fits which DNS failure
This table pairs common DNS failure patterns in a Kubernetes cluster with the first check to run, the fix that usually applies and the case where that fix is the wrong choice. Read it top down: confirm the symptom from a dnsutils pod, then move to the row that matches what you see before changing any configuration.
| Failure pattern | First check | Fix that usually applies | When the fix is the wrong choice |
|---|---|---|---|
| Only short service names fail, fully qualified names work | Compare the pod's /etc/resolv.conf search list and ndots value with the name being queried | Use the fully qualified service name in the application, or lower ndots for that workload's dnsConfig | Lowering ndots cluster-wide changes lookups for every pod and can break names that rely on search domains |
| Every lookup times out or returns SERVFAIL from all pods | Check CoreDNS pod status, readiness and recent logs for loop, plugin or upstream errors | Fix the CoreDNS configuration error, restart after correcting the Corefile, or resolve a forwarding loop | Scaling CoreDNS replicas does not help if the Corefile itself is invalid or the pods cannot reach any upstream |
| External names fail but cluster service names resolve | Run an nslookup of an external name from the dnsutils pod, then query the upstream resolver directly from a node | Correct the forward or upstream directive in the CoreDNS configuration so it points at a reachable resolver | Changing the in-cluster service records will not fix a resolver the nodes cannot reach or that refuses queries from the pod network |
| Lookups fail only from one namespace or workload | Inspect NetworkPolicy objects that select those pods and check for egress rules to kube-system on port 53 | Add an egress rule allowing UDP and TCP port 53 to the CoreDNS pods from that namespace | Opening DNS egress broadly to all destinations widens exposure, so restrict it to the CoreDNS selector and port |
| Intermittent failures under load, with some queries succeeding | Review CoreDNS CPU use, request volume and any dropped or timed-out upstream queries in metrics | Adjust CoreDNS resources or replica count, and consider node-local DNS caching | Raising limits does not address a single unhealthy upstream, and caching can hide stale records for longer than expected |
| Pods resolve names but connections still fail | Confirm the returned address, the Service endpoints and whether a NetworkPolicy blocks the actual application port | Fix the Service selector, endpoints or the policy on the application port | Editing DNS settings is the wrong response when the name resolves correctly and the fault sits in routing or policy |
How a service lookup travels from pod to upstream resolver
A lookup starts in the application's resolver library inside the pod, which applies the search list and ndots rules from /etc/resolv.conf before sending a query to the cluster DNS service IP. The service forwards it to a CoreDNS pod, which answers cluster names itself and passes other names to the upstream resolvers configured for the cluster. Two checkpoints can silently drop the query: a NetworkPolicy on the pod's namespace and the node firewall on the path to the resolver. Check each hop in that order when a lookup fails.
Query path from a pod's resolver to upstream DNS, with the two points where it can be blocked.
Security and operational considerations for DNS debugging
DNS debugging touches the cluster's most central service, so the people who can run test pods, the way CoreDNS is configured and the signals that reveal failures all need deliberate limits. The cards below cover who may debug, how CoreDNS changes are tracked, what query data is kept and how errors reach the on-call team.
Limit who can run test pods
A dnsutils pod is an ordinary pod, so anyone who can create pods in a namespace can run arbitrary tools there. Grant a narrow Role that allows creating pods in a dedicated troubleshooting namespace, bound to the on-call group, rather than cluster-wide pod creation. Check with kubectl auth can-i create pods --as for the users and service accounts you expect, and confirm that default service accounts cannot reach the same namespace.
Avoid broad debug rights
Ephemeral debug containers and node debugging sessions need their own permissions, and both can expose far more than DNS checks require. Restrict the pods/ephemeralcontainers subresource and node access to named operators, and remove wildcard verbs from any shared troubleshooting role. Review these bindings after each incident so temporary access does not become permanent.
Keep CoreDNS config in version control
The Corefile lives in a ConfigMap, and an edit made directly with kubectl edit takes effect without review or history. Store the Corefile and any forward or stub domain changes in Git, deploy them through the same pipeline as other cluster manifests, and record who approved each change. When a lookup breaks after an edit, the diff shows exactly what changed and the previous version can be restored quickly.
Log and retain DNS query data
CoreDNS query logging through the log plugin is useful during an investigation but can produce large volumes and may record internal hostnames that are sensitive. Enable it for a defined window, send output to your central log platform, and set a retention period that your data handling policy allows. Confirm with your security team which fields are kept and who may search them.
Alert on CoreDNS errors
Failures such as SERVFAIL responses, upstream timeouts and a drop in ready CoreDNS replicas often appear in application errors before anyone checks DNS. Alert on error response rates and on CoreDNS pod restarts or unready endpoints, and route those alerts to the team that owns cluster networking. Test each alert once by simulating an upstream failure in a non-production cluster.
Apply Pod Security Standards to test pods
Debug pods often need privileges that production workloads do not, so the namespace where they run is a risk boundary. Apply Pod Security Standards at the namespace level and decide which level the troubleshooting namespace may use. Confirm the chosen level with your platform team before on-call staff rely on it during an outage.
Pod Security StandardsQuestions teams ask before fixing Kubernetes DNS themselves
How long does diagnosing a Kubernetes DNS problem usually take?
Duration depends mostly on how many layers are involved and how much evidence is available on the first day. A failure confined to one namespace with a clear error in CoreDNS logs can be narrowed quickly. A intermittent failure that appears only under load, or only on some nodes, takes longer because the team must reproduce it, compare nodes and rule out upstream resolvers and network policies one at a time. Ask any partner to state the assumptions behind its estimate, including how many clusters, namespaces and resolvers are in scope and whether a reproducible test case already exists. No duration figure is given here because none was supplied for this work.
Can our in-house team fix Kubernetes DNS without outside help?
Many teams can, provided at least one engineer is comfortable with kubectl, the cluster networking model and the CoreDNS configuration. The usual first steps are running a test pod, reading the resolv.conf inside it, checking CoreDNS pods and logs and confirming the upstream resolver answers. Outside help becomes more useful when the fault sits in the CNI plugin, in a managed network policy layer or in an upstream resolver owned by another team, because those fixes cross ownership lines. Confirm with your distribution vendor which DNS components it installs by default and which parts it expects you to change.
What access and information does a DNS troubleshooting engagement need?
The work needs enough access to observe the failure and make a supervised change. In practice that means read access to the affected namespaces, the ability to create a short-lived debug pod, read access to CoreDNS configuration and logs, and visibility into node-level network settings. The most useful inputs are the exact failing hostnames, the time the failure started, any recent changes to CoreDNS, network policies, node images or the CNI plugin, and output from a failed lookup on a working node and a failing node. Agree in writing how credentials are handled and where the work runs, since the cluster stays in your infrastructure.
When should we bring in a partner for Kubernetes DNS problems?
Consider a partner when the failure is intermittent, affects production traffic, spans more than one cluster or involves components your team does not operate. Other signals include repeated restarts of CoreDNS after changes, lookups that succeed for some nodes but not others, or a dependency on an upstream resolver whose owner is unclear. A partner can also help when a fix must be documented for an audit or change review. Before engaging, write down what has already been tried, because that history shortens the first session.
What does a fixed-scope Kubernetes DNS review include?
A fixed-scope review is agreed in writing before work starts and normally lists the clusters, namespaces, failing names and deliverables. A typical scope covers reproducing the failure from a debug pod, reviewing resolv.conf and ndots behavior for the affected workloads, checking CoreDNS health, configuration and logs, testing each upstream resolver, and reviewing network policies that could block UDP or TCP port 53 traffic. Deliverables usually include a findings summary, the evidence collected, recommended changes with owners and a plan to retest. Anything beyond that, such as replacing the CNI plugin or redesigning the resolver architecture, should be a separate, priced scope.
What does a quote for Kubernetes DNS work depend on?
A quote follows from the written scope, so the main drivers are the number of clusters and workloads in scope, how many resolvers and network policies must be tested, how reproducible the failure is and whether changes must be made in production during a window. Ask for the quote to separate one-time diagnosis and fixes from any recurring retest or support. Confirm with your distribution vendor whether support terms affect who may change CoreDNS or CNI settings, because that can change both effort and responsibility. DeployOpen does not publish a price list.
Limits to confirm in your cluster before changing DNS
DNS fixes often look simple until they touch a distribution default, a CoreDNS setup someone else owns, or a network policy that silently drops queries. The cards below cover the facts to pin down first, so that any change to resolution is tested against the cluster you actually run and lands in a window your operations team has approved.
Kubernetes version and distribution DNS defaults
Confirm the exact Kubernetes minor version and the distribution you installed with, because the default DNS service name, the CoreDNS deployment name, the cluster domain and the default dnsPolicy for pods can differ between installers. Check which kubelet clusterDNS address is passed to nodes before you edit anything. A change that assumes upstream defaults can point pods at a resolver that the distribution never configured.
CoreDNS version and configuration ownership
Find out who owns the CoreDNS deployment, its Corefile in the coredns ConfigMap and its version. Some distributions manage CoreDNS through an add-on controller that reverts manual edits, and some platform teams deploy custom stanzas through GitOps. Agree on who approves a change and where the authoritative copy lives, so a fix in the cluster does not get overwritten on the next sync.
NetworkPolicy enforcement by the CNI
Creating a NetworkPolicy does nothing unless the CNI plugin enforces it. Confirm which CNI runs in the cluster and whether it enforces policy for both pod-to-pod traffic and DNS queries to the CoreDNS pods on UDP and TCP port 53. Check every policy in the namespaces that resolve names, including egress rules that allow only the application ports and forget DNS.
Upstream resolver reachability in air-gapped networks
In networks without internet access, CoreDNS forwards to internal resolvers, and those resolvers must answer for both cluster-external names and any private zones. Confirm which upstream addresses the forward plugin uses, that the nodes can reach them on port 53, and that firewalls allow the CoreDNS pods' source addresses. Test from a node as well as from a pod, because host network paths and pod network paths can differ.
Change windows for production DNS
DNS sits underneath almost every service, so a bad CoreDNS change can break many workloads at once. Agree a change window with the platform, application and network owners, define who can roll back, and confirm how the team will restore the previous Corefile quickly. Record the expected impact and the test queries you will run before and after, so the window closes with evidence rather than an assumption that resolution is healthy.
How DeployOpen scopes and supports Kubernetes DNS work
DeployOpen scopes DNS troubleshooting in writing before any work starts. The written scope names the cluster or clusters involved, the failing services and namespaces, the DNS path to be examined (pods, the resolv.conf files injected into them, CoreDNS, and any upstream resolvers or forwarders), and the access the team will use. It also states which changes DeployOpen may make in your environment and which must go through your own change process. A fixed scope gives you a defined set of deliverables and a defined end point, so you know what the work covers before you approve it. Because DNS failures often cross team boundaries, the scope should also name the people who own the network policies, the upstream DNS servers and the cluster itself, and who signs off on changes to each.
Work happens inside your clusters, using your accounts, kubeconfigs and tooling, and under your audit logging. DeployOpen's engineers run the lookup tests from a dnsutils pod, read CoreDNS configuration and logs, check the upstream resolvers and inspect the network policies that could block UDP and TCP port 53 traffic. Every finding is recorded with the evidence behind it, the root cause, the fix that was applied or recommended, and the test that proves the fix worked. Where a fix changes a shared setting such as the CoreDNS Corefile, the ndots value or a policy that other workloads depend on, the write-up says what else it could affect. You receive that documentation at the end of the engagement, so your team can repeat the checks without us.
Ongoing support is available through a retainer, which suits teams that change network policies, add clusters or upgrade the cluster often enough that DNS regressions are likely. A retainer can cover periodic re-testing of service discovery, review of CoreDNS version changes during upgrades and help with new incidents. Ask any provider, including DeployOpen, to confirm in writing what the retainer includes, how quickly it responds to requests and which environments it covers. DeployOpen does not publish a price list, so cost follows from the scope you agree on. Confirm with your own risk and compliance teams whether DNS findings need to be attached to a wider review, since DeployOpen prepares evidence but does not issue audit reports or certifications.

