<p>I'm trying to setup a ingress network for my Google GKE, I have tested locally on Minikube and its working as I expect.</p>
<p>When I hit the domain with the prefix /test-1 or /test-2 its sending me to the root of the my service /.</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: api-test-domain-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
  tls:
  - hosts:
      - api.test-domain.com
    secretName: tls-secret
  rules:
  - host: api.test-domain.com
    http:
      paths:
      - path: /test-1(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: test-1-port-forwarding
            port:
              number: 8080
      - path: /test-2(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: test-2-port-forwarding
            port:
              number: 8081
</code></pre>
<p>The issue is when I put it into my Kubernetes cluster on Google (GKE) then I get this error</p>
<blockquote>
<p>Translation failed: invalid ingress spec: failed to validate prefix
path /test-1(/|$)(.<em>) due to invalid wildcard; failed to validate
prefix path /test-2(/|$)(.</em>) due to invalid wildcard</p>
</blockquote>
<p>I have trying in hours to trying to get it to working and what's going on, whiteout any kind of result, so really hope some one here can explain about what I did wrong and what I shut change to resolved my problem.</p>

<p>GKE Built-in Ingress supports wildcard but with some <a href="https://cloud.google.com/kubernetes-engine/docs/concepts/ingress#multiple_backend_services" rel="nofollow noreferrer">conditions</a>. From the doc:</p>
<pre><code>The only supported wildcard character for the path field of an Ingress is the * character. The * character must follow a forward slash (/) and must be the last character in the pattern. For example, /*, /foo/*, and /foo/bar/* are valid patterns, but *, /foo/bar*, and /foo/*/bar are not.
</code></pre>
<p>If you want to use NGINX you will have to deploy it, GKE doesn't ship with NGINX out of the box. Keep in mind that this is something you will have to maintain and take care of yourself. It's a valid choice to make if the GKE default ingress doesn't support what you need to do (like headers re-write for example) but just be aware of the fact that it's an extra piece of software.</p>
