Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minikube is slow and unresponsive

Today randomly minikube seems to be taking very long to respond to command via kubectl.

And occasionally even:

kubectl get pods 
Unable to connect to the server: net/http: TLS handshake timeout

How can I diagnose this?

Some logs from minikube logs:

==> kube-scheduler <==
I0527 14:16:55.809859       1 serving.go:319] Generated self-signed cert in-memory
W0527 14:16:56.256478       1 authentication.go:387] failed to read in-cluster kubeconfig for delegated authentication: open /var/run/secrets/kubernetes.io/serviceaccount/token: no such file or directory
W0527 14:16:56.256856       1 authentication.go:249] No authentication-kubeconfig provided in order to lookup client-ca-file in configmap/extension-apiserver-authentication in kube-system, so client certificate authentication won't work.
W0527 14:16:56.257077       1 authentication.go:252] No authentication-kubeconfig provided in order to lookup requestheader-client-ca-file in configmap/extension-apiserver-authentication in kube-system, so request-header client certificate authentication won't work.
W0527 14:16:56.257189       1 authorization.go:177] failed to read in-cluster kubeconfig for delegated authorization: open /var/run/secrets/kubernetes.io/serviceaccount/token: no such file or directory
W0527 14:16:56.257307       1 authorization.go:146] No authorization-kubeconfig provided, so SubjectAccessReview of authorization tokens won't work.
I0527 14:16:56.264875       1 server.go:142] Version: v1.14.1
I0527 14:16:56.265228       1 defaults.go:87] TaintNodesByCondition is enabled, PodToleratesNodeTaints predicate is mandatory
W0527 14:16:56.286959       1 authorization.go:47] Authorization is disabled
W0527 14:16:56.286982       1 authentication.go:55] Authentication is disabled
I0527 14:16:56.286995       1 deprecated_insecure_serving.go:49] Serving healthz insecurely on [::]:10251
I0527 14:16:56.287397       1 secure_serving.go:116] Serving securely on 127.0.0.1:10259
I0527 14:16:57.417028       1 controller_utils.go:1027] Waiting for caches to sync for scheduler controller
I0527 14:16:57.524378       1 controller_utils.go:1034] Caches are synced for scheduler controller
I0527 14:16:57.827438       1 leaderelection.go:217] attempting to acquire leader lease  kube-system/kube-scheduler...
E0527 14:17:10.865448       1 leaderelection.go:306] error retrieving resource lock kube-system/kube-scheduler: Get https://localhost:8443/api/v1/namespaces/kube-system/endpoints/kube-scheduler?timeout=10s: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
E0527 14:17:43.418910       1 leaderelection.go:306] error retrieving resource lock kube-system/kube-scheduler: Get https://localhost:8443/api/v1/namespaces/kube-system/endpoints/kube-scheduler?timeout=10s: context deadline exceeded (Client.Timeout exceeded while awaiting headers)
I0527 14:18:01.447065       1 leaderelection.go:227] successfully acquired lease kube-system/kube-scheduler
I0527 14:18:29.044544       1 leaderelection.go:263] failed to renew lease kube-system/kube-scheduler: failed to tryAcquireOrRenew context deadline exceeded
E0527 14:18:38.999295       1 server.go:252] lost master
E0527 14:18:39.204637       1 leaderelection.go:306] error retrieving resource lock kube-system/kube-scheduler: Get https://localhost:8443/api/v1/namespaces/kube-system/endpoints/kube-scheduler?timeout=10s: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
lost lease

Update: To work around this issue I just did a minikube delete and minikube start, and the performance issue resolved..

like image 520
Chris Stryczynski Avatar asked May 27 '19 14:05

Chris Stryczynski


People also ask

Why is minikube slow?

As example: minikube start --v=1 to set outbut to INFO level. 3) Because Minikube is working on Virtual Machine sometimes is better to delete minikube and start it again (It helped in this case). 4) It might get slow due to lack of resources.

How much memory does minikube need?

Setup. This reserves 6 GB of RAM for Minikube and starts it up. If you're low on RAM and only intend to run the databases on Minikube, you can likely get away with a smaller number, like 2048.

Is minikube a Kubernet?

Minikube is a lightweight Kubernetes implementation that creates a VM on your local machine and deploys a simple cluster containing only one node. Minikube is available for Linux, macOS, and Windows systems.

How long does it take for minikube to start?

minikube start takes 60+ seconds to do its work, which stinks for users who wish to quickly, repeatedly start and tear down several minikube clusters.


1 Answers

As solution has been found, I am posting this as Community Wiki for future users.

1) Debugging issues with minikube by adding -v flag and set debug level (0, 1, 2, 3, 7).

As example: minikube start --v=1 to set outbut to INFO level.
More detailed information here

2) Use logs command minikube logs

3) Because Minikube is working on Virtual Machine sometimes is better to delete minikube and start it again (It helped in this case).

minikube delete
minikube start

4) It might get slow due to lack of resources.

Minikube as default is using 2048MB of memory and 2 CPUs. More details about this can be fund here In addition, you can enforce Minikue to create more using command minikube start --cpus 4 --memory 8192

like image 96
PjoterS Avatar answered Oct 10 '22 00:10

PjoterS