Kubernetes 101 : Troubleshooting the DNS services - CoreDNS, kube-dns -



Checking the "coredns" deployment:

We could use the below command to display the deployment object that manages pods with "kube-dns" label in the "kube-system" namespace, to check if it is in a "ready" state:


Checking the "coredns" pods:

We can also display the pods in the "kube-system" namespace, that have the "k8s-app=kube-dns" label, to check if they are "running":


We could look at the logs of the above "coredns" pod, using the below command to check for errors:


Checking the "kube-dns" ClusterIP service:

The address of the ClusterIP service that is handling the "kube-dns" pod needs to be the same as the nameserver in the "/etc/resolv.conf" file:


We could also check the "kube-dns" endpoints listening on port "53", to see if they are running properly, using the below command:



Re-deploying the CoreDNS pod:

Another solution to fix the service discovery issue is to delete the CoreDNS Pods

They will be restarted by the deployment object that is managing them.
We delete the DNS pods using their label "kube-dns":


Comments

Leave as a comment:

Archive