<p>I have the following ingress config:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /
        pathType: Exact
        backend:
          serviceName: web-service
          servicePort: 5000
      paths:
      - path: /api/tasks/.*
        pathType: Prefix
        backend:
          serviceName: tasks-service
          servicePort: 5004
      paths:
      - path: /api/.*
        pathType: Prefix
        backend:
          serviceName: um-service
          servicePort: 5001
</code></pre>
<p>I'm intending to load the frontend by default then, use the other paths for loading other services. I would like to get the total tasks count from <code>/api/tasks/total_count</code> and raise new task from <code>/api/tasks/raise</code>. At the same time, I would like to login using <code>/api/auth/login/</code> and view other users with <code>/api/users/list</code> both served with the um-service.
The above configuration only returns the default path of the last service which is the um-service.
How do I configure so that web loads by default, then either <code>/api/auth/login</code> or <code>/api/users/list</code> are routed to the um-service and <code>/api/tasks/</code> is also routed to the tasks service? Kindly advice</p>

Denn
<p>If I understand you correctly, you want to achieve that result:</p>
<pre><code>$ curl &lt;MY_DOMAIN&gt;/api/auth/login
um-service
$ curl &lt;MY_DOMAIN&gt;/api/users/list
um-service
$ curl &lt;MY_DOMAIN&gt;/api/tasks/
tasks-service
$ curl &lt;MY_DOMAIN&gt;/
web-service
</code></pre>
<p>You almost did everything right, but <code>paths</code> should only be given once</p>
<p>Try this configuration:<br></p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /
        backend:
          serviceName: web-service
          servicePort: 5000
      - path: /api/tasks/.*
        backend:
          serviceName: tasks-service
          servicePort: 5004
      - path: /api/.*
        backend:
          serviceName: um-service
          servicePort: 5001
</code></pre>
