Top favorite tools to make working with Kubernetes cluster easier
kubectx
Kubectx is helpful for multi-cluster installations, where you need to switch context between one cluster and another. You can make it easy to switch between the clusters in your kubeconfig.
🎊 If you use Homebrew you can install it like this:
brew install kubectx
Linux
sudo apt install kubectx
Usage
USAGE:
kubectx : list the contexts
kubectx <NAME> : switch to context <NAME>
kubectx - : switch to the previous context
kubectx -c, --current : show the current context name
kubectx <NEW_NAME>=<NAME> : rename context <NAME> to <NEW_NAME>
kubectx <NEW_NAME>=. : rename current-context to <NEW_NAME>
kubectx -d <NAME> : delete context <NAME> ('.' for current-context)
(this command won't delete the user/cluster entry
that is used by the context)
kubectx -u, --unset : unset the current context
kubens
kubens helps you switch between Kubernetes namespaces smoothly.
To do so in all your shell sessions, add the following to your ~/.zshrc file:
If you have an alias for kubectl, you can extend shell completion to work with that alias:
After reloading your shell, kubectl autocompletion should be working.
Usage
You don't need to copy-pasting pod names but just type the first few letters and press the tab.
K9s
K9s provides a terminal UI to interact with your Kubernetes clusters. The aim of this project is to make it easier to navigate, observe and manage your applications in the wild.
kubectl-aliases generates hundreds of convenient shell aliases for kubectl, so you no longer need to spell out every single command and --flag over and over again.
USAGE:
kubens : list the namespaces
kubens <NAME> : change the active namespace
kubens - : switch to the previous namespace
kubens -c, --current : show the current namespace
echo 'alias k=kubectl' >>~/.zshrc
echo 'complete -F __start_kubectl k' >>~/.zshrc
brew install k9s
choco install k9s
# List all available CLI options
k9s help
# To get info about K9s runtime (logs, configs, etc..)
k9s info
# To run K9s in a given namespace
k9s -n mycoolns
# Start K9s in an existing KubeConfig context
k9s --context coolCtx
# Start K9s in readonly mode - with all cluster modification commands disabled
k9s --readonly