Tmux plugin that displaying current Kubernetes context, cluster, namespace and user.
Status line with tmux-current-pane-hostname on the left side, tmux-kubectx and tmux-mode-indicator on the right side
Place defined variable in status-left
, status-right
or pane-border-format
:
#{kubectx_context}
will be the current context name, fetched bykubectl config current-context
#{kubectx_cluster}
will be the cluster name, defined in current context#{kubectx_namespace}
will be the namespace, defined in current context#{kubectx_user}
will be the user name, defined in current context#{kubectx_full}
will be the full info (ctx name, cluster name, user name, namespace) about current context (see also @kubectx-format)
set -g status-right '#[bg=blue]#{kubectx_context}:#[bg=red]#{kubectx_namespace}#[default]'
With Tmux Plugin Manager (recommended)
Add plugin to the list of TPM plugins in .tmux.conf
:
set -g @plugin "tony-sol/tmux-kubectx"
Hit prefix + I
to fetch the plugin and source it.
Clone the repo:
$ git clone https://github.com/tony-sol/tmux-kubectx ~/clone/path
Add this line to the bottom of .tmux.conf
:
run-shell ~/clone/path/kubectx.tmux
Reload TMUX environment:
# type this in terminal
$ tmux source-file ~/.tmux.conf
Template of #{kubectx_full}
result. May contain following variables:
%{context}
- context name%{cluster}
- cluster name%{namespace}
- namespace%{user}
- user name
set -g @kubectx-format "%{context}/%{user}@%{cluster}:%{namespace}"