<p>I created a ingress cluster and a ingress service first and then to route a request to point to NodePort-serviceA (resources-service) and NodePort-serviceB (staffing-service) in a k8s-cluster, an ingress file (by name of staffing-ingress.yaml) is applied mentioned below. </p>

<p>Resources-service and Staffing-service can communicate with each other from inside the container and while hitting a curl command “curl –v <a href="http://staffing-service:8080/swagger/index.html" rel="nofollow noreferrer">http://staffing-service:8080/swagger/index.html</a>” from resources container returns accurate result with HTTP 200 and vice versa. However if the incomplete URL is hit like this <a href="http://staffing-service:8080/" rel="nofollow noreferrer">http://staffing-service:8080/</a>, it throws a 404 error.</p>

<p>I have a doubt the way paths routing is done in the staffing-ingress.yaml file below. Any suggestions are welcome.</p>

<p><strong>Here are the details</strong> </p>

<p>Accessing the services (staffing or resources) using nginx load balancer IP does not return the results and throw 404 error. </p>

<pre><code>Curl –v http:// a5b9f45d4119a11eabbd90a9c35f3125-1159448980.us-east-2.elb.amazonaws.com:80/api/resources throws the below error
* TCP_NODELAY set
* Connected to a5b9f45d4119a11eabbd90a9c35f3125-1159448980.us-east-2.elb.amazonaws.com (3.134.165.38) port 80 (#0)

&lt; HTTP/1.1 404 Not Found
&lt; Server: openresty/1.15.8.2
&lt; X-Response-Time-ms: 0
</code></pre>

<p><strong>Staffing-Ingress.YAML</strong></p>

<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: staffing-ingress
  namespace: default
  annotations:
    ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
    http:
      paths:
      - path: /api/resources
        backend:
          serviceName: resources-service
          servicePort: 8001
      - path: /api/staffing
        backend:
          serviceName: staffing-service
          servicePort: 8080
</code></pre>

<p><strong>Expected result</strong>
is that while hitting from ingress using external LB having URI‘/api/resources/’ it should call the api-service <a href="http://resources-service:8001/swagger/index.html" rel="nofollow noreferrer">http://resources-service:8001/swagger/index.html</a>.</p>

fortanu82
<p>Everything is working properly in term of routing.
You are using the URL wrong.
You have to use this url </p>

<p><code>http:// a5b9f45d4119a11eabbd90a9c35f3125-1159448980.us-east-2.elb.amazonaws.com:80/api/resources/swagger/index.html</code></p>

<p>You have to append <strong>swagger/index.html</strong> in your url just like you are doing it while accessing it via service.</p>

<pre><code>curl –v http://staffing-service:8080/swagger/index.html


curl –v http:// a5b9f45d4119a11eabbd90a9c35f3125-1159448980.us-east-2.elb.amazonaws.com:80/api/resources/swagger/index.html
</code></pre>
