About this project
kubectx and kubens are two command-line utilities that make working with kubectl faster and more convenient. kubectx switches between contexts (clusters) defined in your kubeconfig, while kubens changes the active Kubernetes namespace for kubectl.
Key capabilities described in the README:
- kubectx switches to a named context, returns to the previous context with `-`, renames contexts, and can launch an isolated shell containing only a single context (`-s`) or a read-only shell that blocks write operations (`-r`).
- kubens changes the active namespace, supports going back to the previous namespace with `-`, and can set a namespace even if it does not exist using the `-f` flag.
- Both tools offer Tab completion for bash, zsh, and fish, helping with long context names.
- If fzf is installed, both commands present an interactive fuzzy-search menu for selecting contexts or namespaces. This can be disabled with the KUBECTX_IGNORE_FZF environment variable.
- Output colors for the current context/namespace can be customized via KUBECTX_CURRENT_FGCOLOR and KUBECTX_CURRENT_BGCOLOR, and colors can be disabled with NO_COLOR.
Installation is available through many package managers, including Homebrew, MacPorts, apt, pacman, Chocolatey, Scoop, winget, and Krew (as kubectl plugins ctx and ns), or by downloading release binaries. The README also documents shell completion setup for zsh, bash, and fish, and suggests pairing the tools with fzf and kube-ps1 for prompt integration.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.