Kubernetes context and namespace switching with style. Inspired by Kubie with additional features that Kubie lacks.
- go 1.14+
- make
You can download Kubeswitch from releases page.
$ brew install ckt114/tap/kubeswitchYou can build Kubeswitch by running the following commands.
$ git clone https://github.com/ckt114/kubeswitch
$ cd kubeswitch
$ make
$ sudo make installInstall default configuation to as $HOME/.kubeswitch.yaml.
$ make install-config$ make bash-completion$ make zsh-completion$ make fish-completion# Switching context. Use context or ctx commands.
$ kubeswitch ctx [ENTER]
? Select context. / to search:
aws-east1
aws-west1
k3s
▸ kind
# Switching namespace. Use namespace or ns commands.
(kind|default) $ kubeswitch ns [ENTER]
? Select namespace. / to search:
argocd
default
▸ jenkins
kube-node-lease
kube-public
kube-system
(kind|jenkins) $# Switching context. Use context or ctx commands.
$ kubeswitch ctx [TAB]
aws-east1 aws-west1 k3s kind
# Switching namespace. Use namespace or ns commands.
(kind|default) $ kubeswitch ns [TAB]
argocd default jenkins kube-node-lease kube-public kube-systemKubeswitch default config file is $HOME/.kubeswitch.yaml.
Use -c or --config flags or KUBESWITCH_CONFIG environment variable to
override default config file. The following keys are used by Kubeswitch
kubeConfig- Kubernetes config file to merge into Kubeswitch session fileKUBESWITCH_KUBECONFIGconfigs- Array list of path patterns to search for Kubernetes config filespromptSize- Number of items to show for selection promptKUBESWITCH_PROMPTSIZEnoPrompt- Don't use selection prompt; print each item per lineKUBESWITCH_NOPROMPTpurgedays- Number of days to retain Kubeswitch session filesKUBESWITCH_PURGE_DAYS
Using shell prompt integration will greatly help knowing which Kubernetes context and namespace you're currently interacting with.