A pyenv-like CLI tool for managing and using multiple kubectl versions.
- UNIX-like operating system (e.g. macOS, Ubuntu)
- bash
kenv may work with other similar shells or setups, though they are not (yet) supported.
{
go get github.com/jameshiew/kenv
kenv init # initializes the `.kube/kenv` directory, where shims and kubectl versions will be stored
eval "$(kenv init -)" # activates kenv for this shell session
echo 'command -v kenv >/dev/null 2>&1 && eval "$(kenv init -)"' >> ~/.bashrc # (or ~/.bash_profile) - load kenv into your shell at start up
}kenv install 1.17.0kenv global 1.17.0If no global version is set with kenv, the system's kubectl will be used by default.
kenv local 1.17.0 Creates a .kenv.yml file in the local directory, that will record the kubectl version to use.
kenv shell 1.17.0Sets the $KENV_VERSION environment variable.
Run kenv help to see more help strings.