You need to enable JavaScript to run this app.
Volcengine Kubernetes Engine

Volcengine Kubernetes Engine

Copy page
Download PDF
Clusters
Using KubeCm to manage the kubeconfig files of multiple clusters
Copy page
Download PDF
Using KubeCm to manage the kubeconfig files of multiple clusters
KubeCm facilitates you in flexibly switching between multiple clusters when you use kubectl for cluster management. This topic describes how to use KubeCm to manage VKE clusters of Volcano Engine.​
Background information​
kubectl is the native command-line tool provided by Kubernetes. You can use the kubectl client to connect to a Kubernetes cluster and perform operations, such as creation, viewing, and deletion, on the cluster.​
When connecting to the target cluster with kubectl, first obtain the cluster's kubeconfig access credentials. Then copy them to the $HOME/.kube/config file on your local computer.​
However, if you manage multiple clusters at the same time, you need to constantly modify the content of the $HOME/.kube/config file. Manual merging of kubeconfig files for multiple clusters is inefficient and error-prone. This topic describes a method of efficiently managing the kubeconfig access credentials of multiple clusters to quickly switch the access credentials.​
What is KubeCm?​
KubeCm is a tool for managing the kubeconfig credentials of multiple clusters. KubeCm lets you view, switch between, add, and delete kubeconfig credentials in the $HOME/.kube/conf file, simplifying multi-cluster management.​
tip​
For a detailed introduction to KubeCm, see the official website.​
Prerequisites​
Preparing environment​
The kubectl tool has been installed in the local environment. For details, see Installing and setting up kubectl.​
Installing KubeCm​
Install KubeCm in the local environment. For details, see the official documentation.​
After KubeCm is installed, run the kubecm command. If the following content is displayed, it indicates that KubeCm is installed.​
​
​
Manage your kubeconfig more easily. ​
​
​
██ ██ ██ ██ ██████ ███████ ██████ ███ ███ ​
██ ██ ██ ██ ██ ██ ██ ██ ████ ████ ​
█████ ██ ██ ██████ █████ ██ ██ ████ ██ ​
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ​
██ ██ ██████ ██████ ███████ ██████ ██ ██​
​
Tips Find more information at: kubecm.cloud (https://kubecm.cloud)​
​
Usage:​
kubecm [command]​
​
Available Commands:​
add Add KubeConfig to $HOME/.kube/config​
alias Generate alias for all contexts​
clear Clear lapsed context, cluster and user​
cloud Manage kubeconfig from cloud​
completion Generate completion script​
create Create new KubeConfig(experiment)​
delete Delete the specified context from the kubeconfig​
help Help about any command​
list List KubeConfig​
merge Merge multiple kubeconfig files into one​
namespace Switch or change namespace interactively​
rename Rename the contexts of kubeconfig​
switch Switch Kube Context interactively​
version Print version info​
​
Flags:​
--config string path of kubeconfig (default "/Users/bytedance/.kube/config")​
-h, --help help for kubecm​
-m, --mac-notify enable to display Mac notification banner​
--ui-size int number of list items to show in menu at once (default 4)​
​
Use "kubecm [command] --help" for more information about a command.​
​
Obtaining cluster access credentials​
  1. In the left navigation bar, click Cluster.​
  1. On the Cluster page, click the name of the target cluster to go to the cluster management page.​
  1. In the left navigation bar, click Overview. On the page that appears, click the Connection tab.​
  1. Click the Public network tab, click Generate KubeConfig, and then specify the Valid period parameter to generate the cluster access credentials.​
  1. Click​alt​to download the access credentials to your local computer.​
Common operations​
Adding access credential​
  1. Run the following command to add an access credential.​
​
kubecm add -f kube.conf​
​
​
Replay
Play
00:00 / 00:11 Live
00:00
Fullscreen
Cssfullscreen
1x
  • 2x
  • 1.5x
  • 1x
  • 0.75x
  • 0.5x
Click and hold to drag
​
​
tip​
  • kube.conf is a sample file name for the kubeconfig access credentials. You need to replace it with your file name accordingly.​
  • Before you run the command, make sure that the $HOME/.kube directory already contains the config file. If the file does not exist, an error will be reported when you run the command.​
  • When you run the command, if you select True, the access credentials will be written to the $HOME/.kube/config file. If you select False, a ./kubecm.config file will be generated in the current folder.​
  1. If you want to modify the name of the cluster access credentials when you add the credentials, you can add the -c parameter and use the --context-name parameter to specify the name.​
​
kubecm add -cf kube.conf --context-name demo-cluster​
​
​
Replay
Play
00:00 / 00:31 Live
00:00
Fullscreen
Cssfullscreen
1x
  • 2x
  • 1.5x
  • 1x
  • 0.75x
  • 0.5x
Click and hold to drag
​
​
Viewing the cluster list​
Run the following command to view all access credentials.​
​
kubecm list​
​
​alt​​
Switching clusters​
Run the following command to switch to another access credential.​
​
kubecm switch​
​
​
Replay
Play
00:00 / 00:13 Live
00:00
Fullscreen
Cssfullscreen
1x
  • 2x
  • 1.5x
  • 1x
  • 0.75x
  • 0.5x
Click and hold to drag
​
​
Rename access credentials​
Run the following command to rename the cluster access credentials.​
​
kubecm rename​
​
​
Replay
Play
00:00 / 00:25 Live
00:00
Fullscreen
Cssfullscreen
1x
  • 2x
  • 1.5x
  • 1x
  • 0.75x
  • 0.5x
Click and hold to drag
​
​
Removing clusters​
Run the following command to remove the cluster access credentials.​
​
kubecm delete​
​
​
Replay
Play
00:00 / 00:09 Live
00:00
Fullscreen
Cssfullscreen
1x
  • 2x
  • 1.5x
  • 1x
  • 0.75x
  • 0.5x
Click and hold to drag
​
​
​
Last updated: 2026.07.23 11:53:57