DNS lookups occasionally take exactly 5 seconds, then succeed.
AdvancedTroubleshootingServices, DNS, Ingress and NetworkPolicy
Answer
Likely causes → The Linux conntrack race on parallel UDP A and AAAA queries sent from the same socket: one packet is dropped and glibc waits the full 5s timeout before retrying. Also seen when one CoreDNS replica is unhealthy but still in endpoints.
Diagnose →
kubectl exec web-x -- sh -c 'for i in $(seq 1 50); do /usr/bin/time -f %e getent hosts orders >/dev/null; done' 2>&1 | sort -n | tail
# On the node
sudo conntrack -S | grep insert_failed
Fix → Deploy NodeLocal DNSCache (Pods talk to a node-local IP and upstream uses TCP), or add single-request-reopen to dnsConfig.options for glibc-based images.
Prevent → NodeLocal DNSCache as a cluster default; monitor CoreDNS latency (coredns_dns_request_duration_seconds).
More on Services, DNS, Ingress and NetworkPolicy
`curl http://orders.shop.svc.cluster.local` hangs, and `kubectl get endpointslices -l kubernetes.io/service-name=orders` shows `ENDPOINTS <unset>`.BeginnerEndpoints exist, but `curl orders:80` returns `Connection refused`.BeginnerA Service works when you curl the Pod IP but times out on the ClusterIP from every node.IntermediateInside a Pod, `nslookup orders` returns `;; connection timed out; no servers could be reached`.BeginnerCoreDNS Pods are in CrashLoopBackOff with `[FATAL] plugin/loop: Loop (127.0.0.1:41823 -> :53) detected for zone "."`.IntermediateCalls to `api.stripe.com` from Pods are slow, and CoreDNS logs show `api.stripe.com.payments.svc.cluster.local`, `api.stripe.com.svc.cluster.local` … all `NXDOMAIN`.Intermediate