<p>My ingress cannot route to  endpoint.</p>
<p>I provided everything. Nginx-controller works properly. I added the hostname bago.com as loadbalancerip. But it doesn't work.</p>
<p>Here is my ingres's yaml file</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
spec:
  rules:
    - host: bago.com
    - http:
        paths:
          - path: /web1/
            pathType: Exact
            backend:
              service:
                name: web1-clusterip
                port:
                  number: 8081
          - path: /web2/
            pathType: Exact
            backend:
              service:
                name: web2-clusterip
                port:
                  number: 8082
</code></pre>
<p>svc and ingress running</p>
<pre><code>bahaddin@bahaddin-ThinkPad-E15-Gen-2:~/projects/personal/exposer/k8s-ingress$ k get svc
NAME             TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)    AGE
kubernetes       ClusterIP   10.12.0.1     &lt;none&gt;        443/TCP    154m
web1-clusterip   ClusterIP   10.12.6.102   &lt;none&gt;        8081/TCP   145m
web2-clusertip   ClusterIP   10.12.9.22    &lt;none&gt;        8082/TCP   149m

bahaddin@bahaddin-ThinkPad-E15-Gen-2:~/projects/personal/exposer/k8s-ingress$ k get ingress
NAME              CLASS    HOSTS      ADDRESS          PORTS   AGE
minimal-ingress   &lt;none&gt;   bago.com   34.102.241.199   80      121m
bahaddin@bahaddin-ThinkPad-E15-Gen-2:~/projects/personal/exposer/k8s-ingress$ 
</code></pre>
<p>Here is my API java code.</p>
<pre><code>@RequestMapping(&quot;/web1&quot;)
@RestController
public class Controller {

    @GetMapping(&quot;/hello&quot;)
    public String foo() {
        return &quot;hello from web1 ms&quot;;
    }

}
</code></pre>
<p>server.port=8081 on container level</p>
<p>my service</p>
<pre><code>Web1-service.
apiVersion: v1
kind: Service
metadata:
  name: web1-clusterip
spec:
  ports:
    - protocol: &quot;TCP&quot;
      port: 8081
  selector:
    app: web1-dp
  type: ClusterIP
</code></pre>
<p>But when I type in the browser</p>
<pre><code>http://bago.com/web1/hello 
http://bago.com/web1/hello
</code></pre>
<p>I got a 404 not found error<br />
<strong>Screenshot</strong><br />
<img src="https://i.stack.imgur.com/WXRg5.png" alt="enter image description here" /></p>

Bago
<p>You have an issue in your ingress manifest. You have two items in the list, while you want to have one. Additionally, you are missing the ingress class.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
spec:
  rules:
    # these are indivudal list items
    - host: bago.com
    - http: ...
</code></pre>
<p>You have to change the manifest so that you have a single item. You should also add the ingress class.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
spec:
  # this should be the ingress class, i.e. nginx
  ingressClassName: my-ingress-class
  rules:
    # this list has only 1 items, which is an object. 
    # note the dash (-) 
    - host: bago.com
      http: ...
</code></pre>
