CLI / Kubernetes
kubectx
A command-line utility for switching between Kubernetes contexts and namespaces quickly.
Problem it solves
Why it exists.
It reduces mistakes and friction when working across multiple Kubernetes clusters or namespaces.
Optimized for
Where it shines.
Engineers who regularly move between development, staging, and production contexts.
Use with care
Where not to use it.
Do not rely on context switching alone as a safety control; verify the active context before sensitive commands.
Components
What it is made of.
- Contexts
- Namespaces
- kubectl configuration
- Shell completion
Process
How it works.
- kubectx reads kubeconfig contexts
- The selected context is written as current
- kubens can select the namespace
- kubectl commands use the updated target