--- title: "How to change contexts in Kubernetes" slug: "how-to-change-contexts-in-kubernetes" updated: 2025-12-23T14:58:58Z published: 2025-12-23T14:58:58Z canonical: "docs.swxtch.io/how-to-change-contexts-in-kubernetes" stale: true --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.swxtch.io/llms.txt > Use this file to discover all available pages before exploring further. # How to change contexts in Kubernetes **WHAT TO EXPECT** **In this article**, users will learn how to change the working context in a Kubernetes environment to use a different default. ### To Change K8s Context in Your Preferred Cloud If there is more than one K8s cluster in your preferred cloud, then users may need to switch between them to run commands in the Cloud Shell Linux console. Below are the steps to switch between K8s clusters. 1. Get a list of all K8s Contexts by using the following command: ```shell kubectl config get-contexts ``` Example in Azure: ```shell $ kubectl config get-contexts CURRENT   NAME                 CLUSTER              AUTHINFO                                          NAMESPACE          cilium-sample        cilium-sample        clusterUser_saDevNetwork_cilium-sample                      cilium-sample-200    cilium-sample-200    clusterUser_test-donna-200-rg_cilium-sample-200            cilium-sample2       cilium-sample2       clusterUser_saDevNetwork_cilium-sample2           *         cilium-sample300     cilium-sample300     clusterUser_test-donna-300-rg_cilium-sample300              dsd-k8-cluster-100   dsd-k8-cluster-100   clusterUser_saDevNetwork_dsd-k8-cluster-100   ``` Notice in the above list, there are multiple contexts, but only one has the asterisks (*). The asterisks mark the default context. 2. To change context, run the following command. The example is changing to cilium-sample2. ```shell kubectl config use-context cilium-sample2 ``` 3. Re-run the **get-context** command: ```shell kubectl config get-contexts ``` Example in Azure: ```shell $ kubectl config get-contexts CURRENT   NAME                 CLUSTER              AUTHINFO                                          NAMESPACE          cilium-sample        cilium-sample        clusterUser_saDevNetwork_cilium-sample                      cilium-sample-200    cilium-sample-200    clusterUser_test-donna-200-rg_cilium-sample-200   *         cilium-sample2       cilium-sample2       clusterUser_saDevNetwork_cilium-sample2                    cilium-sample300     cilium-sample300     clusterUser_test-donna-300-rg_cilium-sample300              dsd-k8-cluster-100   dsd-k8-cluster-100   clusterUser_saDevNetwork_dsd-k8-cluster-100 ``` As can be seen above, the asterisk (*) has changed positions to the desired context, cilium-sample2.