In Kubernetes, some outbound requests take exactly 5 seconds longer than they should.

AdvancedTroubleshootingLatency
Answer

Likely causes → DNS: with ndots:5, a lookup for api.stripe.com tries every search domain first. Parallel A and AAAA queries over UDP from the same socket can also race in conntrack and drop one, so the resolver waits its 5s timeout before retrying.

Diagnose →

kubectl exec -it api-xxx -- cat /etc/resolv.conf
kubectl exec -it api-xxx -- sh -c 'time getent hosts api.stripe.com'
conntrack -S | grep insert_failed    # on the node

Fix → Use FQDNs with a trailing dot, lower ndots via dnsConfig.options, add single-request-reopen (glibc), and deploy NodeLocal DNSCache.

Prevent → Monitor CoreDNS latency and errors, and run NodeLocal DNSCache as a default cluster add-on.

All Real-World Interview questions Roadmap: Interview readiness

More on Latency