Skip to content

Verify expected cluster before running Kubernetes commands

License

Notifications You must be signed in to change notification settings

djmarkoz/kubesafe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kubesafe

Verify expected cluster before running Kubernetes commands to prevent accidental changes to the wrong cluster.

Install

MacOS

Homebrew (recommended)

brew tap djmarkoz/djmarkoz
brew install kubesafe

MacOS / Linux

Go get

go get -u github.com/djmarkoz/kubesafe

Usage

kubesafe
Verify expected cluster before running Kubernetes commands

Usage:
  kubesafe [command]

Available Commands:
  explain     Explain which directory expects which cluster
  get         Returns the currently expected cluster
  help        Help about any command
  set         Create a '.kubesafe-expected-cluster' file in the current directory specifying the currently active cluster
  unset       Remove the '.kubesafe-expected-cluster' file in the current directory
  verify      Verify if the current cluster is the expected cluster and optionally run a command

Useful aliases

alias ks='kubesafe'
alias kss='kubesafe set'
alias ksu='kubesafe unset'
alias ksg='kubesafe get'
alias kse='kubesafe explain'
alias ksv='kubesafe verify'

# wrap 'kubectl' and 'helm' commands with 'kubesafe'
alias kubectl='kubesafe verify -- \kubectl'
alias helm='kubesafe verify -- \helm'