<p>I have local kubernetes cluster installed as a part of Docker for Windows. So when I run</p>
<pre><code>kubectl get pods
NAME                                 READY   STATUS    RESTARTS   AGE
mytestapplication-64b546767f-hsd5s   1/1     Running   0          6d10h
</code></pre>
<p>Now I am running the following</p>
<pre><code>az aks get-credentials --resource-group appxxx-dfaks-rg --name appxxx-dfaks
Merged &quot;appxxx-dfaks&quot; as current context in C:\Users\aus77_000\.kube\config
</code></pre>
<p>Checking the contexts information</p>
<pre><code>kubectl config get-contexts
CURRENT   NAME                 CLUSTER          AUTHINFO                                   NAMESPACE
          appxxx-dfaks         appxxx-dfaks     clusterUser_appxxx-dfaks-rg_appxxx-dfaks
*         docker-desktop       docker-desktop   docker-desktop
</code></pre>
<p>Switching the context to <code>appxxx-dfaks</code></p>
<pre><code>kubectl config use-context appxxx-dfaks
Switched to context &quot;appxxx-dfaks&quot;.
</code></pre>
<p>Now the current context is <code>appxxx-dfaks</code></p>
<p>The problem is that kubectl keeps targeting my local cluster</p>
<pre><code>kubectl get pods
NAME                                 READY   STATUS    RESTARTS   AGE
mytestapplication-64b546767f-hsd5s   1/1     Running   0          6d10h
</code></pre>
<p>What am I doing wrong?</p>

Alexey Auslender
<p>It could be because context <code>appxxx-dfaks</code> is using <code>cluster</code> which is the local cluster. You can verify which context is using what cluster using</p>
<pre><code>kubectl config view --minify
</code></pre>
<p>Also run <code>kubectl get nodes</code> or <code>kubectl cluster-info</code> to verify what is the cluster actually being used by kubectl.</p>
<p>Check official docs <a href="https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/" rel="nofollow noreferrer">here</a> for more details.</p>
