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

use*_*285 0 nginx azure azure-aks

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

https://learn.microsoft.com/en-us/learn/modules/aks-workshop/07-deploy-ingress
Run Code Online (Sandbox Code Playgroud)

但下面的 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
Run Code Online (Sandbox Code Playgroud)

Ruk*_*ini 5

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

\n

图片1

\n

要解决错误“ spec.rules[0].http.paths[0].pathType:必需值:必须指定pathType ”,请替换pathType: ImplementationSpecific如下pathType所示:

\n
apiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  name: ratings-web-ingress\n  annotations:\n    kubernetes.io/ingress.class: nginx\nspec:\n  rules:\n  - 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\n    http:\n      paths:\n      - backend:\n          service:\n            name: ratings-web\n            port:\n              number: 80\n        path: /\n        pathType: ImplementationSpecific\n
Run Code Online (Sandbox Code Playgroud)\n

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

\n

图片2

\n

更详细的内容请参考以下链接:

\n

Lab10.1 - 创建入口规则时出错:“必须指定路径类型”\xe2\x80\x94 Linux 基金会论坛

\n