DNS Best Practices
Cluster DNS is quiet until it is not, and a DNS slowdown looks like a slowdown everywhere.
Busca en todas las páginas de la documentación
Cluster DNS is quiet until it is not, and a DNS slowdown looks like a slowdown everywhere.
These practices keep name resolution fast, predictable, and portable across environments.
Skim the groups and adopt the ones that fit your workloads.
Treat the naming and FQDN rules as defaults for new services, and the scaling and caching rules as things to verify under load.
Each bullet leads with the action so you can turn it into a review checklist.
payments, not the full FQDN, to keep manifests readable and portable.search list and ndots differently, so payments.billing.svc.cluster.local behaves identically everywhere.api.github.com. marks the name absolute and skips search-suffix attempts entirely.ndots:5 causes several failed lookups before an external FQDN resolves; set dnsConfig ndots:2 or use FQDNs.cache plugin (for example cache 30) shields upstreams and the API server without serving badly stale answers.resolv.conf to avoid surprise loops and drift.reload plugin; a malformed Corefile silently keeps stale config.clusterIP: None so each pod gets a name like db-0.db.data.svc.cluster.local.kube-dns Service on UDP/TCP 53 so denied namespaces can still resolve.Confirm new services use short names in-namespace and FQDNs in shared config.
Verify CoreDNS is scaled, has loop, health, and cache configured, and that a default-deny NetworkPolicy still allows port 53 egress.
Check that external dependencies use ExternalName or a manual EndpointSlice, and that DNS latency is on your dashboards.
Short name or FQDN by default?
Short names within a namespace for readability; FQDNs in cross-namespace or polyglot config for consistent resolution.
How do I stop slow external lookups?
Lower ndots, use FQDNs with a trailing dot, and deploy NodeLocal DNSCache.
How many CoreDNS replicas should I run?
At least two, scaled up for large clusters or DNS-heavy workloads; measure query latency to size it.
Does a NetworkPolicy block DNS?
A default-deny egress policy will unless you explicitly allow egress to kube-dns on port 53.
Why does my StatefulSet need a headless Service?
Headless Services publish per-pod DNS names, which stateful peers rely on for stable identity.
Is ExternalName secure by itself?
No; it is DNS indirection only. Enforce control with NetworkPolicies or an egress gateway.
Stack versions: This page was written for Kubernetes 1.36.2, Docker Engine 29.6.1 (BuildKit default), containerd (CRI runtime on nodes), Helm 3, Compose v2, Argo CD (latest - verify at build), and Gateway API (GA - verify controller support at build).
Revisado por Chris St. John·Última actualización: 19 jul 2026