08/08/2020

Set kubectl context per shell or terminal - Kubernetes

When I started to work with Kubernetes, It was a bit annoying to deal with multi clusters from CLI at the same time.

First suggestion was always kubectx. It's a nice tool that helps you to switch between clusters back and forth. But my main problem with it was that kubectx switches kubectl context globally. In other words, it changes the cluster context for all shells and terminals.

I've tried to find if someone fixed this problem before, but unfortunately I couldn't find a good enough solution for that purpose. So last year I decided to write my own simple solution for that!

No aliases, no extra custom changes, autocomplete out-of-the-box, and it doesn't matter if you work with 1 or 100 K8s clusters! If your liked kubectx/kubens probably you will like kubech!

Kubech is a tool similar to kubectx, but allows you to set kubectl contexts/namespaces per shell/terminal to manage multi Kubernetes cluster at the same time. i.e. same as kubectx but per shell/terminal.

Here are some of its features:

  • Each shell/terminal will have its own context (K8s cluster) or namespace!
  • Easy to use! Just source it in your favorite shell.
  • No aliases, no extra customizations, it doesn't matter if you work with 1 or 100 K8s clusters!
  • It still can be used along with other tools like kubectx/kubens.
  • It doesn't change anything in ~/.kube/config file. So it works perfectly with static and dynamic kube config files.
  • It supports autocomplete for contexts and namespaces.

That's it! Enjoy! ⎈

Powered by Blogger.

Hello, my name is Ahmed AbouZaid and this is my "lite" technical blog!

I'm a passionate DevOps, Linux system engineer, Cloud/Kubernetes specialist, Free/Open source geek, author, interested in environment, calligraphy, and I believe that “Details Matter”!

DevOps transformation, automation, data, and metrics are my preferred areas. I have a built-in monitoring chip, and too lazy to do anything manually :D

Popular Posts