k8s创建Deployment报错:missing required field “selector“ in io.k8s.api.apps.v1.DeploymentSpec
报错类型:[root@master ~]# kubectl create -f lzb-test.yamlerror: error validating "lzb-test.yaml": error validating data: ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.a
·
报错类型:
[root@master ~]# kubectl create -f lzb-test.yaml
error: error validating "lzb-test.yaml": error validating data: ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec; if you choose to ignore these errors, turn validation off with --validate=false
解决:
同样是修改yaml文件
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kube100-site
spec:
replicas: 2
template:
metadata:
labels:
app: web
修改为
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kube100-site
spec:
replicas: 2
selector:
matchLabels:
app: kube100-site
template:
更多推荐
已为社区贡献8条内容
所有评论(0)