Work with kubeconfig files in Cloud Code for VS Code

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.

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

Manage kubeconfigs

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

Add additional kubeconfig files

To add additional kubeconfig files:

  1. Open the command palette (press Ctrl/Cmd+Shift+P or click View > Command Palette), and then run Cloud Code: Switch kubeconfig.
  2. Click + Load kubeconfig, and then navigate to the location of the kubeconfig file you want to add.
  3. Select the kubeconfig file you want to add, and then click Add KubeConfig Path.
  4. Provide a name for the new kubeconfig when prompted.
  5. Press Enter to confirm.

Remove kubeconfig files

To remove kubeconfig files:

  1. Open the command palette (press Ctrl/Cmd+Shift+P or click View > Command Palette), and then run Cloud Code: Remove KubeConfig from Kubernetes Explorer.
  2. Select the checkbox next to the kubeconfig you want to remove, and then click Ok.

Switch kubeconfigs

You can switch kubeconfigs using the Command palette. To switch kubeconfigs:

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

What's next