<p>Sometimes when Minikube is already running and I try to run any <code>kubectl</code> command (like <code>kubectl get pods</code>) I get this error:<br></p>

<pre><code>Unable to connect to the server: dial tcp 192.168.99.101:8443
</code></pre>

<p>So I stop Minikube and start it again and all <code>kubectl</code> commands work fine, but then after a while if I try to run any <code>kubectl</code> command I get the same error as above.</p>

<p>If I type <code>minikube ip</code> I get <code>192.168.99.100</code>. Why does <code>kubectl</code> try to connect to <code>192.168.99.101</code> (as mentioned in the error) when Minikube is running on <code>192.168.99.100</code>?</p>

<p>Note that I'm very new to Kubernetes. </p>

<p><code>kubectl config get-contexts</code> gives me this output:<br></p>

<pre><code>CURRENT   NAME       CLUSTER    AUTHINFO   NAMESPACE
*         minikube   minikube   minikube
</code></pre>

<p>This is <code>minikube logs</code> output <a href="https://pastebin.com/kb5jNRyW" rel="nofollow noreferrer">https://pastebin.com/kb5jNRyW</a></p>

<p>This usually happens when the IP of your VM might be changed, and your minikube is pointing to the previous IP, You can check through <code>minikube ip</code> and then check the IP of the VM created, they will be different. </p>

<p>You can also try <code>minikube status</code>, your output will be :
<code>
minikube: Running
cluster: Stopped
kubectl: Misconfigured: pointing to stale minikube-vm.
To fix the kubectl context, run minikube update-context
</code></p>

<p>You can try <code>minikube update-context</code> and if it doesn't run even then, try <code>minikube start</code> followed by <code>minikube update-context</code>, it won't download everything again, it will only start the VM if shut down.</p>
