Kubernetes 创建部署意外 SchemaError [英] Kubernetes create deployment unexpected SchemaError
问题描述
我正在关注那个教程 (https://www.baeldung.com/spring-boot-minikube)我想在 yaml 文件(simple-crud-dpl.yaml)中创建 Kubernetes 部署:
I'm following that tutorial (https://www.baeldung.com/spring-boot-minikube) I want to create Kubernetes deployment in yaml file (simple-crud-dpl.yaml):
apiVersion: apps/v1
kind: Deployment
metadata:
name: simple-crud
spec:
selector:
matchLabels:
app: simple-crud
replicas: 3
template:
metadata:
labels:
app: simple-crud
spec:
containers:
- name: simple-crud
image: simple-crud:latest
imagePullPolicy: Never
ports:
- containerPort: 8080
但是当我运行 kubectl create -f simple-crud-dpl.yaml
我得到:error: SchemaError(io.k8s.api.autoscaling.v2beta2.MetricTarget): invalid object does not have additional properties
but when I run kubectl create -f simple-crud-dpl.yaml
i got:
error: SchemaError(io.k8s.api.autoscaling.v2beta2.MetricTarget): invalid object doesn't have additional properties
我使用的是最新版本的 kubectl:
I'm using the newest version of kubectl:
kubectl version
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:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:45:25Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
我也在本地使用 minikube,如教程中所述.一切都在工作,直到部署和服务.我做不到.
I'm also using minikube locally as it's described in tutorial. Everything is working till deployment and service. I'm not able to do it.
推荐答案
使用 brew 安装 kubectl 后,您应该运行:
After installing kubectl with brew you should run:
rm/usr/local/bin/kubectl
brew link --overwrite kubernetes-cli
也可以选择:
brew link --overwrite --dry-run kubernetes-cli
.
这篇关于Kubernetes 创建部署意外 SchemaError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!