---
title: "Why one external lookup from a Kubernetes pod sends many queries | Proofline"
description: "With a pod's default ndots:5, the resolver tries every search domain before the name itself, so api.example.com starts as several failed lookups."
url: https://proofline.sh/learn/kubernetes-ndots-external-lookups/
---

[Learning center](/learn/)

# Why one external lookup from a Kubernetes pod sends many queries

With a pod's default ndots:5, the resolver tries every search domain before the name itself, so api.example.com starts as several failed lookups. Each of them is usually a fast NXDOMAIN, which is why this stays invisible until the cluster DNS or its upstream slows down or drops packets. Read the pod's resolv.conf, count the queries in CoreDNS, and test the name with a trailing dot to see whether the search list is the cost.

Network outages The Proofline team November 23, 2026 6 min read

## The symptom

Calls from pods to an external API or a managed database show slow or failing lookups, while the same name resolves at once from a node or a laptop. Typical signs:

-   Connect latency to `payments.example.com` jumps by seconds at busy times, and the time sits before the TCP connect.
-   CoreDNS answers mostly NXDOMAIN, and the names in those answers end in `svc.cluster.local` or a cloud provider's internal domain.
-   Intermittent `Temporary failure in name resolution` from glibc images, or timeouts from other runtimes. [Reading getaddrinfo errors](/learn/getaddrinfo-temporary-failure-name-resolution/)

Two causes produce these signs. The search list multiplies each external lookup, which turns a modest request rate into a large query rate. Or the cluster DNS, or the resolver it forwards to, is failing for reasons of its own, and the extra queries only make it more visible. The checks below separate them.

## How ndots and search domains expand a name

kubelet writes each pod's `/etc/resolv.conf`. With the default `ClusterFirst` policy it looks like this, and cloud providers may append their own search domains: [DNS for Services and Pods](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/) · [Debugging DNS resolution](https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/)

```
nameserver 10.32.0.10
search <namespace>.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
```

`ndots` is the number of dots a name needs before the resolver tries it as an absolute name first. Names with fewer dots are tried with each search domain in turn until one matches. `payments.example.com` has two dots, so with three search domains the resolver asks for `payments.example.com.orders.svc.cluster.local`, then `payments.example.com.svc.cluster.local`, then `payments.example.com.cluster.local`, and only then `payments.example.com`. [resolv.conf(5)](https://man7.org/linux/man-pages/man5/resolv.conf.5.html)

glibc sends the A and AAAA queries in parallel by default, so that is eight queries for one lookup, and more with provider search domains. If any of them times out, the whole lookup waits for that timeout before it moves on.

A name that ends in a dot is absolute. glibc's resolver queries it as is and does not apply the search list. [glibc res\_query.c](https://github.com/bminor/glibc/blob/master/resolv/res_query.c)

## Count what the pod actually sends

Start in the failing pod. `getent` follows the same resolver path as a glibc application; `time` shows where the seconds go. [getent(1)](https://man7.org/linux/man-pages/man1/getent.1.html)

```
kubectl -n NAMESPACE exec POD -- cat /etc/resolv.conf
kubectl -n NAMESPACE exec POD -- sh -c 'time getent ahosts payments.example.com'
kubectl -n NAMESPACE exec POD -- sh -c 'time getent ahosts payments.example.com.'
```

If the second lookup is consistently much slower than the third, the search list costs you the difference.

Then look at CoreDNS. The DNS pods carry the label `k8s-app=kube-dns`. Their logs show errors; with the `log` plugin enabled they also show each query with its name, type, protocol and response code. Enabling `log` means editing the `coredns` ConfigMap, which is a change to production, and it is verbose at high query rates. [Debugging DNS resolution](https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/) · [CoreDNS log plugin](https://coredns.io/plugins/log/)

```
kubectl -n kube-system get pods -l k8s-app=kube-dns -o wide
kubectl -n kube-system logs -l k8s-app=kube-dns --since=30m
```

The metrics plugin needs no change if the Corefile already has `prometheus :9153`. `coredns_dns_requests_total` counts queries by type, and `coredns_dns_responses_total` counts responses by `rcode`. A port-forward reads them without changing the cluster: [CoreDNS metrics](https://coredns.io/plugins/metrics/)

```
kubectl -n kube-system port-forward pod/COREDNS_POD 9153:9153
curl -s localhost:9153/metrics | grep -E '^coredns_dns_(requests|responses)_total'
```

A ratio of NXDOMAIN to NOERROR of several to one, on a cluster whose services mostly call external names, is the search list at work.

## Read the result

| Lookup with trailing dot | CoreDNS | Points to |
| --- | --- | --- |
| Fast, while the plain name is slow | Mostly NXDOMAIN, no errors | Search-list expansion; fix the name or `ndots` |
| Slow too | Errors or upstream timeouts in logs | CoreDNS or its upstream resolver |
| Slow too | Healthy, low latency | The path from pod to CoreDNS, or the node |
| Fast | Fast | Not DNS; look at connect and TLS time |

When the upstream is the problem, check what CoreDNS forwards to. On AWS, CoreDNS on a node forwards to the VPC resolver, which has a per-interface packet limit that a search-list storm can reach. [VPC resolver packet limit](/learn/aws-vpc-resolver-packet-limit/)

## Ways out, smallest first

Each of these changes the workload, so roll it out like any other change:

-   Use a trailing dot in the dependency's configured hostname, for example `payments.example.com.`, so the resolver skips the search list. Some HTTP and TLS clients handle a trailing dot in the host differently, so test the full request, not only the lookup.
-   Lower `ndots` for the pod with `dnsConfig.options`, for example `ndots: "2"`. Short service names such as `orders` or `orders.prod` still resolve through the search list, because they have fewer dots than the threshold.
-   Run NodeLocal DNSCache, which runs a caching agent on each node and sends only cache misses on to CoreDNS. [NodeLocal DNSCache](https://kubernetes.io/docs/tasks/administer-cluster/nodelocaldns/)

## A worked example

This example is illustrative. The `checkout` deployment in namespace `shop` calls `api.payments.example.com` about 400 times a second across its pods, opening a new connection per call. The pod's search list has three cluster domains and two provider domains.

`time getent ahosts api.payments.example.com` takes 3 to 40 milliseconds most of the time and 5 seconds about once a minute. With a trailing dot it takes 2 to 4 milliseconds and never stalls. CoreDNS reports about 4,800 queries a second, more than 80 percent of them NXDOMAIN for names ending in cluster or provider domains. If any one of the twelve queries behind a lookup goes unanswered, the whole lookup waits out a five-second resolver timeout. The external API was healthy throughout; the lookup was the cost.

In a second run of the same check, the trailing-dot lookup also stalls, and the CoreDNS logs show timeouts forwarding to 10.0.0.2. Here the search list is not the main cause; the upstream resolver is losing queries, and that is where to look next.

## Limits

Query counts depend on the resolver library. musl and Go's pure resolver apply `ndots` and the search list with their own rules, and applications that cache lookups send fewer queries than this arithmetic suggests. Count real queries in CoreDNS rather than relying on the formula.

Not every extra query reaches the upstream. CoreDNS answers names under the cluster domain itself, and its `cache` plugin, when configured, also caches denial-of-existence responses. Search domains outside the cluster, such as a provider's internal domain, are the ones forwarded on a cache miss. Read `coredns_proxy_request_duration_seconds` for the forward plugin, which counts forwarded queries per upstream and RCODE, before you blame the upstream. [CoreDNS cache plugin](https://coredns.io/plugins/cache/) · [CoreDNS forward plugin](https://coredns.io/plugins/forward/)

This page covers lookups of external names. For a cluster name that returns NXDOMAIN, check the namespace in the name first. For the full set of dependency checks, see [runtime dependency failures](/learn/runtime-dependency-failures/).

## Questions

### Why does Kubernetes use ndots:5?

So that cluster names like `orders.shop.svc` resolve through the search list without the full domain. The cost is that external names with fewer than five dots go through every search domain first.

### Does a trailing dot break cluster service names?

Only if you use it on a short name. `orders.` is an absolute name that does not exist; write the full `orders.shop.svc.cluster.local.` if you want an absolute cluster name.

### Will lowering ndots stop cluster names from resolving?

Not short ones. Names with fewer dots than the new threshold still go through the search list. A name with at least that many dots is tried as is first, and falls back to the search list only if that fails.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [DNS lookups time out under load on EC2: the resolver packet limit](/learn/aws-vpc-resolver-packet-limit/)
    
    Capacity overruns The Proofline team November 23, 2026 5 min read
    
-   ### [Temporary failure in name resolution or name not known?](/learn/getaddrinfo-temporary-failure-name-resolution/)
    
    Network outages The Proofline team November 23, 2026 6 min read
