LinuxCommandLibrary

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.

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

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community