Skip to content
Kubernetes Context in iTerm2's Status Bar
Branch: master
Clone or download
siggy add note around iterm2 3.3
Signed-off-by: Andrew Seigner <siggy@buoyant.io>
Latest commit 7ba0b38 May 8, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets css, better fonts May 7, 2019
README.md add note around iterm2 3.3 May 8, 2019
_config.yml update pages title May 7, 2019

README.md

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+.

iTerm Kube

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

  1. iTerm2 > Preferences > Profiles > Session > Configure Status Bar
  2. Drag a new Interpolated String component to Active Components.
  3. Select the new component and click Configure Component.
  4. Set String Value to \(user.kubecontext)
You can’t perform that action at this time.