Minikube+Kubectl "Unable to connect to the server - timeout"

9/3/2018

I'm studying the basic usage of Kubernetes through Minikube lightweight version installed in my Mac Pro Retina Mid 2015 processor i7.

I've noticed a strange behaviour: It works perfectly in the first 1-2 minutes after I start the minikube. When about 2 minutes have passed, my kubelect goes always in Timeout when it must get pods, services, deployments and when it interrogates directly the minikube.

For example it happens like this:

> minikube start

then I call:

> kubectl get pods
NAME                          READY     STATUS    RESTARTS   AGE
aggregator-74d44fd6db-2vff5   0/1       Error     55         4d
aggregator-74d44fd6db-72bmw   0/1       Error     22         4d
chart-649cc6bfb-d8ksj         0/1       Error     17         4d
chart-649cc6bfb-vg6vr         0/1       Error     9          4d
frontend-8dbb85d74-87ltl      1/1       Running   6          4d
frontend-8dbb85d74-whwnk      1/1       Running   6          4d
user-79c94d5574-8vr2h         0/1       Error     10         4d
user-79c94d5574-x7x2d         0/1       Error     13         4d

after 2 minutes:

> kubectl get pods
No resources found.
Unable to connect to the server: net/http: TLS handshake timeout

To let it work again, I must stop and restart minikube and it comes to work just for another couple of minutes. How is that possible?

-- Alex Mawashi
deployment
kubectl
kubernetes
macos
minikube

1 Answer

10/19/2018

I would first try the delete and restart as suggested: $ minikube delete $ minikube start

Second, try giving more resources to minikube. THIS was a big help for me when running it and getting multiple pods going. I give have my memory and have my hyperthreads (i7 normally has 8 hyperthreads on older Macbook Pros and 12 on newer ones. So, I chose 6.) $ minikube --memory 8192 --cpus 6 start

And finally, it's not a bad idea reinstalling minikube if you still have issues: $ brew cask reinstall minikube

Hope that helps!

-- John DesJardins
Source: StackOverflow