Work with kubeconfigs in Cloud Code for Cloud Shell
Stay organized with collectionsSave and categorize content based on your preferences.
kubeconfig files are Kubernetes configuration files that organize cluster
access, users, and contexts. This page shows you how to add, delete and switch
between different kubeconfigs in Cloud Code.
By default, the Cloud Code plugin uses the default kubeconfig file (located
under the$HOME/.kubedirectory) for retrieving Kubernetes resources and
running commands. However, additional kubeconfig files may be configured.
Add additional kubeconfig files
To add additional kubeconfig files:
Open the command palette (pressCtrl/Cmd+Shift+Por clickView>Command Palette), and then runCloud Code: Switch kubeconfig.
Click+ Load kubeconfig, and then navigate to the location of the
kubeconfig file you want to add.
Select the kubeconfig file you want to add, and then clickAdd KubeConfig Path.
Provide a name for the new kubeconfig when prompted.
PressEnterto confirm.
Remove kubeconfig files
To remove kubeconfig files:
Open the command palette (pressCtrl/Cmd+Shift+Por clickView>Command Palette), and then runCloud Code: Remove KubeConfig from Kubernetes Explorer.
Select the checkbox next to the kubeconfig you want to remove, and then
clickOk.
Switch kubeconfigs
You can switch kubeconfigs using theCommand palette. To switch kubeconfigs:
Open theCommand palette, and then runCloud Code: Switch KubeConfig.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eKubeconfig files are Kubernetes configuration files that manage cluster access, users, and contexts.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code uses the default kubeconfig file but allows you to add and manage additional kubeconfig files.\u003c/p\u003e\n"],["\u003cp\u003eYou can add new kubeconfig files through the Command Palette by using the "Cloud Code: Switch kubeconfig" command.\u003c/p\u003e\n"],["\u003cp\u003eRemoving kubeconfig files is achieved via the Command Palette with the "Cloud Code: Remove KubeConfig from Kubernetes Explorer" command.\u003c/p\u003e\n"],["\u003cp\u003eSwitching between different kubeconfig files is done by running the "Cloud Code: Switch KubeConfig" command in the Command Palette.\u003c/p\u003e\n"]]],[],null,["# Work with kubeconfigs in Cloud Code for Cloud Shell\n\nkubeconfig files are Kubernetes configuration files that organize cluster\naccess, users, and contexts. This page shows you how to add, delete and switch\nbetween different kubeconfigs in Cloud Code.\n\nFor more information about kubeconfig files, see the Kubernetes documentation on\n[organizing cluster access using kubeconfig files](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/).\n\nManage kubeconfigs\n------------------\n\nBy default, the Cloud Code plugin uses the default kubeconfig file (located\nunder the `$HOME/.kube` directory) for retrieving Kubernetes resources and\nrunning commands. However, additional kubeconfig files may be configured.\n\n### Add additional kubeconfig files\n\nTo add additional kubeconfig files:\n\n1. Open the command palette (press `Ctrl`/`Cmd`+`Shift`+`P` or click **View** \\\u003e **Command Palette** ), and then run **Cloud Code: Switch kubeconfig**.\n2. Click **+ Load kubeconfig**, and then navigate to the location of the kubeconfig file you want to add.\n3. Select the kubeconfig file you want to add, and then click **Add KubeConfig Path**.\n4. Provide a name for the new kubeconfig when prompted.\n5. Press `Enter` to confirm.\n\n### Remove kubeconfig files\n\nTo remove kubeconfig files:\n\n1. Open the command palette (press `Ctrl`/`Cmd`+`Shift`+`P` or click **View** \\\u003e **Command Palette** ), and then run **Cloud Code: Remove KubeConfig from Kubernetes Explorer**.\n2. Select the checkbox next to the kubeconfig you want to remove, and then click **Ok**.\n\n### Switch kubeconfigs\n\nYou can switch kubeconfigs using the **Command palette**. To switch kubeconfigs:\n\n1. Open the **Command palette** , and then run **Cloud Code: Switch KubeConfig**.\n2. Click on the kubeconfig you want to use.\n\nWhat's next\n-----------\n\n- [Organize your cluster access using kubeconfig files](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/).\n- [Develop and debug parts of a microservice application](/code/docs/shell/speed-up-k8s-development#develop_microservices_applications_using_skaffold_configurations) using skaffold.\n- Learn more about Cloud Code's [YAML editing](/code/docs/shell/yaml-editing) assistance."]]