DNS architecture
As shown in the diagram below, the kubevpn-traffic-manager Pod has a built-in DNS server for domain name resolution
services.
When accessing resources in the cluster locally using a domain name:
- First, a
DNS queryis sent to theDNS server. - The
DNS serverwill try to resolve the givenname, for example,authors.default. - If the query fails, it will complement the name and retry based on the
searchrules in the/etc/resolv.conffile.
DNS Forward Server
The DNS forward server runs in the traffic manager pod as the dns container, listening on port 53.
Resolution Strategy
For each query (e.g., my-svc):
- Cache check: the cache is keyed by
(name, qtype, qclass)and stores the full DNS response, not just an FQDN mapping. Positive answers expire at the record's minimum TTL (capped at 30 min);NXDOMAIN/NODATAare negatively cached for the SOA minimum (capped at 30 s); transient failures (SERVFAIL) are not cached. - Single-flight: concurrent identical misses are coalesced so only one upstream lookup runs.
- Search domain expansion: If not cached, expand the name with all search domains:
my-svc.(bare name)my-svc.default.svc.cluster.local.my-svc.svc.cluster.local.my-svc.cluster.local.
- Fan-out resolution: For each expanded name × each upstream DNS server, send queries concurrently. The first successful response wins and the other in-flight branches are cancelled.
- Cache update: Store the winning response for future lookups.
- Response rewrite: Replace expanded name back to original in answer records.
Client-Side DNS Setup
Platform-specific DNS configuration:
- Linux: systemd-resolved (preferred) > tailscale DNS configurator. There is no
/etc/resolv.conffallback — on a host with no split-capable DNS manager, setup logs a warning and returns without touching the global resolver (KubeVPN never writes/etc/resolv.conf). - macOS: /etc/resolver/ directory with per-domain resolver files
- Windows: LUID.SetDNS on the TUN interface
Additionally, /etc/hosts entries are added for services (service.name -> ClusterIP) to
support short domain resolution. These entries are push-driven from the traffic manager:
the manager discovers services and streams them to the client over WatchNamespaceRoutes
(see Connect mode), which feeds them to the DNS config — the client no longer
runs its own service informer.