finds.dev← search

// the find

ahmetb/kubectx

★ 19,860 · Go · Apache-2.0 · updated Jun 2026

Faster way to switch between clusters and namespaces in kubectl

kubectx and kubens are CLI tools that make switching between Kubernetes contexts and namespaces faster than the native kubectl commands. They're a standard part of the toolkit for anyone managing more than one cluster or jumping between namespaces regularly. Nearly 20k stars; at this point it's infrastructure.

The fzf integration is the killer feature — fuzzy-search through your contexts interactively instead of typing exact names. The '-' shorthand for switching back to the previous context/namespace is small but saves real time. The read-only shell mode (kubectx -r) is genuinely useful for exploring prod without the paranoia. Test coverage is solid: unit tests on the kubeconfig manipulation layer plus bats integration tests against real kubeconfig files.

kubens tracks previous namespace via a statefile in ~/.kube, not in the kubeconfig itself — so if you're using multiple terminals, previous-namespace state is shared and confusing. The shell completion setup for zsh is still manual symlink work depending on your setup; the README lists six different paths and none of them obviously cover all cases. No support for KUBECONFIG environment variable pointing at multiple files (merged kubeconfigs) in all edge cases — the kubeconfig loader has known quirks here. The bash implementation was frozen in 2022 in favor of the Go rewrite, but the old shell scripts are still sitting in the repo root as the files 'kubectx' and 'kubens', which trips up users who install from source by cloning.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →