[root@mbs01 k8s]# kubectl apply -f ingress-tomcat6.yaml
error: error validating “ingress-tomcat6.yaml”: error validating data: [ValidationError(Ingress.spec.rules[0].http.paths[0]): unknown field “serviceName” in io.k8s.api.extensions.v1beta1.HTTPIngressPath, ValidationError(Ingress.spec.rules[0].http.paths[0]): unknown field “servicePort” in io.k8s.api.extensions.v1beta1.HTTPIngressPath, ValidationError(Ingress.spec.rules[0].http.paths[0]): missing required field “backend” in io.k8s.api.extensions.v1beta1.HTTPIngressPath]; if you choose to ignore these errors, turn validation off with --validate=false
[root@mbs01 k8s]# cat ingress-tomcat6.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: web
spec:
rules:

  • host: tomcat6.mbs.com
    http:
    paths:
    - backend:
    serviceName: tomcat6
    servicePort: 80
    [root@mbs01 k8s]# cat ingress-tomcat6.yaml
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
    name: web
    spec:
    rules:
  • host: tomcat6.mbs.com
    http:
    paths:
    - backend:
    serviceName: tomcat6
    servicePort: 80
    这个问题的出现在于配置中
    serviceName: tomcat6
    servicePort: 80
    前面删了一个空格导致验证失败了,如下图对比:
    修改前:
    在这里插入图片描述
    修改后:
    在这里插入图片描述
Logo

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

更多推荐