← 返回命令列表

Linux command

kubens 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

List namespaces

kubens

Switch namespace

kubens [namespace]

Switch to previous

kubens -

Show current namespace

kubens -c

说明

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.

参数

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

FAQ

What is the kubens command used for?

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.

How do I run a basic kubens example?

Run `kubens` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does - do in kubens?

Switch to previous namespace.