nginx.ingress.kubernetes.io/use-regex not working as expected

4/26/2019

I have the following Ingress section:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: tb-ingress
  namespace: thingsboard
  annotations:
    nginx.ingress.kubernetes.io/use-regex: "true"
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
spec:
  rules:
  - http:
      paths:
      - path: /api/v1/.*
        backend:
          serviceName: tb-http-transport
          servicePort: http
      - path: /static/rulenode/.*
        backend:
          serviceName: tb-node
          servicePort: http
      - path: /static/.*
        backend:
          serviceName: tb-web-ui
          servicePort: http
      - path: /index.html.*
        backend:
          serviceName: tb-web-ui
          servicePort: http
      - path: /
        backend:
          serviceName: tb-web-ui
          servicePort: http

However, this does not seem to be working. GKE gives me an

Invalid path pattern, invalid

error.

-- ThomasVdBerge
google-kubernetes-engine
kubernetes

1 Answer

4/26/2019

It seems to me, you forgot to specify kubernetes.io/ingress.class: "nginx" annotation. If you don't specify any kubernetes.io/ingress.class - GKE will consider using its own ingress which does not support regexps.

-- Vasily Angapov
Source: StackOverflow