Kubernetes context-switching CLI for listing, selecting, renaming, deleting, and changing the active `kubectl` context.
$brew install kubectx
AI Analysis
kubectx is a small Kubernetes workflow CLI for changing the active kubectl context without repetitive kubectl config commands. It also lets you inspect, rename, delete, and unset context entries in kubeconfig.
What It Enables
- List available kubeconfig contexts and print the current one before running cluster-specific commands.
- Switch to another context, or jump back to the previous one, by updating the active
kubectlcontext. - Rename, delete, or unset context entries when cleaning up kubeconfig state across many clusters.
Agent Fit
- Useful as a thin shell primitive because the normal commands are short, non-interactive, and return clear success or failure states.
- Automation fit is limited by plain text output and global kubeconfig mutation, so agents need follow-up
kubectlchecks to verify state. - Optional
fzfselection helps humans, but unattended workflows should stick to explicit context names and--currentreads.
Caveats
- It manages kubeconfig context state only; namespace switching lives in the companion
kubenscommand. - There is no JSON or dry-run mode, so scripts must parse simple text or inspect kubeconfig separately.