Kubernetes context switcher for shells.
With shell-ctx each shell will operate in its own isolated Kubernetes context.
Switching between contexts is done by invoking kubectl shell-ctx in your current shell.
Bash, Zsh and Fish
kubectl krew install shell-ctx
sudo curl https://raw.githubusercontent.com/glemsom/shell-ctx/main/kubectl-shell_ctx -o /usr/local/bin/kubectl-shell_ctx
sudo chmod +x /usr/local/bin/kubectl-shell_ctx
For this plugin to operate the following dependencies are required:
- awk
- sed
- fzf
- kubectl
If you are setting a custom KUBECONFIG you need to load the shell hook AFTER your KUBECONFIG variable is set
For BASH, append the following to your ~/.bashrc somewhere after your KUBECONFIG variable
eval "$(kubectl-shell_ctx hook bash)"
For ZSH, append the following to your ~/.zshrc somewhere after your KUBECONFIG variable
eval "$(kubectl-shell_ctx hook zsh)"
For FISH, append the following to your ~/.config/fish/config.fish somewhere after your KUBECONFIG variable
kubectl-shell_ctx hook fish | source
kubectl shell-ctx Select context; Use arrow-keys or start typing to search
kubectl shell-ctx clone Clone context; Use arrow-keys or start typing to search
kubectl shell-ctx <context> Switch directly to context
