Skip to content

MichaelSp/kswitch

 
 

Repository files navigation

kswitch banner

kswitch

Latest GitHub release Build Go Report Card License

The kubectx for operators. Fuzzy search across 14+ cloud providers, per-terminal context isolation, history navigation, and extensible hooks — built for large-scale Kubernetes.

Highlights

  • Unified fuzzy search — one search over EKS, AKS, GKE, Gardener, Vault, filesystem, and more
  • Terminal isolation — each window targets a different cluster; the original kubeconfig is never modified
  • History — every {context, namespace} tuple recorded; jump back with switch . or switch -
  • Context aliases — human-friendly names for cryptic generated context names
  • Search index cache — instant results across massive directories or slow remote stores
  • Hooks — run arbitrary executables before search to sync, refresh, or rotate credentials
  • Drop-in replacement for kubectx — set alias kubectx=switch and keep your workflow

Demo

kswitch context switch demo kswitch namespace switch demo

Install

macOS

Step 1 — Install the binary (pick one):

# Homebrew (recommended)
brew tap MichaelSp/kswitch
brew trust --cask michaelsp/kswitch/kubectl-switch
brew install kubectl-switch
# Direct download
curl -L -o /usr/local/bin/kubectl-switch \
  https://github.com/MichaelSp/kswitch/releases/latest/download/kubectl-switch_darwin_amd64
chmod +x /usr/local/bin/kubectl-switch

Step 2 — Wire up the shell function (pick one):

# zsh
echo 'source <(kubectl-switch init zsh)' >> ~/.zshrc && source ~/.zshrc
# bash
echo 'source <(kubectl-switch init bash)' >> ~/.bashrc && source ~/.bashrc

Linux

Step 1 — Install the binary:

curl -L -o /usr/local/bin/kubectl-switch \
  https://github.com/MichaelSp/kswitch/releases/latest/download/kubectl-switch_linux_amd64
chmod +x /usr/local/bin/kubectl-switch

Step 2 — Wire up the shell function (pick one):

# bash
echo 'source <(kubectl-switch init bash)' >> ~/.bashrc && source ~/.bashrc
# zsh
echo 'source <(kubectl-switch init zsh)' >> ~/.zshrc && source ~/.zshrc

Windows

Step 1 — Install the binary: Download kubectl-switch_windows_amd64.exe from the releases page, rename it to kubectl-switch.exe, and place it in your PATH.

Step 2 — Wire up the shell function:

kubectl-switch init powershell >> $PROFILE
. $PROFILE

Then type switch (bash/zsh) or kubectl-switch (fish/PowerShell) to start.

Documentation

Full documentation is available at MichaelSp.github.io/kswitch:

About

The kubectx for operators.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Go 92.6%
  • CSS 3.1%
  • MDX 1.3%
  • Makefile 1.0%
  • Shell 0.8%
  • JavaScript 0.5%
  • Other 0.7%