Skip to content

Kubernetes DNS ndots: test the application resolver

Tie DNS search expansion to the exact application resolver; compare an absolute DNS probe with the original HTTP authority and preserve short service names during a canary.

Dopstack Engineering

· 10 min read

Conceptual DNS search arcs lead an external hostname through suffix attempts to an absolute-name exit.

Quick answer

Kubernetes DNS search expansion can add lookup work, but test the resolver your application actually uses. Capture the Pod resolver file and query path, then canary a workload-specific ndots setting while preserving external destinations and internal Service names. A fast direct DNS probe alone cannot establish application behavior.

Kubernetes DNS latency caused by search expansion is best diagnosed through the resolver your application actually uses. Capture its resolver configuration, establish which names it queries, and test a scoped ndots change against both external hosts and internal Service names. A fast dig response proves that particular DNS query worked; it does not prove the application took the same lookup path. [1][3][5]

Which resolver is actually slow?#

Start with the application process and its lookup API. An HTTP client, a command-line DNS utility and a language runtime can reach the same hostname through different name-resolution paths. Comparing their durations without identifying those paths can send an investigation toward the wrong component.

Scenario: a hypothetical catalog-api Deployment runs in the shop namespace. It contacts api.vendor.example for product data and inventory.api for an internal Service in another namespace. Operators notice slow requests to the vendor. A diagnostic Pod returns an address promptly, so they consider adding CoreDNS replicas. The diagnostic image may use a different C library, search configuration or DNS client. Check those differences before treating its answer as evidence about the application.

For a Node.js application, dns.lookup() uses operating-system facilities, while the dns.resolve*() family sends DNS queries through a different implementation. The Node documentation explicitly distinguishes these paths. Changing from one to the other is an application behavior change, not a neutral measurement technique. [5]

Record the container image digest, runtime version, resolver API, Pod namespace, DNS policy and current resolver file. Keep that record with the request trace. Without it, a later image change can make an apparently identical experiment answer a different question. Keep the caller and image constant while changing the resolver setting.

Follow one name through the search list#

The search list supplies suffixes for relative names, while ndots affects when the resolver first tries a name as absolute. Kubernetes documents how kubelet prepares Pod resolver configuration and shows a common ndots:5 configuration. That example is a starting point; inspect the actual Pod rather than assuming every cluster has the same domain or search suffixes. [1]

text
# Illustrative /etc/resolv.conf inside catalog-api
nameserver 10.96.0.10
search shop.svc.cluster.local svc.cluster.local cluster.local
options ndots:5

In this illustrative configuration, api.vendor.example contains fewer dots than the threshold. A resolver following this search policy can try suffix-expanded names before the absolute hostname. Those candidates might include api.vendor.example.shop.svc.cluster.local and api.vendor.example.svc.cluster.local. The extra work is a plausible mechanism for additional DNS traffic. It is not a measured latency penalty for this workload. [1][3]

Do not turn the number of candidate names into a fixed packet count. Address families, caching, retries, early success and the resolver implementation all affect what is sent. Likewise, a succession of fast negative answers differs from a query that waits for a timeout. Both can involve search expansion, but their operational symptoms and repairs differ.

The Linux resolver manual describes ndots as a threshold and caps its value at fifteen. It also explains timeout and retry settings separately. A resolver timeout setting does not by itself define the total lifetime of an application request. Raising or lowering the threshold therefore deserves a name-resolution test, not an assumed performance improvement. [3]

There is another reason to identify the C library. musl documents differences from glibc in nameserver handling and in search fallback for names meeting the threshold. Lowering ndots can change whether a dotted internal name is searched after an unsuccessful absolute lookup. A canary that tests only external names misses this failure branch. [4]

How do you capture evidence without changing the symptom?#

Run observations from the affected workload context whenever practical. Begin with passive configuration and existing telemetry, then add the smallest probe that answers the unresolved question. These commands are investigation examples, not commands run against a Dopstack or customer cluster.

bash
kubectl -n shop get pod catalog-api-canary -o yaml
kubectl -n shop exec catalog-api-canary -- cat /etc/resolv.conf
kubectl -n kube-system get endpointslice \
  -l kubernetes.io/service-name=kube-dns

The Pod YAML tells you what was requested; the file inside the container tells you what the process sees. Inspect both when admission controls, host networking or a custom DNS policy might affect the result. If the DNS Service has no usable backends, repair that path before explaining the incident entirely through suffix expansion. The Kubernetes debugging guide covers checking DNS endpoints and whether CoreDNS receives queries. [1][2]

For the Node.js case, a small probe can exercise lookup with the original hostname. Run it in the same image and with the same relevant process configuration. If the application supplies custom lookup behavior or its own cache, instrument that code path as well; the standalone probe cannot reproduce configuration it does not use.

javascript
// Illustrative probe; run in the affected application image.
const { lookup } = require('node:dns').promises;
const { performance } = require('node:perf_hooks');

(async () => {
  for (const host of [
    'api.vendor.example',
    'inventory.api',
    'inventory.api.svc.cluster.local'
  ]) {
    const start = performance.now();
    try {
      const addresses = await lookup(host, { all: true });
      console.log({ host, addresses, elapsedMs: performance.now() - start });
    } catch (error) {
      console.log({ host, code: error.code,
        elapsedMs: performance.now() - start });
      process.exitCode = 1;
    }
  }
})();

Repeated probes can warm caches, so label warm and fresh-process observations separately. A fresh process does not guarantee a cold DNS infrastructure cache. Preserve successful answers and failures as well as elapsed time. Reject the canary if it resolves a different destination, even when the lookup finishes sooner.

If existing query telemetry cannot establish the candidate names, a cluster operator can consider temporary CoreDNS query logging. Kubernetes shows how to enable the log plugin, and CoreDNS documents response classes and log placeholders. Logging adds work on busy servers, so scope the collection window, estimate log volume and remove temporary instrumentation after obtaining the evidence. This is an operator decision, not a prerequisite to changing every cluster's logging configuration. [2][6]

Correlate query name, query type, response code and timing with the caller's request. Record the absence of a query as inconclusive unless the observation point covers the caller's path. A local cache or alternate resolver can explain why the expected request never appears at the CoreDNS instance being watched.

What should a scoped ndots canary change?#

A useful canary changes the resolver threshold for a small workload while preserving its dependencies and application request authority. Configure the Pod template through the deployment's normal configuration path. The following fragment illustrates the intended setting; it is not a complete Deployment manifest. [1]

yaml
# Fragment under a Deployment's spec.template
spec:
  dnsPolicy: ClusterFirst
  dnsConfig:
    options:
      - name: ndots
        value: "2"

The value here is an experiment, not a universal Kubernetes recommendation. It makes the illustrative external hostname eligible for an earlier absolute lookup while still requiring tests for the internal names. Select a threshold from the workload's actual name inventory and resolver behavior, rather than copying the lowest number from a troubleshooting post. [1][3][4]

Use the same image digest and representative requests on the control and canary. Read the resolver file in the new Pod to confirm the setting took effect. Keep enough information to distinguish the newly created canary from an older Pod with the same application label. If the setting is absent, stop: the comparison has not tested the proposed change.

ProbeWhat must remain correctWhat would reject the change
Original external hostnameExpected address family and application responseNew resolution failure or changed destination
Same-namespace Service nameCorrect Service still resolvesShort-name discovery breaks
Dotted cross-namespace nameExisting application name keeps its meaningResolver no longer searches the required suffix
Explicit cluster-qualified nameCorrect internal answerWrong cluster domain assumed
Missing hostnameExpected failure is observable and bounded by the callerLong new stall or unexpected successful answer
Proposed dependency-name acceptance matrix for the ndots canary.

This acceptance matrix is our proposed review method. Add the workload's own dependency names, including names used only during startup, failover or a scheduled task. Testing a happy-path request while omitting bootstrap dependencies can approve a change that fails on the next restart.

Keep the external request URL unchanged during this experiment. An absolute DNS name ending with a dot is useful as a resolver diagnostic, but appending that dot to an HTTP URL can also change what the application sends or validates at other layers. Do not assume a successful DNS comparison establishes equivalent TLS, proxy, routing or authentication behavior. Verify the actual client before adopting such a URL change.

The application experiment should include an operation that really needs a new connection. A request served over an already-open connection may not exercise the resolver at all. Keep that path separate from repeated requests on an established connection, and record how the client was started. Otherwise the control might pay lookup work while the canary reuses a connection, producing an attractive comparison that says little about the setting.

Also distinguish a resolver configuration change from an application deployment change. If a new image introduces a different client library at the same time, a changed query pattern has multiple explanations. Run the resolver experiment with the same image, then evaluate an image upgrade separately. This separation reduces the number of assumptions a reviewer must accept when deciding whether the canary caused the observed behavior.

Keep a negative result in the record. If the external queries never expand under the application's actual resolver, the proposed threshold change has not addressed the observed problem. Do not force the incident into the ndots explanation because the resolver file contains a familiar value. The query trace and application observation should decide the next branch of the investigation.

When does the obvious fix change the answer?#

Lowering ndots is appropriate only when the evidence connects unwanted search work to the affected caller. It does not repair DNS packet loss, an unreachable resolver, a bad upstream answer or a slow connection after resolution. Break the request into observable stages before attributing all elapsed time to DNS.

Suppose the canary removes suffix-expanded external queries but the application remains slow. Search expansion is then a weaker explanation for this request. Observe connection establishment, address-family selection and the upstream service next. Keep the reduced query traffic as a separate finding; do not relabel it a user-visible speedup.

Conversely, suppose the external request improves while inventory.api fails only in one image. Check the resolver implementation and the actual suffix list before deciding that the service itself is unhealthy. musl's documented search-fallback differences make this a credible counterexample to a cluster-wide threshold recommendation. [4]

Adding DNS capacity may still be justified if the service is overloaded. The point of the investigation is to distinguish extra work generated by clients from insufficient capacity or another server fault. These causes can coexist. A client-side reduction and a capacity change should have separate evidence and rollback criteria so that neither hides the other's result.

How do you decide whether to keep the canary?#

Keep it when the recorded resolver setting is correct, the unwanted lookup pattern changes as expected, and the application still resolves and contacts every dependency in scope. Compare equivalent load and cache conditions where possible. Document which observations were possible and which remain uncertain; a quiet monitoring interval is not proof that an infrequent dependency was exercised.

The decision record should identify the owner, workload image, configuration revision, name inventory, observed query pattern and rollback trigger. A rollback should restore the previous Pod-template configuration through the same delivery process. Confirm the replacement Pods' resolver files after rollback, rather than assuming that changing a repository value changed already-running processes.

No cluster trace or application performance benchmark was run for this article. The configuration and probe are illustrative. The sources establish the mechanisms, while the acceptance matrix describes what a team should verify in its own environment. For a separate connectivity branch, our Service endpoint investigation follows the path from a Service to usable backends. A resolver problem and a backend problem require different evidence.

Questions from a resolver review#

Does ndots control how long DNS waits?
ndots controls the threshold used when choosing search versus an initial absolute lookup. Timeout and retry behavior have separate settings and implementation details. Measure the application's lookup path before attributing a fixed delay to the threshold. [3]
Can a fast dig result rule out application DNS trouble?
It can establish that the particular query reached a resolver and received an answer. It does not establish that the application uses the same API, search behavior, address-family policy or cache. Compare the actual application path. [5]
Is a trailing dot always the best repair?
It can make a DNS probe explicitly absolute, but an application URL also participates in other protocols and client behavior. Test the original request and the altered authority separately before adopting a URL change across a workload.
Should every Pod use the same ndots value?
A shared value is easier to operate, but workloads can depend on different short names and resolver implementations. Use a representative compatibility inventory before standardizing. A narrowly scoped canary is easier to assess when that inventory is incomplete. [1][4]

Technologies

  • Kubernetes
  • DNS
  • Node.js

Sources

  1. [1]
    DNS for Services and Pods, Kubernetes

    Read 2026-11-04T20:07:42.631934+00:00; document publication/update date not listed unless explicitly stated. Living resolver documentation; no cluster or packet test. Supports: Search suffixes expand names.

  2. [2]
    Debugging DNS Resolution, Kubernetes

    Read 2026-11-04T20:07:42.631934+00:00; document publication/update date not listed unless explicitly stated. Living resolver documentation; no cluster or packet test. Supports: CoreDNS logging can show received queries.

  3. [3]
    resolv.conf(5), Linux man-pages

    Read 2026-11-04T20:07:42.631934+00:00; document publication/update date not listed unless explicitly stated. Living resolver documentation; no cluster or packet test. Supports: glibc ndots has a capped value.

  4. [4]
    Functional differences from glibc, musl libc

    Read 2026-11-04T20:07:42.631934+00:00; document publication/update date not listed unless explicitly stated. Living resolver documentation; no cluster or packet test. Supports: Search-list length limits also differ between resolver implementations.

  5. [5]
    DNS, Node.js

    Read 2026-11-04T20:07:42.631934+00:00; document publication/update date not listed unless explicitly stated. Living resolver documentation; no cluster or packet test. Supports: Node lookup uses OS facilities.

  6. [6]
    log plugin, CoreDNS

    Read 2026-11-04T20:07:42.631934+00:00; document publication/update date not listed unless explicitly stated. Living resolver documentation; no cluster or packet test. Supports: DNS logging has an operational cost.

Written by

Dopstack Engineering

Engineering team

The engineering team at Dopstack. Illustrative scenarios are composites written to explain a pattern, not accounts of client work.

All articles Website

Get new articles by email

Engineering notes on AI, cloud and SaaS. Occasional, never sold or shared.

Send me new Dopstack Insights articles by email. I can unsubscribe at any time. We’ll email you once to confirm. Privacy

Continue reading