Install several versions of KOPS via Homebrew
When there are multiple Kubernetes clusters created using KOPS, there is a need to keep multiple versions of KOPS to manage different clusters and/or environments. I use MacOS and Homebrew for this purposes and below are some notes about installaton process.
As the first step we clone Homebrew repository:
git clone [email protected]:Homebrew/homebrew-core.git
Switch to the repository directory, check git log history and find SHA hash of a version we would like to install:
git log master -- Formula/kops.rb
You’ll see an output like below:
git log master -- Formula/kops.rb
commit ad99d239dbdf08022296fd89b38675aef0601aa2
Author: William Ma <[email protected]>
Date: Thu Jul 2 11:49:06 2020 -0400
kops: add license
commit 146785591dc25cafffc7ea177aed1f20aadd22e4
Author: BrewTestBot <[email protected]>
Date: Mon Jul 6 08:08:29 2020 +0000
kops: update 1.17.1 bottle.
commit 529f81ea23925d7ed4fd2da4210e18b91d90a097
Author: Caleb Xu <[email protected]>
Date: Mon Jul 6 01:29:48 2020 -0400
kops 1.17.1
Closes #57534.
Signed-off-by: Sean Molenaar <[email protected]>
Signed-off-by: BrewTestBot <[email protected]>
commit f6b1352c077e71e5964263edf73d165d8397dd71
Author: BrewTestBot <[email protected]>
Date: Sat Jul 4 23:10:21 2020 +0000
kops: update 1.17.0 bottle.
I interested into version 1.17.0, so I copy commit SHA hash: f6b1352c077e71e5964263edf73d165d8397dd71
.
To allow upgrades for our formula:
brew unpin kops
and remove it from from /usr/local
brew unlink kops
At this point we’re safe to install required version (Note: you should replace commit SHA hash with required in the URI):
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f6b1352c077e71e5964263edf73d165d8397dd71/Formula/kops.rb
Once it’s installed we can check a version and use it:
kops version
Version 1.17.0
In case if we want to keep this version and don’t upgrade we should pin
it:
brew pin kops
To switch version of kops use:
brew switch kops 1.17.1