A command-line tool for managing Kubernetes contexts.
khelp simplifies working with kubeconfig files by providing intuitive commands to list, switch, import, export, and manage Kubernetes contexts.
Linux / macOS:
curl -fsSL https://files.stvnksslr.com/khelp/install.sh | bashWindows (PowerShell):
irm https://files.stvnksslr.com/khelp/install.ps1 | iexgit clone https://github.com/stvnksslr/khelp.git
cd khelp
cargo build --releaseThe binary will be available at target/release/khelp.
cargo build --release --features self_update- Linux
- macOS
- Windows
| Command | Description |
|---|---|
list |
List all available contexts (current context marked with *) |
current |
Display details about the active context |
switch [name] |
Switch to a different context (interactive if no name given) |
edit [name] |
Edit a context configuration in your default editor |
export [names...] |
Export one or more contexts to stdout in YAML format |
delete [name] |
Delete a context and its orphaned cluster/user (supports --force) |
cleanup |
Remove orphaned clusters and users not referenced by any context |
rename <old> <new> |
Rename an existing context |
add <file> |
Import contexts from an external kubeconfig file |
completions [shell] |
Generate shell completions (bash, zsh, fish, powershell, elvish) |
update |
Check for and apply updates (requires self_update feature) |
List all contexts:
khelp listSwitch to a context interactively:
khelp switchSwitch to a specific context:
khelp switch my-clusterImport contexts from another kubeconfig:
khelp add ~/Downloads/new-cluster.yamlImport with automatic rename for conflicts:
khelp add ~/Downloads/cluster.yaml --renameExport a context for backup:
khelp export my-cluster > my-cluster-backup.yamlExport multiple contexts at once:
khelp export dev-cluster staging-cluster prod-cluster > all-clusters.yamlDelete a context (automatically removes orphaned cluster/user):
khelp delete old-clusterClean up any orphaned clusters and users:
khelp cleanupInstall shell completions:
khelp completions --installGenerate completions for your shell:
# Bash
khelp completions bash >> ~/.bash_completion.d/khelp
# Zsh
khelp completions zsh > ~/.zfunc/_khelp
# Fish
khelp completions fish > ~/.config/fish/completions/khelp.fish
# PowerShell (add to $PROFILE)
khelp completions powershell >> $PROFILEOr use automatic installation:
khelp completions --installMIT