Skip to content

glemsom/shell-ctx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shell-ctx

Kubernetes context switcher for shells.
With shell-ctx each shell will operate in its own isolated Kubernetes context.
Switching between contexts is done by invoking kubectl shell-ctx in your current shell.

Supported shells

Bash, Zsh and Fish

Installation

Krew

kubectl krew install shell-ctx

Manual

sudo curl https://raw.githubusercontent.com/glemsom/shell-ctx/main/kubectl-shell_ctx -o /usr/local/bin/kubectl-shell_ctx
sudo chmod +x /usr/local/bin/kubectl-shell_ctx

Dependencies

For this plugin to operate the following dependencies are required:

  • awk
  • sed
  • fzf
  • kubectl

Demo install

Install

Setup

If you are setting a custom KUBECONFIG you need to load the shell hook AFTER your KUBECONFIG variable is set

For BASH, append the following to your ~/.bashrc somewhere after your KUBECONFIG variable
eval "$(kubectl-shell_ctx hook bash)"

For ZSH, append the following to your ~/.zshrc somewhere after your KUBECONFIG variable
eval "$(kubectl-shell_ctx hook zsh)"

For FISH, append the following to your ~/.config/fish/config.fish somewhere after your KUBECONFIG variable
kubectl-shell_ctx hook fish | source

Usage

kubectl shell-ctx Select context; Use arrow-keys or start typing to search
kubectl shell-ctx clone Clone context; Use arrow-keys or start typing to search
kubectl shell-ctx <context> Switch directly to context

About

Kubernetes context switcher for shells

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages