joephon / blog

极简博客
3 stars 2 forks source link

How to fix the problem when local kubernetes-helm version dosent match server side's #19

Open joephon opened 4 years ago

joephon commented 4 years ago

Situation

If you are trying to install some chart and some error show up like below

Client: &version.Version{SemVer:"v2.16.1", GitCommit:"bbdfe5e7803a12bbdf97e94cd847859890cf4050", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.13.1", GitCommit:"618447cbf203d147601b4b9bd7f8c37a5d39fbb4", GitTreeState:"clean"}

That means your local helm version is different with server side's

Then you will need this post

Step 1 unlink current version

brew unlink kubernetes-helm

Step 2 pick up the target version's commit hash on github

visit this link and try to find out your target version such as :2.13.1 etc etc

And then paste the target hash instead of this link's hash part

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/[your target hash]/Formula/kubernetes-helm.rb

Step 3 swith version

brew switch kubernetes-helm [your target version]

Or you can do it in that way

Download your desired version

kubernetes-cli version issue

If you still get stuck in some error like below, then you might need that solution below

error: SchemaError(io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceSubresources): invalid object doesn't have additional properties

Step 4 check out your kubectl version

kubectl version

Something might look like this

Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:38:32Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.2", GitCommit:"c97fe5036ef3df2967d086711e6c0c405941e14b", GitTreeState:"clean", BuildDate:"2019-10-15T19:09:08Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}

Step 5 fix problem

rm /usr/local/bin/kubectl
brew link --overwrite kubernetes-cli

Optional sh

brew link --overwrite --dry-run kubernetes-cli

Bingo!