๐Ÿ—“๏ธ Oct 2, 2021โฑ๏ธ 2 min read

Troubleshooting Recipe: CoreDNS 5-Second Latency Spikes & Conntrack Exhaustion

How to diagnose and eliminate intermittent 5-second DNS timeouts in Kubernetes clusters caused by Linux conntrack table exhaustion and UDP race conditions.

๐ŸŽ™๏ธ Listen to ArticleREADY
AI Audio Synthesis Narrator
Share Post:

โ€œWhen microservices experience exact 5-second latency spikes on external HTTP calls, the culprit is almost never the upstream APIโ€”it is a dropped UDP DNS packet hitting glibcโ€™s default retransmission timeout.โ€

Symptom

  • Application p99 latency shows sharp spikes at multiples of 5 seconds (5.0s, 10.0s).
  • Node kernel logs (dmesg) report nf_conntrack: table full, dropping packet.
  • CoreDNS pods show low CPU utilization despite client-side DNS timeouts.

Root Cause

High-churn pods generate thousands of short-lived UDP DNS lookups (amplified by default ndots:5 search-domain expansion). When the Linux nf_conntrack table fillsโ€”or when parallel A/AAAA lookups race on the same source port in older kernelsโ€”packets are silently dropped and glibc waits 5 seconds before retrying.

Resolution Steps

  1. Inspect conntrack saturation on worker nodes: Run sysctl net.netfilter.nf_conntrack_count net.netfilter.nf_conntrack_max and conntrack -S (look for non-zero insert_failed or drop).
  2. Deploy NodeLocal DNSCache: Run a local DNS cache DaemonSet on every node using TCP to upstream CoreDNS, eliminating cross-node UDP conntrack entries.
  3. Tune ndots and single-request-reopen: Where appropriate, set ndots: 2 in pod dnsConfig or use FQDN trailing dots for external endpoints.
  4. Verify: Confirm conntrack -S drop counters stay flat under peak load and p99 DNS resolution returns to < 5ms.
EDGE RAG DEEP-LINK

๐Ÿค– Interrogate This Field Note in Digital Twin

Open in /twin ↗

Click a prompt below to immediately stream an architectural analysis from Virtual Sachin's RAG cognitive twin:

SKS

Sachin Kumar Sharma

Director (Cloud & Infrastructure Architecture) | Principal Agentic AI Architect | 20+ Yrs Exp

Architecting resilient multi-cloud enterprise landing zones, SDN overlay fabrics, DevSecFinOps automation pipelines, and autonomous Agentic AI platforms.

๐Ÿ“ฌ

๐Ÿ“ฌ Stay Updated on Tech Releases

Sign up to get notified when I publish new production war stories, agentic AI architecture blueprints, or open-source infrastructure tools.

โšก Theme Adaptive Shift
Switching layouts matching domain reading affinity...