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, I'm a passionate Tech Lead DevOps Engineer. 👋

With 16+ years of open-source contributions, 12+ years of professional hands-on experience in DevOps, and an M.Sc. in Data Engineering from Edinburgh Napier University (UK), I enjoy facilitating the growth of both businesses and individuals.

I specialize in Cloud-Native and Kubernetes. I'm also a Free/Open source geek and book author. My favorite topics are DevOps transformation, automation, data, and metrics.

Contact Me

Name

Email *

Message *

Start Your DevOps Engineer Journey!

Start Your DevOps Engineer Journey!
Start your DevOps career for free the Agile way in 2024 with the Dynamic DevOps Roadmap ⭐

Latest Post

2023 Highlights

Image generated with Craiyon . Finally, 2023 is over! What a year! One more crazy year, but it was the culmination ...

Popular Posts

Blog Archive