CoreDNS
Introduction
CoreDNS is a flexible, plugin-based DNS server written in Go and the default Kubernetes cluster DNS since version 1.13. It chains plugins (cache, forward, kubernetes, prometheus, etc.) into a request-handling pipeline, allowing operators to compose exactly the DNS behavior they need for service discovery, split-horizon DNS, and authoritative zone serving. CoreDNS is a CNCF graduated project.
How to Install
Starting via Binary
Quick Start
bash
# get and run from source
wget https://github.com/coredns/coredns/releases/download/v1.10.1/coredns_1.10.1_linux_amd64.tgz
tar xf coredns_1.10.1_linux_amd64.tgz
install -m 0755 coredns /usr/local/bin
coredns -conf /opt/coredns/coredns.conf
# OR
git clone https://github.com/coredns/coredns
cd coredns && make
install -m 0755 coredns /usr/local/bin
coredns -conf /opt/coredns/coredns.conf -dns.port=1053Config and Boot
Config
bash
# create config
cat > /opt/coredns/coredns.conf << "EOF"
example.org:1053 {
file /var/lib/coredns/example.org.signed
transfer {
to * 2001:500:8f::53
}
errors
log
}
. {
any
forward . 8.8.8.8:53
errors
log
}
EOFBoot(systemd)
bash
cat > /etc/systemd/system/coredns.service << "EOF"
...
EOF
systemctl daemon-reload
systemctl start coredns.service
systemctl enable coredns.serviceStarting via Docker
Run on Docker
bash
# https://hub.docker.com/r/coredns/coredns/tagsStarting via Kubernetes
Deploy by Kubernetes Manifest
bash
#Deploy by Helm
bash
# Add and update repo
helm repo add coredns https://coredns.github.io/helm
helm repo update
# Get charts package
helm pull coredns/coredns --untar
cd coredns
# Configure and run
vim values.yaml
...
helm -n kube-system install coredns .Reference: