CLI tools for fast context switching between Kubernetes clusters and namespaces with interactive selection.
kubectx and kubens are command-line utilities that accelerate Kubernetes cluster and namespace management by providing fast switching capabilities for kubectl contexts. kubectx enables switching between different Kubernetes clusters configured in kubeconfig, while kubens handles namespace switching within the current cluster context.
The tools support several workflow enhancements including previous context/namespace switching with -, context renaming, and isolated shell sessions with read-only or single-context modes. When fzf is installed, both tools provide interactive fuzzy-search menus for selecting contexts and namespaces. Tab completion is available for bash, zsh, and fish shells.
These utilities target Kubernetes administrators, DevOps engineers, and developers who regularly work across multiple clusters or namespaces. The tools integrate with kubectl's existing configuration and can be installed as kubectl plugins via Krew, making them suitable for teams managing complex Kubernetes environments where frequent context switching is required.
# via Homebrew
brew install kubectx
# via apt
sudo apt install kubectx
# via Krew
kubectl krew install ctx && kubectl krew install ns


