When we create a service in kubernetes , a DNS record is created for it, so it could be reached by name only, as we can see below:
"service.namespace.svc.cluster.local" is the fully qualified name of the service "FQDN".
Below for example is the FQDN of a pod, we use its IP address and replace the "." by "-", as below:
The coredns is a kubernetes DNS server.
It has a list of all the kubernetes objects are their corresponding IP addresses.
The coredns nameserver is accessible through a service called "kube-dns".
We can see the "kube-dns" using the below command:
We could also get more details about the "kube-dns" service including the IP address and also the endpoint of the "core-DNS" pods, using the below command:
"-n" refers to the namespace.
In the pods, we could point to the "kube-dns" service in the pod's "/etc/resolv.conf" file as below:
The kubelet sets up the nameserver on the pods for each node.It is configured in the following kubelet configuration file: "/var/lib/kubelet/config.yaml"