By Pavan Gudiwada, Robusta.dev – Developer Advocate
Working with multiple clusters is always a challenge. It’s too easy to run a command on the wrong cluster. Furthermore, if you switch clusters multiple times a day, it should be fast and convenient. Running kubectl config use-context <context_name> every time you want to switch contexts is not productive.
We will look at 3 tools that will make your life easier. We’ll evaluate them in the following categories.
How fast can you switch your Kubernetes context if you have many clusters to choose from? Do you remember the names of all the contexts you use?
Does the tool have advanced features like support for multiple config files?
Can you have multiple terminals open, each running its own cluster? Will switching the context in one terminal effect other terminals and increase the chance of errors?
Kubectx is the most popular tool for switching Kubernetes contexts, but it has the fewest features! It displays all the contexts in your Kubeconfig as a selectable list and lets you pick one. That’s it!
Kubectx works with all major platforms, Linux, Windows & macOS. It can be installed with native package managers like helm.
You can also install it as a Kubectl plugin using kubectl krew install ctx. More details here.
When changing your Kubernetes context, kubectx changes it globally for all terminal sessions!
Kubie is an alternative to kubectx. It’s fast, flexible, and leaves your Kubeconfig untouched.
Kubie installation packages are available for macOS and Linux, not windows. Instructions here.
Kubeswitch has the best features of both Kubectx and Kubie. It is the clear winner and the tool that we’ll be using ourselves in the future.
If you are not on MacOS, downloading and installing from source or binary might be a little complicated. But it is definitely worth your time. Detailed instructions here.
FYI, we’re building the best UI to see all your Prometheus alerts and clusters in one place. Take a look at Robusta UI.