Work with kubeconfig files in Cloud Code for IntelliJ

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. Navigate to Cloud Code settings within your IDE (File > Settings > Tools > Cloud Code > Kubernetes or for Mac OS X, IntelliJ IDEA > Preferences > Tools > Cloud Code > Kubernetes).
  2. In the kubeconfigs section, click the + Add kubeconfig icon or press Alt+insert to bring up the selection dialog.
  3. In the Select kubeconfig file dialog, navigate to the location of the kubeconfig file you want to add.
  4. Select the kubeconfig file you want to use, and then click Ok.
  5. In the Settings dialog, click OK to save your changes.

Remove kubeconfig files

To remove kubeconfig files:

  1. Navigate to Cloud Code settings within your IDE (File > Settings > Tools > Cloud Code > Kubernetes or for Mac OS X, IntelliJ IDEA > Preferences > Tools > Cloud Code > Kubernetes).
  2. In the kubeconfigs section, click the kubeconfig you want to remove, and then click the - Remove icon or press Alt+Delete.
  3. Click Ok to save your changes.

Switch kubeconfigs

You can toggle the resource browser's current kubeconfig by clicking on the kubeconfigs drop-down menu and selecting the kubeconfig you want to use. Upon selecting a kubeconfig, the tool window updates to use the chosen kubeconfig.

Tip: New kubeconfigs can be added directly using the kubeconfigs drop-down menu.

Expanding the kubeconfig dropdown menu.

Using Cloud Code Run Configurations

Cloud Code Run Configurations can be modified to use alternate kubeconfig files. To change kubeconfigs, open the Run Configuration to modify and under Run > Advanced settings, select the kubeconfig you want to use from the kubeconfig drop-down menu. Upon selecting a kubeconfig, available contexts update to reflect those found in the selected kubeconfig.

Tip: New kubeconfigs can be added directly from run configurations by clicking + Add to the right of the drop-down.

Editing kubeconfig settings in Run Configurations. Provides a drop-down to
select an already added kubeconfig, and a button to add a new kubeconfig.

What's next

Get support

To submit feedback or report an issue in your IntelliJ IDE, go to Tools > Cloud Code > Help / About > Submit feedback or report an issue to report an issue on GitHub, or ask a question on Stack Overflow.