伙计,在运行以下kubectl命令时:
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: openvpn-data-claim
namespace: openvpn
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
error: SchemaError(io.k8s.api.autoscaling.v1.Scale): invalid object doesn't have additional properties
kubectl版本
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:"15+", GitVersion:"v1.15.9-gke.24", GitCommit:"39e41a8d6b7221b901a95d3af358dea6994b4a40", GitTreeState:"clean", BuildDate:"2020-02-29T01:24:35Z", GoVersion:"go1.12.12b4", Compiler:"gc", Platform:"linux/amd64"}
答案 0 :(得分:2)
根据Kubernetes Version Skew Policy:
kubectl
在kube-apiserver
的一个次要版本(较旧或较新)中受支持。IF
kube-apiserver
位于 1.15 :kubectl
在 1.16 , 1.15 受支持strong>和 1.14 。注意:如果HA集群中的kube-apiserver实例之间存在版本偏斜,例如
kube-apiserver
实例位于 1.15 和 1.14 < / strong>,kubectl
将仅支持 1.15 和 1.14 ,因为任何其他版本都将不只是一个较小的版本。
即使运行较新的客户端版本也可能会给您带来一些问题
kubectl run
的默认行为是创建部署:❯ ./kubectl-110 run ubuntu --image=ubuntu
deployment.apps "ubuntu" created
kubectl run
是deprecated,除pod以外的所有生成器,这里是 kubectl 1.16 的示例:❯ ./kubectl-116 run ubuntu --image=ubuntu --dry-run
kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead.
deployment.apps/ubuntu created (dry run)
❯ ./kubectl-118 version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-16T11:56:40Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15+", GitVersion:"v1.15.9-gke.24", GitCommit:"39e41a8d6b7221b901a95d3af358dea6994b4a40", GitTreeState:"clean", BuildDate:"2020-02-29T01:24:35Z", GoVersion:"go1.12.12b4", Compiler:"gc", Platform:"linux/amd64"}
$ kubectl run --generator=deployment/apps.v1 ubuntu --image=ubuntu --dry-run=client
Flag --generator has been deprecated, has no effect and will be removed in the future.
pod/ubuntu created (dry run)
它忽略了标志,只创建了一个pod。正如我们在测试中看到的那样,该标志受kubernetes 1.15支持,但是kubectl 1.18进行了重大更改,不允许运行它。
答案 1 :(得分:1)
通过使用asdf升级本地kubectl即可轻松解决。
asdf install kubectl 1.15.9