How Do You Troubleshoot the kubectl Error “Unable to connect to the server: dial tcp: lookup ,,, no such host”?

Problem scenario

You run this command:
kubectl get cluster-info

You receive this error message:
"Unable to connect to the server: dial tcp: lookup on no such host"


Possible solution #1
Ask yourself these three questions:

  1. Have you recently destroyed a Kubernetes cluster?
  2. Is the intended Kubernetes cluster running?
  3. Have there been changes to networking or firewall configurations thereby blocking the server with kubectl to the cluster itself?

Possible solution #2
If you want to modify the config file that governs the kubectl settings, do the following:

cd ~
cd .kube

Back up the config file in this directory (e.g., cp config /home/jdoe/config.bak)
Edit the config file in this directory.

Possible solution #3
See this posting.

Leave a comment

Your email address will not be published. Required fields are marked *