Work with kubeconfigs in Cloud Code for Cloud Shell

kubeconfig files are Kubernetes configuration files that organize clusteraccess, users, and contexts. This page shows you how to add, delete and switchbetween different kubeconfigs in Cloud Code.

For more information about kubeconfig files, see the Kubernetes documentation onorganizing cluster access using kubeconfig files.

Manage kubeconfigs

By default, the Cloud Code plugin uses the default kubeconfig file (locatedunder the$HOME/.kube directory) for retrieving Kubernetes resources andrunning commands. However, additional kubeconfig files may be configured.

Add additional kubeconfig files

To add additional kubeconfig files:

  1. Open the command palette (pressCtrl/Cmd+Shift+P or clickView >Command Palette), and then runCloud Code: Switch kubeconfig.
  2. Click+ Load kubeconfig, and then navigate to the location of thekubeconfig file you want to add.
  3. Select the kubeconfig file you want to add, and then clickAdd KubeConfig Path.
  4. Provide a name for the new kubeconfig when prompted.
  5. PressEnter to confirm.

Remove kubeconfig files

To remove kubeconfig files:

  1. Open the command palette (pressCtrl/Cmd+Shift+P or clickView >Command Palette), and then runCloud Code: Remove KubeConfig from Kubernetes Explorer.
  2. Select the checkbox next to the kubeconfig you want to remove, and thenclickOk.

Switch kubeconfigs

You can switch kubeconfigs using theCommand palette. To switch kubeconfigs:

  1. Open theCommand palette, and then runCloud Code: Switch KubeConfig.
  2. Click on the kubeconfig you want to use.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.