Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ahmetb/kubectx/llms.txt

Use this file to discover all available pages before exploring further.

Both kubectx and kubens can be configured through environment variables to customize their behavior, control interactive mode, and manage color output.

Interactive Mode

KUBECTX_IGNORE_FZF

KUBECTX_IGNORE_FZF
string
default:""
Disables interactive context/namespace selection with fzf when set to any value.
By default, if you have fzf installed, kubectx and kubens will present an interactive fuzzy-search menu. Set this variable to opt out of interactive mode:
export KUBECTX_IGNORE_FZF=1
If you want to keep fzf interactive mode enabled but need the default behavior for a specific command, you can pipe the output:
kubectx | cat

Color Configuration

NO_COLOR

NO_COLOR
string
default:""
Disables color output when set to any value. Follows the NO_COLOR standard.
To disable all colors in the output:
export NO_COLOR=1

_KUBECTX_FORCE_COLOR

_KUBECTX_FORCE_COLOR
string
default:""
Forces color output even when stdout is not a terminal (internal use).
This is an internal environment variable used by kubectx/kubens when running fzf interactive mode. It’s not intended for direct user configuration.

KUBECTX_CURRENT_FGCOLOR (Deprecated)

KUBECTX_CURRENT_FGCOLOR
string
default:"yellow"
Customizes the foreground (text) color for the current context/namespace. Deprecated in Go implementation.
This environment variable is deprecated in the Go implementation of kubectx/kubens (v0.9.0+). It only works with the legacy Bash-based implementation.
For the Bash implementation, you can customize the text color using tput color codes:
export KUBECTX_CURRENT_FGCOLOR=$(tput setaf 6) # blue text

KUBECTX_CURRENT_BGCOLOR (Deprecated)

KUBECTX_CURRENT_BGCOLOR
string
default:"dark background"
Customizes the background color for the current context/namespace. Deprecated in Go implementation.
This environment variable is deprecated in the Go implementation of kubectx/kubens (v0.9.0+). It only works with the legacy Bash-based implementation.
For the Bash implementation, you can customize the background color using tput color codes:
export KUBECTX_CURRENT_BGCOLOR=$(tput setab 7) # white background

Kubeconfig Location

KUBECONFIG

KUBECONFIG
string
default:"~/.kube/config"
Specifies the path to your kubeconfig file.
This is a standard Kubernetes environment variable that both kubectl and kubectx/kubens respect:
export KUBECONFIG=/path/to/your/kubeconfig
While kubectl supports multiple files separated by colons (e.g., file1:file2), kubectx/kubens currently only support a single kubeconfig file.

Internal/Testing Variables

DEBUG

DEBUG
string
default:""
Enables verbose logging for debugging (internal use).
This internal variable enables more detailed logging output:
export DEBUG=1
kubectx

_MOCK_NAMESPACES

_MOCK_NAMESPACES
string
default:""
Used for testing purposes to mock namespace lists (internal use).
This is an internal testing variable and should not be used in production environments.