This project is maintained by siggy

Kubernetes Context in iTerm2’s Status Bar

This guide demonstrates displaying the current Kubernetes context in iTerm2’s Status Bar.

Note: This requires iTerm2 3.3+.

Install iTerm2 Shell Integration

iTerm2 > Install Shell Integration

This will add a line to your .bash_profile :

test -e " ${ HOME } /.iterm2_shell_integration.bash" && source " ${ HOME } /.iterm2_shell_integration.bash"

Add the kubecontext user variable

Before .iterm2_shell_integration.bash is loaded, add this function:

function iterm2_print_user_vars () { iterm2_set_user_var kubecontext $( kubectl config current-context ) }

Add kubecontext Status Bar component