<p>I am trying to learn Kubernetes and so I installed Minikube on my local Windows 10 Home machine and then I tried installing the kubectl. However so far I have been unsuccessful in getting it right.
So this what I have done so far:
Downloaded the kubectl.exe file from <a href="https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/windows/amd64/kubectl.exe" rel="nofollow noreferrer">https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/windows/amd64/kubectl.exe</a></p>

<p>Then I added the path of this exe in the <code>path environment variable</code> as shown below:
<a href="https://i.stack.imgur.com/pkNSX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pkNSX.png" alt="enter image description here"></a></p>

<p>However this didn't work when I executed <code>kubectl version</code> on the command prompt or even on pwoershell (in admin mode)</p>

<p>Next I tried using the curl command as given in the docs - <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-with-curl-on-windows" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-with-curl-on-windows</a></p>

<p>However that too didn't work as shown below:
<a href="https://i.stack.imgur.com/CH5UH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CH5UH.png" alt="enter image description here"></a></p>

<p>Upon searching for answers to fix the issue, I stumbled upon this <a href="https://stackoverflow.com/questions/39922430/cant-connect-to-container-cluster-environment-variable-home-or-kubeconfig-must">StackOverfow question</a> which explained how to create a <code>.kube</code> config folder because it didn't exist on my local machine. I followed the instructions, but that too failed.</p>

<p><a href="https://i.stack.imgur.com/s5Vw5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s5Vw5.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/ZUlE1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZUlE1.png" alt="enter image description here"></a></p>

<p>So right now I am completely out of ideas and not sure whats the issue here. FYI, I was able to install everything in a breeze on my Mac, however Windows is just acting crazy.</p>

<p>Any help would be really helpful.</p>

RDM
<p>As user @paltaa mentioned:</p>
<blockquote>
<p>did you do a  <code>minikube start</code>  ? – <a href="https://stackoverflow.com/users/6855531/paltaa" title="405 reputation">paltaa</a>  <a href="https://stackoverflow.com/questions/61144233/issue-in-setting-up-kubectl-on-windows-10-home#comment108172290_61144233">2 days ago</a></p>
</blockquote>
<p><strong>The fact that you did not start the <code>minikube</code> is the most probable cause why you are getting this error.</strong></p>
<hr />
<p>Additionally this error message shows when the <code>minikube</code> is stopped as stopping will change the <code>current-context</code> inside the <code>config</code> file.</p>
<hr />
<p>There is no need to create a <code>config</code> file inside of a <code>.kube</code> directory  as the <code>minikube start</code> will create appropriate files and directories for you automatically.</p>
<p>If you run <code>minikube start</code> command successfully you should get below message at the end of configuration process which will indicate that the <code>kubectl</code> is set for <code>minikube</code> automatically.</p>
<blockquote>
<p>Done! kubectl is not configured to use &quot;minikube&quot;</p>
</blockquote>
<p>Additionally if you invoke command <code>$ kubectl config</code> you will get more information how <code>kubectl</code> is looking for configuration files:</p>
<pre><code> The loading order follows these rules:

  1.  If the --kubeconfig flag is set, then only that file is loaded. The flag may only be set once and no merging takes
place.
  2.  If $KUBECONFIG environment variable is set, then it is used as a list of paths (normal path delimiting rules for
your system). These paths are merged. When a value is modified, it is modified in the file that defines the stanza. When
a value is created, it is created in the first file that exists. If no files in the chain exist, then it creates the
last file in the list.
  3.  Otherwise, ${HOME}/.kube/config is used and no merging takes place.
</code></pre>
<p>Please take a special look on part:</p>
<blockquote>
<ol start="3">
<li>Otherwise, ${HOME}/.kube/config is used</li>
</ol>
</blockquote>
<p>Even if you do not set the <code>KUBECONFIG</code> environment variable <code>kubectl</code> will default to <code>$USER_DIRECTORY</code> (for example <code>C:\Users\yoda\</code>.</p>
<p>If for some reason your cluster is running and files got deleted/corrupted you can:</p>
<ul>
<li><code>minikube stop</code></li>
<li><code>minikube start</code></li>
</ul>
<p>which will recreate a <code>.kube/config</code></p>
<hr />
<p>Steps for running <code>minikube</code> on Windows in this case could be:</p>
<ul>
<li>Download and install <a href="https://kubernetes.io/docs/tasks/tools/install-minikube/#install-minikube-using-an-installer-executable" rel="nofollow noreferrer">Kubernetes.io: Install minikube using an installer executable</a></li>
<li>Download, install and configure a Hypervisor (for example <a href="https://www.virtualbox.org/" rel="nofollow noreferrer">Virtualbox</a>)</li>
<li>Download <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/" rel="nofollow noreferrer">kubectl</a>
<ul>
<li>OPTIONAL: Add the <code>kubectl</code> directory to Windows environment variables</li>
</ul>
</li>
<li>Run from command line or powershell from current user: <code>$ minikube start --vm-driver=virtualbox</code></li>
<li>Wait for configuration to finish and invoke command like <code>$ kubectl get nodes</code>.</li>
</ul>
