News
New: Web Application Firewall (WAF) in Serverspace
Serverspace Black Friday
DF
October 4 2025
Updated October 22 2025

Kubech - kubectl context management for each terminal

Kubernetes

Kubech is a convenient tool for developers, DevOps engineers, and Kubernetes administrators that allows you to manage kubectl contexts and namespaces separately for each terminal or tab.

It works similarly to kubectx and kubens, but adds an essential improvement - contexts are isolated between shell sessions, making multi-cluster operations safer and more transparent.

GitHub: DevOpsHiveHQ/kubech

Why You Need Kubech

When working with multiple Kubernetes clusters (for example, prod, staging, and dev), it’s easy to lose track of which one you’re currently connected to. The default kubectl uses a global context, so if you switch it in one terminal, it changes everywhere.

Kubech solves this problem by assigning its own context and namespace to each terminal session. This allows you to work with multiple clusters simultaneously without risking accidental operations in the wrong environment.

Main Features

  • Per-terminal context isolation - each shell session has its own context and namespace.
  • Fast context and namespace switching - uses familiar kubectx and kubens-style commands.
  • Integration with bash/zsh/fish - supports the most popular shells.
  • Color indicators - display current context and namespace in the prompt to prevent mistakes.
  • Security - isolated sessions make it safer to work with multiple environments in parallel without touching global configuration.

Usage Examples

1. Switching between clusters

Switch to the staging context:

kubech ctx staging

In another terminal, work with production:

kubech ctx prod

Now, the first tab interacts with the staging cluster, while the second one is connected to production - both are independent.

2. Working with namespaces

Set the namespace for the current session:

kubech ns monitoring

Check the current configuration:

kubech status

You can execute kubectl commands, and Kubech will automatically apply the correct namespace only for this shell session.

3. Shell integration

Kubech adds visual indicators to your prompt so you always know where you are:

[staging:monitoring] $

Installation

1. Via Homebrew (macOS/Linux)

brew install DevOpsHiveHQ/tap/kubech

2. From source

>git clone https://github.com/DevOpsHiveHQ/kubech.git
cd kubech
make install

3. Shell integration setup

Add to your ~/.bashrc or ~/.zshrc:

eval "$(kubech init)"

After restarting your terminal, Kubech will automatically track context and namespace for each session.

When Kubech Is Especially Useful

  • When managing multiple clusters at the same time (e.g., staging and production).
  • For DevOps engineers, administrators, and SREs who frequently switch between environments.
  • To avoid accidental mistakes caused by the global kubectl context.
  • When working in multi-window environments such as tmux, iTerm, VS Code Terminal, etc.

Why You Should Try Kubech

  • Safety: reduces the risk of performing operations in the wrong cluster.
  • Flexibility: allows you to work with multiple environments simultaneously.
  • Compatibility: supports all popular shells and plugins.
  • Simplicity: easy installation and familiar commands.

Frequently Asked Questions (FAQ)

  • Can I use Kubech together with kubectx and kubens?
    Yes, Kubech doesn’t conflict with them. It simply adds per-terminal context isolation.
  • Where does Kubech store its settings?
    In the ~/.kubech directory - it stores session and context data.
  • Does Kubech work with tmux and screen?
    Yes, each tmux pane or screen window has its own context.
  • Does Kubech support fish or PowerShell?
    Yes, integration is available for those shells as well.
  • Does Kubech modify the global kubeconfig?
    No, Kubech does not change your ~/.kube/config. All changes apply only within the current terminal session.
  • Can I use Kubech on servers?
    Yes, it’s cross-platform and works on Linux, macOS, and WSL.

Conclusion

Kubech is a lightweight and reliable way to manage multiple Kubernetes clusters simultaneously. It enhances safety, prevents context-related mistakes, and improves efficiency in complex infrastructures. If you often switch between environments, Kubech will become your essential helper.

Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.