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
Disables interactive context/namespace selection with fzf when set to any value.
kubectx and kubens will present an interactive fuzzy-search menu. Set this variable to opt out of interactive mode:
Color Configuration
NO_COLOR
Disables color output when set to any value. Follows the NO_COLOR standard.
_KUBECTX_FORCE_COLOR
Forces color output even when stdout is not a terminal (internal use).
KUBECTX_CURRENT_FGCOLOR (Deprecated)
Customizes the foreground (text) color for the current context/namespace. Deprecated in Go implementation.
tput color codes:
KUBECTX_CURRENT_BGCOLOR (Deprecated)
Customizes the background color for the current context/namespace. Deprecated in Go implementation.
tput color codes:
Kubeconfig Location
KUBECONFIG
Specifies the path to your kubeconfig file.
kubectl and kubectx/kubens respect:
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
Enables verbose logging for debugging (internal use).
_MOCK_NAMESPACES
Used for testing purposes to mock namespace lists (internal use).
This is an internal testing variable and should not be used in production environments.