CoreDNS: Flexible DNS Server for Dynamic Environments
K8s Guru
2 min read

Table of Contents
Introduction
CoreDNS arrives as a fast, extensible DNS server with a plugin architecture. It’s designed to adapt to dynamic environments and integrates cleanly with Kubernetes service discovery.
Features
- Plugins for caching, rewriting, metrics, and Kubernetes lookup.
- Single Binary, Simple Config via a
Corefilewith composable directives. - Observability with Prometheus metrics out of the box.
- Kubernetes Plugin: Serves
cluster.localdirectly from the API server, respecting namespaces, headless services, and pod records.
Corefile Example
. {
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods verified
fallthrough in-addr.arpa ip6.arpa
}
rewrite name mTLS.example.local svc.example.local
cache 30
prometheus :9153
forward . 8.8.8.8 8.8.4.4
log
}
Migrating from kube-dns
- Swap the Deployment/Service in
kube-systemwith the official CoreDNS manifests; both respond on port 53/UDP/TCP. - Validate stub domains and upstream forwarders—CoreDNS expresses them via the
forwardplugin instead of ConfigMapstubDomains. - Watch for feature parity gaps:
federationdomains require an extra plugin, and negative caching defaults differ from kube-dns.
Performance Notes
- Plugin ordering matters: place
cachenear the top to minimize API lookups. - Horizontal scaling is straightforward—run multiple replicas behind a ClusterIP or headless Service for kube-proxy round robin.
- Enable
prometheusto export query latency and error counters, then scrape with Prometheus for early warning signals.
Conclusion
DNS is foundational. CoreDNS’s modular design is well‑suited to container platforms in 2016.