/kubectl-use

Plugin for simple switch kubernetes contexts and namespaces

Primary LanguageShellApache License 2.0Apache-2.0

kubectl-use

Plugin for simple switch kubernetes contexts and namespaces

Example usage

# kubectl use prod
Switched to context "prod".

# kubectl use default
Switched to namespace "default".

# kubectl use stage kube-system
Switched to context "stage".
Switched to namespace "kube-system".

Installation

using krew:

kubectl krew index add kvaps https://github.com/kvaps/krew-index
kubectl krew install kvaps/use

or using curl:

curl -LO https://github.com/kvaps/kubectl-use/raw/master/kubectl-use
chmod +x ./kubectl-use
sudo mv ./kubectl-use /usr/local/bin/kubectl-use

Autocompletion

Add to your .zshrc or .bashrc file:

if command -V kubectl-use >/dev/null; then
  source <(kubectl-use -completion)
fi