<p>I am using Docker for Desktop on Windows 10 Professional with Hyper-V, also I am not using minikube. I have installed Kubernetes cluster via Docker for Desktop, as shown below:</p>

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

<p>It shows the Kubernetes is successfully installed and running.</p>

<p>When I run the following command:</p>

<pre><code>kubectl config view
</code></pre>

<p>I get the following output:</p>

<pre><code>apiVersion: v1
clusters:
- cluster:
  insecure-skip-tls-verify: true
  server: https://localhost:6445
  name: docker-for-desktop-cluster
contexts:
 - context:
   cluster: docker-for-desktop-cluster
   user: docker-for-desktop
   name: docker-for-desktop
   current-context: docker-for-desktop
kind: Config
preferences: {}
users:
- name: docker-for-desktop
user:
  client-certificate-data: REDACTED
  client-key-data: REDACTED
</code></pre>

<p>However when I run the </p>

<pre><code>kubectl cluster-info
</code></pre>

<p>I am getting the following error:</p>

<pre><code>Unable to connect to the server: dial tcp [::1]:6445: connectex: No connection could be made because the target machine actively refused it.
</code></pre>

<p>It seems like there is some network issue, I am not sure how to resolve this.</p>

Adnan Mian
<p>I know this is an old question but the following helped me to resolve a similar issue. The root cause was that I had minikube installed previously and that was being used as my default context.
I was getting following error:</p>

<pre><code>Unable to connect to the server: dial tcp 192.168.1.8:8443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
</code></pre>

<p>In the power-shell run the following command:</p>

<pre><code>&gt; kubectl config get-contexts
CURRENT   NAME                 CLUSTER          AUTHINFO         NAMESPACE
      docker-desktop       docker-desktop   docker-desktop
      docker-for-desktop   docker-desktop   docker-desktop
*     minikube             minikube         minikube
</code></pre>

<p>this will list all the contexts and see if there are multiple. If you had installed minikube in the past, that will show a * mark as currently selected default context. You can change that to point to <strong>docker-desktop</strong> context like follows:</p>

<pre><code>&gt; kubectl config use-context docker-desktop
</code></pre>

<p>Run the get-contexts command again to verify the * mark.</p>

<p>Now, the following command should work:</p>

<pre><code>&gt; kubectl get pods
</code></pre>
