前言
sunny0826/kubecm: Easier management of kubeconfig. (github.com)
下载、安装
wget -O kubecm_release.tgz https://github.com/sunny0826/kubecm/releases/download/v0.15.3/kubecm_0.15.3_Linux_x86_64.tar.gz
tar xf kubecm_release.tgz && rm -rf kubecm_release.tgz
mv kubecm /usr/local/bin/
基本使用
添加配置 zyh.yaml
apiVersion: v1
clusters:
- cluster:
server: https://x.x.x.x:6443
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSU
name: kubernetes
contexts:
- context:
cluster: kubernetes user: "kubernetes-admin"
name: aaa103439
current-context: kubernetes-admin
kind: Config
preferences: {}
users:
- name: "kubernetes-admin"
user:
client-certificate-data: LS0tLS1CRUdJTiBDRV
client-key-data: LS0tLS1CRUdJTiBSU0EgUFJ
💥contexts.[].name
不可与其它集群配置重复.
kubecm add -f zyh.yaml # 合并 zyh.yaml 到 ~/.kube/config
===
选择 true
切换配置
kubecm switch qa
删除配置
kubecm delete qa