ScriptsApr 15, 2026·3 min read

CoreDNS — Flexible DNS Server Written in Go

CoreDNS is a CNCF-graduated DNS server written in Go, composed entirely of plugins, and used as the default in-cluster DNS for Kubernetes since v1.13.

TL;DR
CNCF-graduated Go DNS server built from plugins, the default in-cluster DNS for Kubernetes since v1.13.
§01

What it is

CoreDNS is a DNS server written in Go that uses a plugin architecture for all its functionality. Every feature, from caching to logging to Kubernetes service discovery, is a plugin that can be enabled or disabled. CoreDNS is a CNCF-graduated project and has been the default in-cluster DNS provider for Kubernetes since version 1.13.

Cluster administrators, DevOps engineers, and anyone running Kubernetes benefit from understanding CoreDNS since it handles all internal DNS resolution in their clusters. It also serves as a general-purpose DNS server for non-Kubernetes use cases.

§02

How it saves time or tokens

CoreDNS replaces complex DNS configurations with a declarative Corefile format. Instead of managing BIND zone files or dnsmasq configurations, you declare your DNS behavior in a simple, readable format. The plugin architecture means you add only the features you need, keeping the server lightweight and its configuration minimal.

§03

How to use

  1. Download the CoreDNS binary or use it as the default DNS in your Kubernetes cluster
  2. Write a Corefile specifying zones and plugins
  3. Start CoreDNS with coredns -conf Corefile
§04

Example

# Corefile example
.:53 {
    forward . 8.8.8.8 8.8.4.4
    cache 30
    log
    errors
}

example.com:53 {
    file db.example.com
    log
}
# Download and run
curl -LO https://github.com/coredns/coredns/releases/latest/download/coredns_linux_amd64.tgz
tar xzf coredns_linux_amd64.tgz
./coredns -conf Corefile
§05

Related on TokRepo

§06

Common pitfalls

  • Plugin order in the Corefile matters; some plugins must come before others for correct behavior
  • Kubernetes CoreDNS ConfigMap changes require a pod restart to take effect; not all changes are picked up automatically
  • Misconfigured forward plugins can create DNS loops; always use upstream resolvers, not the server itself

Frequently Asked Questions

Why is CoreDNS the default DNS for Kubernetes?+

CoreDNS replaced kube-dns as the default because its plugin architecture is more flexible, easier to configure, and more performant. The Kubernetes plugin automatically discovers services and pods for DNS resolution.

Can I use CoreDNS outside of Kubernetes?+

Yes. CoreDNS is a general-purpose DNS server. You can use it as an authoritative DNS server, a recursive resolver, a caching proxy, or any combination. It works independently of Kubernetes.

How do I customize CoreDNS in Kubernetes?+

Edit the CoreDNS ConfigMap in the kube-system namespace. Changes to the Corefile require restarting the CoreDNS pods. You can add custom zones, forwarding rules, and plugins through the ConfigMap.

What is a Corefile?+

The Corefile is CoreDNS configuration file. It defines DNS zones and the plugins applied to each zone. The format is declarative: you specify the zone, then list plugins with their settings inside curly braces.

Does CoreDNS support DNS over TLS/HTTPS?+

Yes. CoreDNS supports DNS over TLS (DoT) and DNS over HTTPS (DoH) through the tls and doh plugins. This encrypts DNS queries between clients and the server, preventing eavesdropping on DNS traffic.

Citations (3)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets