<p>I am not exactly sure what's going on which is why I am asking this question. When I run this command:</p>

<pre><code>kubectl config get-clusters
</code></pre>

<p>I get:</p>

<pre><code>arn:aws:eks:us-west-2:91xxxxx371:cluster/eks-cluster-1
arn:aws:eks:us-west-2:91xxxxx371:cluster/eks1
</code></pre>

<p>then I run:</p>

<pre><code>kubectl config current-context
</code></pre>

<p>and I get:</p>

<pre><code>arn:aws:eks:us-west-2:91xxxxx371:cluster/eks-cluster-1
</code></pre>

<p>and if I run <code>kubectl get pods</code>, I get the expected output.
But how do I switch to the other cluster/context? what's the difference between the cluster and context? I can't figure out how these commands differ:</p>

<p>When I run them, I still get the pods from the wrong cluster:</p>

<pre><code>root@4c2ab870baaf:/# kubectl config set-context arn:aws:eks:us-west-2:913617820371:cluster/eks1

Context "arn:aws:eks:us-west-2:913617820371:cluster/eks1" modified.

root@4c2ab870baaf:/#
root@4c2ab870baaf:/# kubectl get pods
NAME                            READY   STATUS    RESTARTS   AGE
apache-spike-579598949b-5bjjs   1/1     Running   0          14d
apache-spike-579598949b-957gv   1/1     Running   0          14d
apache-spike-579598949b-k49hf   1/1     Running   0          14d

root@4c2ab870baaf:/# kubectl config set-cluster arn:aws:eks:us-west-2:91xxxxxx371:cluster/eks1

Cluster "arn:aws:eks:us-west-2:91xxxxx371:cluster/eks1" set.

root@4c2ab870baaf:/# kubectl get pods
NAME                            READY   STATUS    RESTARTS   AGE
apache-spike-579598949b-5bjjs   1/1     Running   0          14d
apache-spike-579598949b-957gv   1/1     Running   0          14d
apache-spike-579598949b-k49hf   1/1     Running   0          14d
</code></pre>

<p>so I really don't know how to properly switch between clusters or contexts and also switch the auth routine when doing so.</p>

<p>For example:</p>

<pre><code>contexts:
- context:
    cluster: arn:aws:eks:us-west-2:91xxxxx371:cluster/ignitecluster
    user: arn:aws:eks:us-west-2:91xxxx371:cluster/ignitecluster
  name: arn:aws:eks:us-west-2:91xxxxx371:cluster/ignitecluster
- context:
    cluster: arn:aws:eks:us-west-2:91xxxx371:cluster/teros-eks-cluster
    user: arn:aws:eks:us-west-2:91xxxxx371:cluster/teros-eks-cluster
  name: arn:aws:eks:us-west-2:91xxxxx371:cluster/teros-eks-cluster
</code></pre>

<p>To clarify on the difference between <code>set-context</code> and <code>use-context</code></p>

<p>A context is a group of access parameters. Each context contains a Kubernetes cluster, a user, and a namespace. So when you do <strong>set-context</strong>, you just adding context details to your configuration file <code>~/.kube/config</code>, but it doesn't switch you to that context, while <strong>use-context</strong> actually does.</p>

<p>Thus, as Vasily mentioned, in order to switch between clusters run</p>

<pre><code>kubectl config use-context &lt;CONTEXT-NAME&gt;
</code></pre>

<p>Also, if you run <code>kubectl config get-contexts</code> you will see list of contexts with indication of the current one. </p>
