A CLI tool for managing Kubernetes kubeconfig files.
brew tap kadirbelkuyu/tap
brew install kadirbelkuyu/tap/kubecfgkubectl krew install kubecfggo install github.com/kadirbelkuyu/kubecfg@latestgit clone https://github.com/kadirbelkuyu/kubecfg.git
cd kubecfg
go build -o kubecfg .
sudo mv kubecfg /usr/local/bin/More installation options
yay -S kubecfgsudo port install kubecfgchoco install kubecfgwinget install kadirbelkuyu.kubecfgcurl -fsSL https://kadirbelkuyu.github.io/apt-repo/public_key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/kubecfg-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/kubecfg-keyring.gpg] https://kadirbelkuyu.github.io/apt-repo stable main" | sudo tee /etc/apt/sources.list.d/kubecfg.list
sudo apt update && sudo apt install kubecfg- Add - Import kubeconfig files with custom context names
- List - View all contexts with cluster details
- Use - Interactive context switching with optional namespace selection
- Namespace - Switch namespaces with interactive picker
- Remove - Delete contexts with confirmation
- Rename - Change context names
- Merge - Combine multiple kubeconfig files
kubecfg add ./eks-cluster.yaml --name production-ekskubecfg listInteractive mode:
kubecfg useDirect switch:
kubecfg use production-eksWith interactive namespace selection:
kubecfg use -n
kubecfg use production-eks -nWith specific namespace:
kubecfg use production-eks -n kube-systemInteractive mode:
kubecfg nsDirect switch:
kubecfg ns kube-systemShow current namespace:
kubecfg ns currentkubecfg currentkubecfg rename old-name new-namekubecfg remove old-cluster
kubecfg remove old-cluster --force # skip confirmationkubecfg merge config1.yaml config2.yaml -o merged.yaml| Flag | Description |
|---|---|
--kubeconfig |
Path to kubeconfig file (default: ~/.kube/config) |
-n, --namespace |
Set namespace for context (use without value for interactive selection) |
MIT License