Mac Helm client 多版本安装

本机tiller版本和远程k8s集群内的tiller版本不一致,想通过本机的helm client操作时就会报错,e.g. Error: incompatible versions client[v2.13.0] server[v2.11.0]
这就需要本机安装多版本的客户端。

参考 https://stackoverflow.com/questions/50701224/helm-incompatible-versions-between-client-and-server 大概步骤为:

  • Look on Github for the correct kubernetes-helm.rb file for the version you want (2.9.1 in my case): https://github.com/Homebrew/homebrew-core/search?q=kubernetes-helm&type=Commits
  • Click the commit hash (78d6425 in my case)
  • Click the "View" button to see the whole file
  • Click the "Raw" button
  • And copy the url: https://raw.githubusercontent.com/Homebrew/homebrew-core/78d64252f30a12b6f4b3ce29686ab5e262eea812/Formula/kubernetes-helm.rb

参考文章执行命令如下:

$ brew unlink kubernetes-helm
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/78d64252f30a12b6f4b3ce29686ab5e262eea812/Formula/kubernetes-helm.rb
$ brew switch kubernetes-helm 2.9.1

笔者使用brew版本如下,在本机已安装2.12.3的情况下,并不需要执行 brew unlink kubernetes-helm

brew -v
Homebrew 1.7.1
Homebrew/homebrew-core (git revision d08e4; last commit 2019-07-15)

执行情况如下:

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/7c5ab2af66f83f767db328838424b1f379bd30d4/Formula/kubernetes-helm.rb
Updating Homebrew...
Fast-forwarded master to origin/master.
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
.......
==> Updated Formulae
.......
==> Renamed Formulae
.......
==> Deleted Formulae
.......
######################################################################## 100.0%
Warning: kubernetes-helm 2.11.0 is already installed
The currently linked version is 2.12.3
You can use `brew switch kubernetes-helm 2.11.0` to link this version.

应该是brew新版本优化了对switch的支持,完美切换多版本。

你可能感兴趣的:(Mac Helm client 多版本安装)