coredns/coredns
Deployment
CoreDNS is built and shipped as a static Go binary. The deployment story splits into "as a system service" and "as a Kubernetes cluster DNS." The repository contains the build pipeline; runtime manifests for Kubernetes live in the sister repository coredns/deployment.
What this repository ships
| Artifact | Source | Used for |
|---|---|---|
coredns binary |
Makefile, Makefile.release |
Linux/macOS/Windows hosts |
Container images (coredns/coredns:<tag>) |
Dockerfile, Makefile.docker, .github/workflows/docker.yml |
Pushed to Docker Hub on release |
Release archives (tar.gz, zip) |
Makefile.release, .github/workflows/release.yml |
Attached to GitHub release |
Man pages (man/) |
Generated from plugin READMEs via Makefile.doc |
Distros that package CoreDNS |
Building releases
Local build
makeProduces ./coredns. See Getting started.
Cross-compile
GOOS=linux GOARCH=arm64 makeCGO_ENABLED=0 by default, so cross-compilation works without any C toolchain.
Release pipeline
Makefile.release is the recipe used by .github/workflows/release.yml:
- Read the tag (e.g.
v1.14.3). - Cross-compile binaries for
linux/{amd64,arm64,arm,ppc64le,s390x,mips64le},darwin/{amd64,arm64},freebsd/amd64, andwindows/amd64. - Sign and archive each.
- Upload to the GitHub release.
- Trigger
docker.ymlto build and push images.
The workflow is gated on a manual tag push; only steering committee members have permission.
Container images
The top-level Dockerfile is a minimal scratch-based image:
FROM scratch
COPY coredns /coredns
EXPOSE 53 53/udp
ENTRYPOINT ["/coredns"]Makefile.docker builds multi-arch manifests via docker buildx. Tags follow the upstream version (v1.14.3, latest).
Running on a host
The simplest deployment is a systemd unit pointing at a Corefile. Example (not in this repo; see coredns/deployment):
[Unit]
Description=CoreDNS DNS server
[Service]
ExecStart=/usr/local/bin/coredns -conf /etc/coredns/Corefile
AmbientCapabilities=CAP_NET_BIND_SERVICE
User=coredns
Group=coredns
Restart=on-failure
[Install]
WantedBy=multi-user.targetNotes:
- The binary needs
CAP_NET_BIND_SERVICEif it listens on:53. - A
pidfilecan be configured via-pidfile. - Reload by sending
SIGUSR1. Caddy converts that into a graceful in-place restart, handing sockets to the new instance viaSO_REUSEPORT.
Kubernetes
CoreDNS is the default cluster DNS for Kubernetes since 1.13. Standard deployment is via the coredns/deployment repo; that repo ships Helm charts and raw manifests, plus the deploy.sh script that the upstream Kubernetes installer uses.
Operationally:
- The
kubernetesplugin contacts the API server in-cluster using the pod's service account. - The Corefile is a ConfigMap; reload happens via the
reloadplugin (default 30s SHA-256 check) when the volume mount updates. - Probes:
livenessProbe: HTTP/healthon:8080(thehealthplugin).readinessProbe: HTTP/readyon:8181(thereadyplugin). Combine withlameduckonhealthso a rolling restart drains gracefully.
- Metrics:
:9153/metricsscraped by Prometheus.
Reload semantics
Caddy.Restart hands sockets between processes via SO_REUSEPORT (Linux). On a SIGUSR1 (or when the reload plugin notices the Corefile changed):
- The current process spawns a child with the new config.
- The child takes over the listeners.
- The parent enters the lameduck state (configurable via
health). - Once the lameduck timer expires, the parent shuts down.
On macOS/BSD, SO_REUSEPORT is not available with the same semantics, so reload involves a brief socket reopen. CoreDNS in production is overwhelmingly Linux, so this is not a major operational concern.
Versioning and deprecation
From the project README:
Release x.y.z: Announce that in the next release we will make backward incompatible changes. Release x.y+1.0: Increase the minor version and set the patch version to 0. Make the changes, but allow the old configuration to be parsed. Release x.y+1.1: Increase the patch version to 1. Remove the lenient parsing.
Translated: any breaking change is announced one minor release ahead, ships with a backward-compatible parser in the next minor, and only the next patch release removes the legacy form. So a deprecation always spans at least two minor releases.
Operating CoreDNS in production
This wiki covers the codebase, not the operations runbook. For day-2 concerns see How to monitor. The community-maintained operations docs live at https://coredns.io.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.