~/.kube/config
) to configure the information of multiple clusters, and manage and operate multiple clusters. cls-l6whmzi3-config
as an example. Run the following command to use kubecm to add the access credential to kubeconfig (-n
means you can specify the context name):kubecm add -f cls-l6whmzi3-config -n cd -c
kubecm ls
command to view the cluster list in kubeconfig (the asterisk identifies the cluster under operation):$ kubecm ls+------------+------------+-----------------------+--------------------+-----------------------------------+-------------------+| CURRENT | NAME | CLUSTER | USER | SERVER | Namespace |+============+============+=======================+====================+===================================+===================+| * | cd | cluster-chh6kgf9d9 | user-chh6kgf9d9 | https://cls-l6whmzi3.ccs.tence | default || | | | | nt-cloud.com | |+------------+------------+-----------------------+--------------------+-----------------------------------+-------------------+| | bj | cluster-6qaua96n | user-6qaua96n | https://cls-6qaua96n.ccs.tence | kube-system || | | | | nt-cloud.com | |+------------+------------+-----------------------+--------------------+-----------------------------------+-------------------+
kubecm switch
command to interactively switch to another cluster:kubecm delete
command to remove a cluster:$ kubecm delete bjContext Delete:「bj」「/Users/roc/.kube/config」 write successful!+------------+---------+-----------------------+--------------------+-----------------------------------+--------------+| CURRENT | NAME | CLUSTER | USER | SERVER | Namespace |+============+=========+=======================+====================+===================================+==============+| | cd | cluster-chh6kgf9d9 | user-chh6kgf9d9 | https://cls-l6whmzi3.ccs.tence | default || | | | | nt-cloud.com | |+------------+---------+-----------------------+--------------------+-----------------------------------+--------------+
Apakah halaman ini membantu?