入口资源文件错误 AKS - spec.rules[0].http.paths[0].pathType:必需值:必须指定 pathType

Ingress Resource file error AKS - spec.rules[0].http.paths[0].pathType: Required value: pathType must be specified

我正在按照 MS 文档创建入口 NGINX 控制器

https://docs.microsoft.com/en-us/learn/modules/aks-workshop/07-deploy-ingress

但是下面的 yaml 文件给我错误:The Ingress "ratings-web-ingress" is invalid: spec.rules[0].http.paths[0].pathType: Required value: pathType must be specified

命令:kubectl apply --namespace ratingsapp -f ratings-web-ingress.yaml --validate=false

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ratings-web-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: frontend.20-83-140-186.nip.io # IMPORTANT: update <ingress ip> with the dashed public IP of your ingress, for example frontend.13-68-177-68.nip.io
    http:
      paths:
      - path: /
      pathType: Prefix
      backend:
      service:
      name: ratings-web
      port:
      number: 80

我尝试使用相同的代码重现创建入口 NGINX 控制器并得到相同的错误:

解决错误“spec.rules[0].http.paths[0].pathType: Required value: pathType must be specified" 在 pathType 之后替换 pathType: ImplementationSpecific,如下所示:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ratings-web-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: frontend.10.0.0.1.nip.io # IMPORTANT: update <ingress ip> with the dashed public IP of your ingress, for example frontend.13-68-177-68.nip.io
    http:
      paths:
      - backend:
          service:
            name: ratings-web
            port:
              number: 80
        path: /
        pathType: ImplementationSpecific

修改yaml文件后,成功创建ingress:

详情请参考下方link:

Lab10.1 - Error creating ingress rule: "pathType must be specified" — Linux Foundation Forums