Get started with kcontext in under 2 minutes! 🚀
brew tap murarisumit/tap
brew install kcontext# Download for macOS (Apple Silicon)
curl -L https://github.com/murarisumit/kcontext/releases/latest/download/kcontext-darwin-arm64 -o kcontext
chmod +x kcontext
sudo mv kcontext /usr/local/bin/
# Or for macOS (Intel)
curl -L https://github.com/murarisumit/kcontext/releases/latest/download/kcontext-darwin-amd64 -o kcontext
chmod +x kcontext
sudo mv kcontext /usr/local/bin/Add one line to your shell configuration:
echo 'eval "$(kcontext --init bash)"' >> ~/.bashrc
source ~/.bashrcecho 'eval "$(kcontext --init zsh)"' >> ~/.zshrc
source ~/.zshrcecho 'kcontext --init fish | source' >> ~/.config/fish/config.fish
source ~/.config/fish/config.fishkcontext --version
kcontext --listkcontext --listkcontext my-cluster.kubeconfigecho $KUBECONFIG
kubectl config current-contextkcontext looks for kubeconfig files in ~/.kube/*.kubeconfig. Organize them like:
~/.kube/
├── dev.kubeconfig
├── staging.kubeconfig
├── production.kubeconfig
├── client-a.kubeconfig
└── client-b.kubeconfig
Then switch between them easily:
kcontext dev.kubeconfig
kcontext production.kubeconfigTab completion is automatically enabled after shell integration:
kcontext <TAB> # Shows all available kubeconfig files- Prefix your kubeconfigs: Use naming like
prod-,dev-,staging-for easy identification - Quick switching: Use tab completion to avoid typing full names
- Check before you act: Always verify your context after switching:
kcontext prod.kubeconfig && kubectl config current-context
Ensure they:
- Are in
~/.kube/directory - End with
.kubeconfigextension - Have proper read permissions
- Verify you added the init line to your shell config
- Reload your shell:
source ~/.bashrc(or~/.zshrc) - Check if kcontext is in your PATH:
which kcontext
- Read the full README for advanced features
- Check CONTRIBUTING.md to contribute
- Report issues on GitHub
Happy cluster switching! 🎉