Kubectl 无法在 HPA 上描述

Kubectl Unable to describe on HPA

当我尝试在 hpa 上描述时抛出以下错误:

kubectl describe hpa go-auth
Error from server (NotFound): the server could not find the requested resource

我的 kubectl 版本是:

Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:11:31Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"12+", GitVersion:"v1.12.7-gke.7", GitCommit:"b80664a77d3bce5b4701bc881d972b1a702290bf", GitTreeState:"clean", BuildDate:"2019-04-04T03:12:09Z", GoVersion:"go1.10.8b4", Compiler:"gc", Platform:"linux/amd64"}

提防kubectl version skew。 运行 kubectl v1.14 不支持 kube-apiserver v1.12

根据kubectl docs

You must use a kubectl version that is within one minor version difference of your cluster. For example, a v1.2 client should work with v1.1, v1.2, and v1.3 master. Using the latest version of kubectl helps avoid unforeseen issues.

使用 kubectl v1.12.x 再试一次,您可能会摆脱这个问题。另外,请查看 #568 issue (especially this 评论),它解决了您遇到的相同问题。

如果您想知道如何管理多个 kubectl 版本,我推荐阅读此书:Using different kubectl versions with multiple Kubernetes clusters