CoreDNS is one of many DNS ServerDNS Server
DNS Server is a server who's primary purpose is the DNS resolution. It holds a [[Database]] of IP addresses and Domain Names, and is able to communicate with other DNS Servers to help with the quer... solutions, which is particuarily interesting because it's used for DNS Resolution in KubernetesDNS Resolution in Kubernetes
To figure out how [[DNS Resolution]] works in [[Kubernetes]], there are a few important components to consider:
k8s DNS server running on the cluster (e.g. [[CoreDNS]])
[[K8S Node]]'s local DN.... Most of its functionality is implemented through plugins, so it's very flexible and extensible by nature.
Let's see how we can configure a host to be a DNS Server.
To start, you can download the executable and execute it:
wget https://github.com/coredns/coredns/releases/download/v1.8.4/coredns_1.8.4_linux_amd64.tgz
#> coredns_1.8.4_linux_amd64.tgz
tar -xzvf coredns_1.8.4_linux_amd64.tgz
#> coredns
./coredns
#> .:53
#> [INFO] CoreDNS-1.8.4
#> [INFO] linux/amd64, go1.12
#> ...
To configure the CoreDNS to have names and addresses that we want, we use Corefile
- a file for configuring CoreDNS. In there we can set it to read our local /etc/hosts
file like so:
cat >> Corefile
{
hosts /etc/hosts
}
The hosts
section that we specified in Corefile is actually a plugin.
Status: #💡
References: