kubecm(kube config manager) is used for manage config files of kubernetes clusters.
go get github.com/joyme123/kubecm
list config files
kubecm list
import config file
# import fro local filesystem
kubecm import -n dev_129_cluster -l /tmp/configs/config_dev_182_cluster
# import via ssh with password
kubecm import dev_0_101_cluster --from=ssh://root@192.168.0.101:/etc/kubernetes/kubectl.kubeconfig -p mypassword
# import via ssh with key, default from $HOME/.ssh/id_rsa
kubecm import dev_0_102_cluster --from=ssh://root@192.168.0.102:/etc/kubernetes/kubectl.kubeconfig
use config file
kubecm use -n dev_129_cluster
rename config file
kubecm rename -n dev_129_cluster -t dev_cluster
remove config file
kubecm remove -n dev_129_cluster
zsh 命令行提示:
在对应的主题里添加下面的配置
kubecm_prompt() {
echo " %{$fg[green]%}k8s:$(kubecm list -c)%{$reset_color%}"
}
local kubecm='$(kubecm_prompt)'