<p>Today randomly minikube seems to be taking very long to respond to command via <code>kubectl</code>.</p>

<p>And occasionally even:</p>

<pre><code>kubectl get pods 
Unable to connect to the server: net/http: TLS handshake timeout
</code></pre>

<p>How can I diagnose this?</p>

<p>Some logs from <code>minikube logs</code>:</p>

<pre><code>==&gt; kube-scheduler &lt;==
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
</code></pre>

<p><em>Update:
To work around this issue I just did a <code>minikube delete</code> and <code>minikube start</code>, and the performance issue resolved..</em></p>

<p>As solution has been found, I am posting this as Community Wiki for future users.</p>
<p><strong>1)</strong> Debugging issues with minikube by adding <code>-v</code> flag and set debug level (0, 1, 2, 3, 7).</p>
<p>As example: <code>minikube start --v=1</code> to set outbut to INFO level.<br/>
More detailed information <a href="https://github.com/kubernetes/minikube/blob/master/docs/debugging.md" rel="noreferrer">here</a></p>
<p><strong>2)</strong> Use logs command <code>minikube logs</code></p>
<p><strong>3)</strong> Because Minikube is working on Virtual Machine sometimes is better to delete minikube and start it again (It helped in this case).</p>
<pre><code>minikube delete
minikube start
</code></pre>
<p><strong>4)</strong> It might get slow due to lack of resources.</p>
<p>Minikube as default is using 2048MB of memory and 2 CPUs. More details about this can be fund <a href="https://github.com/kubernetes/minikube/blob/232080ae0cbcf9cb9a388eb76cc11cf6884e19c0/pkg/minikube/constants/constants.go#L97" rel="noreferrer">here</a>
In addition, you can enforce Minikube to create more using command</p>
<pre><code>minikube start --cpus 4 --memory 8192
</code></pre>
