nirkov
nirkov

Reputation: 819

Kubectl and Minikube problem - Unable to connect to the server

It looks like it happens randomly, but when I bring up Minikube and start working with it, after a while (can't say exactly how long, it changes every time) I suddenly can't use commands with kubectl and get an error -

Unable to connect to the server: dial tcp 192.168.1.20:8443: connect: no route to host

I tried to find a solution on the Internet but couldn't find the reason why this was happening, and I can't fix it other than deleting a minikube with

sudo minikube delete

And then restarted with

sudo minikube start --vm-driver=none

Anyone come across this and can help?

Upvotes: 1

Views: 9293

Answers (3)

Eldad Assis
Eldad Assis

Reputation: 11055

I had similar behaviour when my minikube was overloaded. I was spinning up a minikube with default settings, but then deploying too much workloads on it. At some point I get the same error.

Try tracking the load on your node with:

kubectl top nodes

or

kubectl top pods --all-namespaces

I found that running minikube with more resources helped me.

My new default setup is:

minikube start --cpus 4 --memory 8192

Upvotes: 4

Luke Rixson
Luke Rixson

Reputation: 647

Another possible cause of this issue is that the local proxy settings may have changed. I had a local proxy server temporarily set but my terminal session had picked up the server configuration change and set the http_proxy and https_proxy environment variables. If you are having connection issues to the minikube cluster, remember to also check your local system network configuration and check there isn't something that is causing your traffic to be re-directed elsewhere.

Upvotes: 2

Giacomo Brunetta
Giacomo Brunetta

Reputation: 1577

Delete your minikube:

minikube delete

and try to augment ram and cpu resources for minikube in this way:

minikube config set memory 8192
minikube config set cpus 4
minikube start

minikube should start with ne new settings

Upvotes: 4

Related Questions