If latency budgets leave no room for synchronous retries, set dnsConfig ndots:2 (or trailing dots on external FQDNs) and deploy Kubernetes NodeLocal DNSCache with NOTRACK + TCP upstream to eliminate 5-second UDP conntrack DNS timeouts.
TL;DR30-second simplified summary▾
Core Mechanics: Kubernetes injects options ndots:5 into every pod's /etc/resolv.conf. Any hostname with fewer than 5 dots—including api.stripe.com (2 dots) or s3.us-east-1.amazonaws.com (4 dots)—is treated as a relative name first.
Visual & Structural Flow: Depicts 6x NXDOMAIN + Conntrack Drop (5s) vs. NodeLocal TCP (<2ms) (App Pod (glibc) -> NodeLocal 169.254.20.10 -> CoreDNS (6 pods)); Pod (ndots:2) -> NodeLocal DNSCache (NOTRACK) -> CoreDNS (TCP) (Pod (ndots:2) -> NodeLocal DNS -> CoreDNS -> Upstream DNS).
Trade-Offs & Production: Scaling CoreDNS from 6 to 30 replicas burns CPU on 280k QPS of NXDOMAINs without fixing the root cause: per-node nf_conntrack UDP packet drops between pods and kube-proxy iptables rules. Production Kubernetes clusters fix both amplification and conntrack races cluster-wide: NodeLocal DNSCache DaemonSet: Listens on link-local 169.254.20.10 per node with.
Failure Modes & Application: DNS amplification and conntrack tuning are essential for high-QPS Kubernetes platforms: Payment & Webhook Egress Clusters: Services calling Stripe, AWS S3, or Twilio at 40,000+ req/s.
Why ndots:5 floods CoreDNS across 120 Kubernetes nodes.
Why this matters: The mechanism: understand how Why ndots:5 floods CoreDNS across 120 Kubernetes nodes works from first principles.
Kubernetes injects options ndots:5 into every pod's /etc/resolv.conf.
Any hostname with fewer than 5 dots—including api.stripe.com (2 dots) or s3.us-east-1.amazonaws.com (4 dots)—is treated as a relative name first.
What happens during glibc A/AAAA parallel UDP conntrack races.
Why this matters: The problem: see what breaks without What happens during glibc A/AAAA parallel UDP conntrack races under real concurrency or scale.
Two compounding bugs cause intermittent 5-second DNS timeouts:
- 8× NXDOMAIN Amplification: Every uncached external lookup generates 3 search-domain
NXDOMAINpairs before trying the root domain. - Parallel A/AAAA Conntrack Race:
glibcsendsAandAAAAUDP packets from the same source port simultaneously;iptablesNATnf_conntrackraces on creating the table entry, silently dropping one packet and forcing a5-secondresolv.confretry.
6x NXDOMAIN + Conntrack Drop (5s) vs. NodeLocal TCP (<2ms)
NodeLocal DNSCache bypasses nf_conntrack via NOTRACK and upgrades upstream queries to TCP, eliminating 5s UDP drops.
- Problem
- How to implement Fixing CoreDNS Query Flooding from ndots:5 without hitting unbounded tail latency, state divergence, or operational fragility.
- Naive Solution
- Use a single unpartitioned path with unbounded retries and synchronous global coordination.
- Why It Fails
- Global coordination serializes throughput under load, while unbounded retries amplify transient stalls into full outages.
- Alternatives
- Compare synchronous strict-consistency paths against bounded asynchronous replication, local caching, or partitioned ownership.
- Engineering Decision
- If latency budgets leave no room for synchronous retries, set dnsConfig ndots:2 (or trailing dots on external FQDNs) and deploy Kubernetes NodeLocal DNSCache with NOTRACK + TCP upstream to eliminate 5-second UDP conntrack DNS timeouts.
- Trade-Offs
- Gains predictable p99 latency and fault isolation in exchange for explicit bounding, observability, and slightly higher implementation complexity.
When Fixing CoreDNS Query Flooding from ndots:5 experiences a sudden 5x traffic spike alongside a slow downstream dependency, which engineering choice best protects system stability?
Naive solution (and why scaling CoreDNS replicas alone fails).
Why this matters: The problem: see what breaks without Naive solution under real concurrency or scale.
Think of Naive solution (and why scaling CoreDNS replicas alone fails) as the intuition layer for Fixing CoreDNS Query Flooding from ndots:5: The problem: see what breaks without Naive solution under real concurrency or scale.
Scaling CoreDNS from 6 to 30 replicas burns CPU on 280k QPS of NXDOMAINs without fixing the root cause: per-node nf_conntrack UDP packet drops between pods and kube-proxy iptables rules.
Naive solution (and why scaling CoreDNS replicas alone fails)
- 502s during rolling updates
- ndots:5 DNS flood or OOMKill
- Unprotected node drains
- Zero-drop SIGTERM draining
- Bounded cgroup & conntrack
- Canary metrics gate rollout
Enterprise solution: NodeLocal DNSCache + MutatingWebhook ndots:2 + single-request.
Why this matters: Operational control: configure bounds, failure handling, and safe production defaults.
Production Kubernetes clusters fix both amplification and conntrack races cluster-wide:
- NodeLocal DNSCache DaemonSet: Listens on link-local
169.254.20.10per node withiptables NOTRACK(bypassingnf_conntrackcompletely), caches external TTLs (30–60 s) locally (< 1 ms), and forwards misses to CoreDNS over TCP. - Cluster-Wide
ndots:2+single-request-reopen: Injectndots:2andsingle-request-reopenvia a Mutating Admission Webhook (or Kyverno policy) soapi.stripe.com(2 dots) resolves from root immediately while short names (redis-master, 0 dots) still use cluster search domains. - Result: CoreDNS QPS drops by
> 80%,5 stimeouts vanish, and cached p99 stays< 2 ms.
Pod (ndots:2) -> NodeLocal DNSCache (NOTRACK) -> CoreDNS (TCP)
1.ndots:2 Policy: Eliminates 6x NXDOMAIN searches for external FQDNs without breaking short names.
2.NOTRACK Bypass: Skips Linux nf_conntrack for pod-to-NodeLocal DNS packets.
3.TCP Upstream: Upgrades NodeLocal -> CoreDNS to TCP, eliminating UDP packet drops.
4.single-request-reopen: Serializes glibc A/AAAA on separate sockets for musl/glibc safety.
NodeLocal DNSCache + ndots:2 cuts CoreDNS traffic by > 80% and eliminates conntrack-induced 5-second timeouts.
# Cluster-wide Kyverno / Webhook default injected into Pods (zero app code edits)
spec:
dnsConfig:
options:
- name: ndots
value: "2"
- name: single-request-reopen
- name: timeout
value: "2"
- name: attempts
value: "2"
Where NodeLocal DNS & ndots Tuning apply in Kubernetes.
Why this matters: Scope boundary: identify where this pattern fits best and where simpler or async alternatives win.
DNS amplification and conntrack tuning are essential for high-QPS Kubernetes platforms:
- Payment & Webhook Egress Clusters: Services calling Stripe, AWS S3, or Twilio at
40,000+ req/s. - Multi-Tenant Microservice Meshes: Keeping internal
redis-mastershort-name resolution working while protecting CoreDNS. - Linux Conntrack Hardening: Preventing UDP table exhaustion on high-density 120-node clusters.
Practice: Make the trade-off yourself.
Why does Kubernetes' default ndots:5 setting flood CoreDNS with NXDOMAIN queries for external domains like api.stripe.com?