Kubernetes - 入口路径正则表达式 - 包含无效字符
Kubernetes - Ingress Path regex - contains a character that is not valid
我在使用正则表达式时遇到以下错误。我想根据查询字符串进行过滤以将流量发送到不同的端口。
controller.go:217] kubebuilder/controller "msg"="Reconciler error" "error"="failed to reconcile listeners due to failed to reconcile rules due to failed creating rule 1 on arn:aws:elasticloadbalancing:ap-south-1:1234:listener/app/51233e9-testwebdev-test-1eb8/1234 due to ValidationError: Condition value '/(action=.*\u0026uid.*test=[0-9]+)|test|status\u0026uid)' contains a character that is not valid\n\tstatus code: 400, request id: 664231b0-7c95-4ee6-a14b-fb83e9d7590a" "controller"="alb-ingress-controller" "request"={"Namespace":"test-web-dev","Name":"test-ingress-dev"
路径有如下所示的正则表达式
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/scheme: internet-facing
nginx.ingress.kubernetes.io/use-regex: "true"
....
paths:
- path: "/.*(action=.*&uid.*test=[0-9]+)|(test|status&uid)"
backend:
serviceName: httpd
servicePort: 1234
- path: /
backend:
serviceName: httpd
servicePort: 443
我看到你的清单,由于 kubernetes.io/ingress.class: alb
,你的 Ingress 配置为 AWS ALB 而不是 NGINX。因此,您应该配置 AWS 路径条件合规性,请参阅 Path Conditions 了解更多详细信息。据我所知,部分支持 AWS ALB 正则表达式,而不是完整的正则表达式。
A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.
1. A–Z, a–z, 0–9
2. _ - . $ / ~ " ' @ : +
3. & (using &)
4. * (matches 0 or more characters)
5. ? (matches exactly 1 character)
我在使用正则表达式时遇到以下错误。我想根据查询字符串进行过滤以将流量发送到不同的端口。
controller.go:217] kubebuilder/controller "msg"="Reconciler error" "error"="failed to reconcile listeners due to failed to reconcile rules due to failed creating rule 1 on arn:aws:elasticloadbalancing:ap-south-1:1234:listener/app/51233e9-testwebdev-test-1eb8/1234 due to ValidationError: Condition value '/(action=.*\u0026uid.*test=[0-9]+)|test|status\u0026uid)' contains a character that is not valid\n\tstatus code: 400, request id: 664231b0-7c95-4ee6-a14b-fb83e9d7590a" "controller"="alb-ingress-controller" "request"={"Namespace":"test-web-dev","Name":"test-ingress-dev"
路径有如下所示的正则表达式
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/scheme: internet-facing
nginx.ingress.kubernetes.io/use-regex: "true"
....
paths:
- path: "/.*(action=.*&uid.*test=[0-9]+)|(test|status&uid)"
backend:
serviceName: httpd
servicePort: 1234
- path: /
backend:
serviceName: httpd
servicePort: 443
我看到你的清单,由于 kubernetes.io/ingress.class: alb
,你的 Ingress 配置为 AWS ALB 而不是 NGINX。因此,您应该配置 AWS 路径条件合规性,请参阅 Path Conditions 了解更多详细信息。据我所知,部分支持 AWS ALB 正则表达式,而不是完整的正则表达式。
A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.
1. A–Z, a–z, 0–9
2. _ - . $ / ~ " ' @ : +
3. & (using &)
4. * (matches 0 or more characters)
5. ? (matches exactly 1 character)