Kubie Instead of kubectx and kubens: Per-Terminal Isolated Kubernetes Contexts and Bulk kubie execNote · digest for December 3
Matte clay sculpture: three isolated terminal capsules holding independent Kubernetes clusters so switching in one tab never affects the others.
Note3 sections≈ 4 min

Kubie Instead of kubectx and kubens: Per-Terminal Isolated Kubernetes Contexts and Bulk kubie exec

You open two terminal tabs: in the first you watch a rollout on prod-eu, and in the second you run kubectx staging-eu to inspect a test pod. You flip back to tab one, run kubectl delete pod, and wipe the wrong cluster. The culprit is your shared ~/.kube/config: kubectl and kubectx overwrite current-context globally, mutating every open tab and tmux pane at once.

Kubie is a Rust CLI (2.7k stars, Zlib license) that isolates Kubernetes context per terminal.

A separate config in every tab

A regular kubeconfig is a YAML file storing cluster addresses, credentials, and contexts. Kubie never edits it. When you run kubie ctx, it builds a temporary kubie-config*.yaml with just that one context, writes kubie-session*.json, and launches a subshell (zsh, bash, fish, dash, or xonsh) with KUBECONFIG pointed at the temp file plus KUBIE_ACTIVE=1 and KUBIE_DEPTH:

# Tab 1: isolated subshell for prod
kubie ctx prod-eu -n kube-system
kubectl get pods

# Tab 2: independent staging and namespace switch
kubie ctx staging-eu
kubie ns payments

# Jump back to previous context or exit the session
kubie ctx -
exit

Tabs physically cannot see each other's switches. Hit exit or Ctrl+D, and the subshell closes while the temp config cleans itself up—making it much harder to leave a live prod session sitting in a background tab. Running kubie ctx again inside a session switches in place, while -r nests a new subshell (check depth with kubie info depth).

Split configs, kubie exec, and kubie lint

Keeping dozens of clusters in one file gets messy, so Kubie reads split YAML files using glob patterns in ~/.kube/kubie.yaml (edit via kubie edit-config):

configs:
  # Where to discover kubeconfig files
  include:
    - ~/.kube/config
    - ~/.kube/configs/*.yaml
    - ~/.kube/kubie/*.yaml
  exclude:
    - ~/.kube/kubie.yaml

prompt:
  # Set true if Starship or p10k already renders the context
  disable: false
  show_depth: true

behavior:
  # Set false if you lack RBAC rights to list namespaces
  validate_namespaces: true
  print_context_in_exec: auto
  allow_multiple_context_patterns: false

Two common gotchas live here. First, duplicate prompts: Kubie adds the cluster name to your shell prompt by default, like kube-ps1. If you already use Starship, Oh My Zsh, or Powerlevel10k, set prompt.disable: true—those prompts pick up $KUBECONFIG automatically. Second, RBAC permissions: with validate_namespaces: true, switching namespaces runs kubectl get namespaces. If you lack list permissions, kubie ns fails—set it to false (or partial for fuzzy matching).

Kubie also replaces ad-hoc bash loops with built-in bulk execution and config linting:

# Run across all prod-* contexts, stopping on first error (-e)
kubie exec 'prod-*' kube-system -e -- kubectl get pods

# Check all kubeconfig files for broken refs and duplicates
kubie lint

kubie exec runs without spawning a subshell and supports wildcards like prod-*. Putting -- before kubectl stops Kubie from swallowing flags like -l or -o json, and print_context_in_exec: auto hides CONTEXT => ... headers when piping to jq or grep. kubie lint flags orphaned clusters/users, duplicate entries, broken references, and colliding context names.

Installation, limits, and status after issue #385

Kubie ships as a single binary via brew install kubie, pacman -S kubie, cargo install kubie, Nix, MacPorts, or GitHub Releases. Enable shell completion with source <(kubie generate-completion) in ~/.zshrc or ~/.bashrc.

Two limits to note: there is no native Windows build (WSL only), and cd or local env vars set inside kubie ctx disappear on exit. If you pull hundreds of clusters from Vault or dislike nested subshells, consider kubeswitch in Go, which updates $KUBECONFIG in your current shell.

Don't let the README banner on issue #385 scare you off. In January 2026, original author sbstp noted he no longer used Kubernetes daily, and on February 21 transferred the repo to kubie-org with three maintainers (@pasteley, @TyBrown, @lotheac), two-approval branch protection on master, and CI. They have already shipped v0.27.0 (remembering the previous context for kubie ctx - and skim options) and v0.28.0 in May 2026 with kubectl error fixes, skim v3.3, and an EDITOR fix. The roadmap is conservative—don't expect Vault integration—but bugs and dependencies are actively maintained.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 4