Kubectl and Minikube problem - Unable to connect to the server

3/14/2020

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?

-- nirkov
kubectl
kubernetes
minikube

1 Answer

3/14/2020

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:

sudo minikube start --cpu 4 --memory 8192
-- Eldad Assis
Source: StackOverflow