LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

kubens

switches the default Kubernetes namespace

TLDR

List namespaces
$ kubens
copy
Switch namespace
$ kubens [namespace]
copy
Switch to previous
$ kubens -
copy
Show current namespace
$ kubens -c
copy

SYNOPSIS

kubens [options] [namespace]

DESCRIPTION

kubens is a utility for quickly switching the default Kubernetes namespace in the current context. It modifies the namespace field in your kubeconfig so that subsequent kubectl commands operate against the selected namespace without requiring the `-n` flag each time.The tool lists all available namespaces when called without arguments and supports interactive fuzzy selection through fzf integration. It can also toggle back to the previously active namespace using `-`. Designed as a companion to kubectx, kubens completes the workflow for navigating multi-cluster, multi-namespace Kubernetes environments efficiently.

PARAMETERS

NAMESPACE

Namespace to switch to.
-
Switch to previous namespace.
-c
Show current namespace.
--help
Display help information.

INSTALL

sudo apt install kubectx
copy
sudo pacman -S kubectx
copy
sudo apk add kubectx
copy
sudo zypper install kubectx
copy
brew install kubectx
copy
nix profile install nixpkgs#kubectx
copy

CAVEATS

Third-party tool. Modifies kubeconfig. Works with kubectx.

HISTORY

kubens was created by Ahmet Alp Balkan alongside kubectx for simplified Kubernetes namespace switching.

SEE ALSO

Copied to clipboard
Kai