The CoreDNS pods monitor the API server and creates an DNS record for each of the created services.

We can display our CoreDNS pods using the below command:


The format of the service's fully qualified name is as below:
"service_name.namespace_name.svc.cluster.local.

The pods use these records to be able to communicate with the services using the service's name.

CoreDNS is by default the DNS server used by the pods.

The kubelet populates the "/etc/resolv.conf" file with the nameserver, which is the CoreDNS in our case.

The above configuration file also exists within the pods.

Below is the "/etc/resolv.conf" file:


Using the above file, the Pods could ask the CoreDNS before connecting to any service, using the service's name.

For example, we could inquire about the "nginx_service" from within our "nginx" pod:


The ndots variable specifies the number of "." or dots, a name should have to be a fully qualified name.
Brando Sabatini and Ikbal C ©. Powered by Blogger.