问题背景
真实工作场景中,我们有多环境,多集群需要管理,官方给出的多集群管理方式,是kubectl 自有的管理方式,但是每次有新环境要添加时,管理员一般都会给到一个独立的kubeconfig, 每次都需要手动合并kubeconfig,非常麻烦还容易出错
kubecm
kubecm:Easier management of kubeconfig
如官方介绍,kubecm就是用来管理kubeconfig的工具
安装
官方提供了各平台的安装方式,这里安装linux当前最新版本0.16.2
# linux x86_64
curl -Lo kubecm.tar.gz https://github.com/sunny0826/kubecm/releases/download/v${VERSION}/kubecm_${VERSION}_Linux_x86_64.tar.gz
# macos
curl -Lo kubecm.tar.gz https://github.com/sunny0826/kubecm/releases/download/v${VERSION}/kubecm_${VERSION}_Darwin_x86_64.tar.gz
sudo mv kubecm /usr/local/bin/
至此kubecm 安装好了,运行 kubecm -h 输出如下
kubecm 命令
kubecm list 查看config
添加其他集群的信息
[root@k8s-master1 data]# kubecm add -f config
Use the arrow keys to navigate: ↓ ↑ → ←
「config」 Name already exists, do you want to rename it. (If you select `False`, this context will not be merged)
False
? True
选择True ,点击回车
[root@k8s-master1 data]# kubecm list
+------------+--------------------------------+-----------------------+---------------------+------------------------------+--------------+
| CURRENT | NAME | CLUSTER | USER | SERVER | Namespace |
+============+================================+=======================+=====================+==============================+==============+
| | config | cluster-b796g6fbkm | user-b796g6fbkm | https://192.168.5.4:6443 | default |
+------------+--------------------------------+-----------------------+---------------------+------------------------------+--------------+
| * | kubernetes-admin@kubernetes | kubernetes | kubernetes-admin | https://192.168.5.11:6443 | default |
+------------+--------------------------------+-----------------------+---------------------+------------------------------+--------------+
Cluster check succeeded!
Kubernetes version v1.20.11
Kubernetes master is running at https://192.168.5.11:6443
[Summary] Pod: 12 Namespace: 4 Node: 3
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容