<p>Need help on setting up the ingress in K8S. Thank you in advance.</p>
<p>I have configured, NGINX Controller and Cert-Manager on the AKS cluster using Helm.</p>
<p>Here is the svc, pods list.
<a href="https://i.stack.imgur.com/wb6AN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wb6AN.png" alt="enter image description here" /></a></p>
<p>Next - deployed two pods, and respected services here are those names and can be found in the above-attached image.</p>
<ul>
<li>pod/rpe-delivers-orders-dcs-api*</li>
<li>service/rpe-delivers-orders-dcs-api</li>
<li>pod/rpe-delivers-orders-proxy-api*</li>
<li>service/rpe-delivers-orders-proxy-api</li>
</ul>
<p>Next - when I try to set up the ingress like below for the above two services.</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: rpe-delivers-orders-dcs-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    cert-manager.io/cluster-issuer: dcs-cluster-issuer
    nginx.ingress.kubernetes.io/rewrite-target: /$1
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
spec:
  tls:
  - hosts:
    - raag.westus2.cloudapp.azure.com
    secretName: dcs-tls-secret
  rules:
  - host: raag.westus2.cloudapp.azure.com
    http:
      paths:
      - path: /orders-dcs(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: rpe-delivers-orders-dcs-api
            port:
              number: 80
      - path: /orders-proxy(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: rpe-delivers-orders-proxy-api
            port:
              number: 80
      - path: /(.*)
        pathType: Prefix
        backend:
          service:
            name: rpe-delivers-orders-dcs-api
            port:
              number: 80
</code></pre>
<ul>
<li>Working as expected - raag.westus2.cloudapp.azure.com</li>
<li>Working as expected - raag.westus2.cloudapp.azure.com/rpe-delivers-orders-dcs-api</li>
<li><strong>Not working</strong> - raag.westus2.cloudapp.azure.com/rpe-delivers-orders-proxy-api</li>
</ul>
<p>My goal is for the below URLs should redirect to two different web pages:</p>
<ul>
<li>raag.westus2.cloudapp.azure.com/rpe-delivers-orders-dcs-api</li>
<li>raag.westus2.cloudapp.azure.com/rpe-delivers-orders-proxy-api</li>
</ul>
<p>Please let me know if I'm missing any information or didn't do the setup right.</p>
<p>Thank you.</p>

<p>Looks like you are missing the block of <code>rpe-delivers-orders-proxy-api</code> in your ingress config</p>
<pre><code>- path: /(.*)
        pathType: Prefix
        backend:
          service:
            name: rpe-delivers-orders-proxy-api
            port:
              number: 80
</code></pre>
<p>If you have any path rewrite option and requirement in that case you can create the two different ingress</p>
<p><strong>No 1.</strong> <strong>rewrite</strong> <strong>ingress</strong></p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name:  ingress-first
  annotations:
    kubernetes.io/ingress.class: nginx
    cert-manager.io/cluster-issuer: dcs-cluster-issuer
    nginx.ingress.kubernetes.io/rewrite-target: /$1
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
spec:
  tls:
  - hosts:
    - raag.westus2.cloudapp.azure.com
    secretName: dcs-tls-secret
  rules:
  - host: raag.westus2.cloudapp.azure.com
    http:
      paths:
      - path: /orders-dcs(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: rpe-delivers-orders-dcs-api
            port:
              number: 80
      - path: /orders-proxy(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: rpe-delivers-orders-proxy-api
            port:
              number: 80
</code></pre>
<p><strong>No 2.</strong> simple ingress which will be also there as per your requirement</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-second
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  tls:
  - hosts:
    - raag.westus2.cloudapp.azure.com
    secretName: dcs-tls-secret
  rules:
  - host: raag.westus2.cloudapp.azure.com
    http:
      paths:
      - path: /
        backend:
          service:
            name: rpe-delivers-orders-proxy-api
            port:
              number: 80
      - path: /
        backend:
          service:
            name: rpe-delivers-orders-dcs-api
            port:
              number: 80
</code></pre>
<p><strong>Update</strong> :</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-second
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  tls:
  - hosts:
    - raag.westus2.cloudapp.azure.com
    secretName: dcs-tls-secret
  rules:
  - host: raag.westus2.cloudapp.azure.com
    http:
      paths:
      - path: /orders-proxy
        pathType: Prefix
        backend:
          service:
            name: rpe-delivers-orders-proxy-api
            port:
              number: 80
</code></pre>
