我正在跟踪MS文档来创建ingress控制器。
https://learn.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
发布于 2022-05-16 09:03:58
我尝试用相同的代码复制创建入口NGINX控制器,并得到了相同的错误。
要解决错误"spec.rules.http.paths.pathType:必需值: pathType必须指定“在pathType
后替换pathType
,如下所示:
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文件后,我成功地创建了入口:
有关更多细节,请参考下面的链接:
https://stackoverflow.com/questions/72243670
复制相似问题