Using CoreDNS for Service Discovery
You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:
Your Kubernetes server must be at or later than version v1.9. To check the version, enter .
About CoreDNS
is a flexible, extensible DNS server that can serve as the Kubernetes cluster DNS. Like Kubernetes, the CoreDNS project is hosted by the CNCF.
You can use CoreDNS instead of kube-dns in your cluster by replacing kube-dns in an existing deployment, or by using tools like kubeadm that will deploy and upgrade the cluster for you.
Migrating to CoreDNS
In Kubernetes version 1.10 and later, you can also move to CoreDNS when you use kubeadm
to upgrade a cluster that is using kube-dns
. In this case, will generate the CoreDNS configuration (“Corefile”) based upon the kube-dns
ConfigMap, preserving configurations for stub domains, and upstream name server.
If you are moving from kube-dns to CoreDNS, make sure to set the CoreDNS
feature gate to during an upgrade. For example, here is what a v1.11.0
upgrade would look like:
In Kubernetes version 1.13 and later the CoreDNS
feature gate is removed and CoreDNS is used by default.
In versions prior to 1.11 the Corefile will be overwritten by the one created during upgrade. You should save your existing ConfigMap if you have customized it. You may re-apply your customizations after the new ConfigMap is up and running.
In Kubernetes version 1.21, support for is removed from kubeadm.
CoreDNS is available in Kubernetes since v1.9. You can check the version of CoreDNS shipped with Kubernetes and the changes made to CoreDNS here.
CoreDNS can be upgraded manually in case you want to only upgrade CoreDNS or use your own custom image. There is a helpful available to ensure a smooth upgrade.
Tuning CoreDNS
When resource utilisation is a concern, it may be useful to tune the configuration of CoreDNS. For more details, check out the .