LinuxCommandLibrary

kubie

Manage multiple Kubernetes contexts easily

TLDR

Display a selectable menu of contexts

$ kubie ctx
copy

Switch current shell to the given context
$ kubie ctx [context]
copy

Switch current shell to the given namespace
$ kubie ns [namespace]
copy

Switch current shell to the given context and namespace
$ kubie ctx [context] [[-n|--namespace]] [namespace]
copy

Execute a command in the given context and namespace, without spawning a shell
$ kubie exec [context] [namespace] [command]
copy

Check the Kubernetes configuration files for issues
$ kubie lint
copy

SYNOPSIS

kubie [OPTIONS] <SUBCOMMAND>
Common subcommands: ctx, ns, exec

PARAMETERS

-h, --help
    Print help information

-V, --version
    Print version information

-v, --verbose
    Increase verbosity (repeatable for more detail)

--kubeconfig <PATH>
    Path to kubeconfig file [env: KUBECONFIG]

DESCRIPTION

Kubie is a portable tool for managing Kubernetes clusters, contexts, and namespaces securely.

It addresses common pitfalls of tools like kubectx and kubens by spawning isolated child shells with environment variables set specifically for a chosen context and namespace. This prevents accidental operations on wrong clusters, as changes are scoped to the subshell and discarded on exit.

Key features include:
Context switching: kubie ctx <context>
Namespace switching: kubie ns <namespace>
Exec into pods: kubie exec <pod> with automatic context/ns inheritance
• Shell prompt integration for visual feedback
• Tab completion support for bash, zsh, fish

Kubie reads from standard kubeconfig files, supports multiple kubeconfigs, and is lightweight with no runtime dependencies beyond kubectl. Ideal for developers and admins juggling multiple clusters.

CAVEATS

Requires shell profile setup for full integration (e.g., alias kubectl='kubie kubectl'). Subshell model may feel unusual initially; not compatible with all shell plugins.

INSTALLATION

Via Cargo: cargo install kubie
Prebuilt binaries on GitHub releases; Homebrew: brew install kubie

SHELL SETUP

Add to .bashrc or equivalent:
alias k=kubie
complete -o default -F __start_kubie k

See kubie completion <shell>

HISTORY

Developed by Adrian Berger (misberner) starting 2020 as a safer alternative to kubectx/kubens. Open-source on GitHub (0.1.0 in Apr 2020); actively maintained with Rust rewrite for portability. Gained popularity for multi-cluster workflows.

SEE ALSO

kubectl(1), kubectx(1), kubens(1), k9s(1)

Copied to clipboard