本文介绍了降级kubectl版本以匹配minikube k8s版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从k8s 1.5.2版开始了minikube,我想将我的kubectl降级到1.5.2.当前,当我运行kubectl version时,我得到:

I started minikube with k8s version 1.5.2 and I would like to downgrade my kubectl so that it is also 1.5.2. Currently when I run kubectl version I get:

Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.5", GitCommit:"17d7182a7ccbb167074be7a87f0a68bd00d58d97", GitTreeState:"clean", BuildDate:"2017-08-31T19:32:12Z", GoVersion:"go1.9", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.2", GitCommit:"08e099554f3c31f6e6f07b448ab3ed78d0520507", GitTreeState:"clean", BuildDate:"1970-01-01T00:00:00Z", GoVersion:"go1.7", Compiler:"gc", Platform:"linux/amd64"}

我想使用kubectl来获取PetSets,但是在以后的版本中,它已更新为StatefulSets,因此我不能在当前的kubectl版本中使用命令

I would like to use kubectl to fetch PetSets but in later versions this was updated to StatefulSets so I cannot use the commands with my current kubectl version

kubectl get petsets
the server doesn't have a resource type "petsets"

谢谢!

推荐答案

您可以下载以前的二进制版本并替换现有版本.

You can just download the previous version binary and replace the one you have now.

Linux:

curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.5.2/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

macOS:

curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.5.2/bin/darwin/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

Windows:

curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.5.2/bin/windows/amd64/kubectl.exe

并将其添加到PATH.

And add it to PATH.

如果不遵循此处其他操作系统的说明: https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-via-curl

If not follow instructions for other Operating Systems here: https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-via-curl

这篇关于降级kubectl版本以匹配minikube k8s版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 21:01