A tool like zoxide but for Kubernetes contexts and namespaces
kz.mov
Download from Github Release and put in a location in your PATH, .e.g. /usr/local/bin
- Clone this repository to local machine, or download
./autocomplete/[bash|zsh]
file
- Make sure
bash-completion
is installed, .e.g. by Brew on Mac:brew install bash-completion
- Copy
kz
bash completion file to correct location :
sudo cp /path/to/autocomplete/bash /etc/bash_completion.d/kz
source /etc/bash_completion.d/kz
- Put
source /path/to/autocomplete/zsh
into.zshrc
kz ctx sync # copy all context names from your kube config to kz configuration file
kz ns add ns1 ns2 ns3 # track 3 namespaces ns1, ns2, ns3
kz ctx list # list contexts tracked by kz
kz ns list # list namespaces tracked by kz
kz sys 2 # switch to context matching `sys` and namespace matching the `2`
kz sys # switch to context matching `sys`
kz ns 2 # switch to namespace matching `2` (using current context)
kz - 2 # same like `kz ns 2`