报错类型:

[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:

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐