降级kubectl版本以匹配minikube k8s版本

问题描述 投票:9回答:1

我用k8s版本1.5.2启动了minikube,我想降级我的kubectl,使它也是1.5.2。目前,当我运行kubectl version时,我得到:

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版本的命令

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

谢谢!

kubernetes kubectl minikube
1个回答
13
投票

您只需下载以前版本的二进制文件并替换现有版本。

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

视窗:

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

并将其添加到PATH。

如果没有按照其他操作系统的说明进行操作:https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-via-curl

© www.soinside.com 2019 - 2024. All rights reserved.