<p>I've installed Kubernetes on windows 10 pro. I ran into a problem where the UI wasn't accepting the access token I had generated for some reason.</p>
<p>So I went into docker and reset the cluster so I could start over:</p>
<p><a href="https://i.stack.imgur.com/2vVld.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2vVld.png" alt="enter image description here" /></a></p>
<p>But now when I try to apply my configuration again I get an error:</p>
<pre><code>kubectl apply -f .\recommended.yaml
Unable to connect to the server: dial tcp 127.0.0.1:61634: connectex: No connection could be made because the target machine actively refused it.
</code></pre>
<p>I have my <code>KUBECONFIG</code> variable set:</p>
<pre><code>$env:KUBECONFIG
C:\Users\bluet\.kube\config
</code></pre>
<p>And I have let kubernetes know about the config with this command:</p>
<pre><code>[Environment]::SetEnvironmentVariable(&quot;KUBECONFIG&quot;, $HOME + &quot;\.kube\config&quot;, [EnvironmentVariableTarget]::Machine)
</code></pre>
<p>Yet, the issue remains! How can I resolve this?  Docker seems fine.</p>

Tim Dunphy
<p>This <a href="https://stackoverflow.com/questions/54012973/kubernetes-error-unable-to-connect-to-the-server-dial-tcp-127-0-0-18080">stack overflow</a> answered my question.</p>
<p>This is what it says:</p>
<blockquote>
<p>If you have kubectl already installed and pointing to some other environment, such as minikube or a GKE cluster, be sure to change
context so that kubectl is pointing to docker-desktop:</p>
</blockquote>
<pre><code>kubectl config get-contexts

kubectl config use-context docker-desktop
</code></pre>
<p>Apparently I had installed <code>minikube</code> which is what messed it up. Switching back to a docker context is what saved the day.</p>
