Member-only story
In-Depth Understanding of CoreDNS
3 min readMay 22, 2025
1. Core Concepts
CoreDNS is a flexible and extensible DNS server that graduated from the CNCF (Cloud Native Computing Foundation). It is written in Go and built on the Caddy server framework. CoreDNS adopts a plugin-based architecture, enabling users to customize DNS services via the Corefile
configuration.
Core Architecture
Key components of CoreDNS include:
- 1. Server — Listens for and handles DNS queries.
- 2. Plugin Chain — Each DNS query is processed through a series of plugins.
- 3. Corefile — Configuration file defining DNS zones and plugin chains.
Workflow
- 1. When CoreDNS receives a DNS query, it matches the query to the corresponding domain defined in the Corefile.
- 2. The query flows through the configured plugin chain.
- 3. If a plugin can resolve the query, it returns a response to the client.
- 4. If none of the plugins can resolve the query, CoreDNS returns
SERVFAIL
or forwards the query to an upstream DNS server if configured.
Key Plugins
Popular CoreDNS plugins include:
file
– Loads DNS records from zone files.auto
– Automatically loads zone files from disk.etcd
/kubernetes
– Retrieves records from etcd or Kubernetes APIs.