Home

Awesome

kmux-status

tmux status-line plugin to render kube-context and pod-name indicators.

demo

Features

Installation

If you are using zsh and tmux with kubecontext rendered on your prompt, but you deal with one kube-context at a time accross terminals, while rotating contexts over time, then imo it makes sense to have the kubecontext indicated on tmux status-line rather than having it rendered across all your terminal prompts. Incase, if you use different contexts within the scope of different shells, then you need to tap into the shell env to extract the context(it makes more sense to have it rendered in your prompt itself for this scenario).

Requirements

Note: Please use this command to check whether tmux is able to find kubectl/pstree: tmux run-shell -b 'command -v {kubectl}/{pstree}'

Install via TPM

Add this line to your ~/.tmux.conf

set -g @plugin 'tardunge/kmux-status'

Reload configuration, then press prefix + I to install plugin.

Usage

For rendering the current kube-context:

# in .tmux.conf
set-option -g status-right '#{kcontext}'

For rendering the pod name in the current-pane:

# in .tmux.conf
set-option -g status-right '#{kpod}'

These (#{kcontext} and #{kpod}) are the two available formats supported now.

To see the full command which is being executed in the current pane, press prefix + G. You will be taken to copy mode to the generated output.

-+= 65725 manojbabu -zsh
 \--= 73635 manojbabu kubectl port-forward --namespace default stg-metabase 8080:3000

Useful to keep track of ssh-tunnels.

Customization

Here are available options with their default values:

# in .tmux.conf
set-option -g @kmux-kcontext-icon "⎈" # defaults to K8
set-option -g @kmux-kpod-exec-icon "E" # defaults to E
set-option -g @kmux-kpod-log-icon "L" # defaults to L
set-option -g @kmux-kpod-port-fw-icon "P" # defaults to P

License

MIT