22.10.2025

Kubech - kubectl context management for each terminal

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

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

Why You Should Try Kubech

Frequently Asked Questions (FAQ)

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.