<p>I have two apps on a Kubernetes cluster which need to be exposed. One is a OAuth2 based authenticator, the other is the client app using it.
I would like to have the client app on <code>test.mydomain.com</code> and the authenticator on <code>test.mydomain.com/auth</code></p>
<p>I tried building the following ingress in Kubernetes:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  namespace: default
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/backend-protocol: &quot;HTTP&quot;
    nginx.ingress.kubernetes.io/proxy-body-size: &quot;20m&quot;
spec:
  rules:
    - http:
        paths:
        - path: /auth
          backend:
            serviceName: authenticator-service
            servicePort: 8080
        - path: /
          backend:
            serviceName: app-service
            servicePort: 8080
</code></pre>
<p>For some reason, I can't get it to work, and whenever I try and hit <code>test.mydomain.com/auth</code> I end up hitting the main <code>app-service</code>. Am I doing something completely wrong? Is what I want to do even possible?</p>

Nick Melis
<p>Try this -</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
    kubernetes.io/ingress.class: nginx
  name: my-ingress
spec:
  rules:
  - host: test.mydomain.com
    http:
      paths:
      - path: /(.*)
        backend:
          serviceName: app-service
          servicePort: 8080
      - path: /auth/(.*)
        backend: 
          serviceName: authenticator-service
          servicePort: 8080
</code></pre>
