Search code examples
dnskubernetesminikubekube-dns

Kuebrnetes pods get wrong DNS nameserver IP address on minikube


I have faced an issue with resolving services host between with kubernetes on minikube. So from the inside the pod I cannot wget web-server:8081/endpoint. But I can access the same server directly by IP address like this wget 10.0.0.81:8081/endpoint.

After troubleshooting the issue I have found that inside of the pod /etc/resolve.conf file the nameserver is set to 10.96.0.10. Here is how it looks:

nameserver 10.96.0.10
search default.svc.cluster.local svc.cluster.local cluster.local
options ndots:5

When the Cluster IP of kube-dns service is 10.0.0.10. After changing manually the nameserver on the pod to 10.0.0.10 I cat do wget web-server:8081/endpoint.

Why is it set to the wrong IP address and how fix it?


Solution

  • The problem was that I updated minikube without minikube delete. After minikube delete and minikube start the DNS service is getting the IP address 10.96.0.10 the same as is set in the pod's /etc/resolve.conf.