I am using GKE (Autopilot, version: v1.25.5-gke.2000) and replaced the "GCE" native load balancer with "ingress-nginx" (Helm version 4.5.0). In general, ingress is working as long I don't use the rewrite-target.
Here is my Ingress config:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-nginx
namespace: something
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
tls:
- secretName: ingress-ssl
hosts:
- host.example.com
rules:
- host: host.example.com
http:
paths:
- path: "/admin/portal(/|$)(.*)"
pathType: Prefix
backend:
service:
name: api-service
port:
name: http
- path: /
pathType: Prefix
backend:
service:
name: api-service
port:
name: http
By doing so I get this log message:
"successfully validated configuration, accepting" ingress="something/ingress-nginx"
followed by
ingress something/ingress-nginx contains invalid path /admin/portal(/|$)(.*)
What am I doing wrong? The non regex pattern works by calling /swagger/index.html but calling but host.example.com/admin/portal/swagger.index.html does not.
Today a new helm version 4.5.2 was released fixing the issue in helm chart 4.5.0
https://github.com/kubernetes/ingress-nginx/releases Revert Implement pathType validation (#9511) (#9607)
https://github.com/kubernetes/ingress-nginx/pull/9511 helm release 4.5.0 broke regex in path #9616