Skip to content

Kubernetes Context in your Tmux Status Lines

Notifications You must be signed in to change notification settings

kr3cj/tmux-kube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tmux Kubernetes Context

Shows your current Kubernetes context and namespace

Installation

Dependencies

This assumes that you have kubectl installed and have at least one context in your ~/.kube/config or wherever your KUBECONFIG points.

jq is required for parsing the output.

Installation with Tmux Plugin Manager (recommended)

Add plugin to the list of TPM plugins in .tmux.conf set -g @plugin 'sudermanjr/tmux-kube'

Hit prefix + I to fetch the plugin and source it.

If format strings are added to status-right or status-left they should be visible, assuming you have the necessary dependencies.

Manual Installation

Clone the repo:

    $ git clone https://github.com/sudermanjr/tmux-kube ~/clone/path

Add this line to ~/.tmux.conf

    run-shell ~/clone/path

Reload TMUX environment:

    $ tmux source ~/.tmux.conf

If format strings are added to status-right or status-left they should be visible, assuming you have the necessary dependencies.

Usage

Add #{kube_cluster}, or #{kube_namespace} to your status line to get current context info.

Basic Example:

    set -g status-right '#{kube_cluster}:#{kube_namespace}'

You can set which clusters are prod/stage/dev inside your tmux.conf, and use that to colorize the output.

Example:

    set -g @kube_prod_clusters 'whatsit'
    set -g @kube_stage_clusters 'whosit'
    set -g @kube_dev_clusters  'thatsit'

    set -g status-left '#{kube_fg} K8S-#{kube_cluster}:#{kube_namespace}'

Changing Colors:

    set -g @kube_color_dev '#[fg=colour32]'
    set -g @kube_color_stage '#[fg=colour221]'
    set -g @kube_color_prod '#[fg=colour196]'

About

Kubernetes Context in your Tmux Status Lines

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages