<p>I'm seeing the following error when running <code>kubectl get pods</code>:</p>

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

<p>This was working when I ran it two weeks ago. My config file in the <code>~/.kube/config</code> directory looks as follows:</p>

<pre><code>apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://zld05687.vci.co.com
  name: dev-cluster
- cluster:
    insecure-skip-tls-verify: true
    server: https://zlt20087.vci.co.com
  name: perf-cluster
- cluster:
    insecure-skip-tls-verify: true
    server: https://zlt17291.vci.co.com
  name: test-cluster
contexts:
- context:
    cluster: dev-cluster
    namespace: com-co-acp-dev
    user: default-user
  name: default-context
- context:
    cluster: perf-cluster
    namespace: com-co-acp-perf
    user: default-user
  name: perf-context
- context:
    cluster: test-cluster
    namespace: com-co-acp-test
    user: default-user
  name: test-context
current-context: perf-context
kind: Config
preferences: {}
users:
- name: default-user
  user:
    token: myusername:enc:23hfeu39393yd223944uekd
</code></pre>

<p>What caused this error, and how can I fix it?</p>

kramsiv94
<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>
<ol>
<li><p><strong>kubectl config get-contexts</strong></p>
</li>
<li><p><strong>kubectl config use-context docker-desktop</strong></p>
</li>
</ol>
