CoreDNS is DNS service deployed as a pod in the kubernetes cluster in the kube-system namespace.
We could see it using the below command:
We have two pods running the CoreDNS for redundancy purposes.
The CoreDNS constantly watches the kubernetes cluster to see if there are new pods or services to be added in its database. Pod are able to use the DNS server, defined in their resolv.conf file. The file is filled out automatically by the Kubelet after a pod is created:
We can access the service using the service name, the rest is added "default.svc.cluster.local" as seen in the search field of the resolv.conf file.
CoreDNS and services:
CoreDNS is also a pod and is accessibleto other pods and resources in the cluster through a service. This created service acts as an entry point to the CoreDNS server:
To get the fully qualified name of a service, we use the below command :