Master Multi‑Cluster Management with kubecm: Install, Commands & Tips
This guide introduces kubecm, a Go‑based CLI tool for simplifying multi‑cluster kubeconfig management, covering its background, cross‑platform installation, core commands, command‑line auto‑completion, and practical usage screenshots to help Kubernetes users work more efficiently.
Background
As a Kubernetes learner or user, you often need to operate multiple clusters, which typically requires specifying a
--kubeconfigfile for each operation. Using aliases can help but remains cumbersome. The kubecm tool offers a concise and efficient solution for switching clusters and managing
kubeconfigfiles.
Installation
kubecm supports
Mac,
Linuxand
Windowsplatforms. Installation methods are straightforward:
MacOS
Install via Homebrew or download the binary directly:
<code>brew install sunny0826/tap/kubecm</code>Linux
Download the binary archive and extract it:
<code>curl kubecm.tar.gz https://github.com/sunny0826/kubecm/releases/download/v${VERSION}/kubecm_${VERSION}_Linux_x86_64.tar.gz
tar -zxvf kubecm.tar.gz kubecm && cd kubecm</code>Windows
Download the binary and place it in your
$PATH.
kubecm
Written in Go, kubecm runs on Mac, Linux and Windows, providing interactive commands such as
delete,
rename, and
switch. Current features include:
Add a new
kubeconfigto
$HOME/.kube/configCommand‑line auto‑completion
Delete existing contexts (interactive or specified)
Merge multiple
kubeconfigfiles into one
Rename a context (interactive or specified)
Switch contexts interactively
Command-line Auto‑completion
kubecm offers the same completion functionality as kubectl :
<code>source <(kubecm completion zsh)</code>After running the above, typing
kubecmand pressing Tab will display available completions.
Operate kubeconfig
Run
kubecm --helpto see all available commands; they are intuitive and self‑descriptive.
Screenshots
kubecm listkubecm switch– switch clusters or user roles
That concludes the overview of the kubecm tool. Feel free to share other efficient utilities you use in the comments.
References
kubecm: https://github.com/sunny0826/kubecm
kubectl: https://github.com/kubernetes/kubectl
Ops Development Stories
Maintained by a like‑minded team, covering both operations and development. Topics span Linux ops, DevOps toolchain, Kubernetes containerization, monitoring, log collection, network security, and Python or Go development. Team members: Qiao Ke, wanger, Dong Ge, Su Xin, Hua Zai, Zheng Ge, Teacher Xia.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.