<p>I have an Angular + Spring boot microservices application where there are about 10 backend microservices. Its a pretty big application with more than may be 100 REST end points.
We are thinking to move to on prem kubernetes. I wonder how do I define the ingress file, do I need to define all of the application REST end points in my spring application in ingress also?
I checked a couple of examples and I could see they use ingress as kind of Spring API gateway. Is that the correct architecture? Could anyone point me to a proper example?</p>

<p>Mostly it depends on your requirement, what you are trying to use.</p>
<p>If you are just planning to use the <strong>Nginx</strong> ingress with your sprint boot you can simply use the <strong>Nginx ingress controller</strong> and set the <strong>ingress</strong>.</p>
<p>While if you have requirements of <strong>API gateway</strong> features like reate limiting, API key, basic auth, and others you need to use the API gateway like Kong and all.</p>
<blockquote>
<p>about 10 backend microservices. Its a pretty big application with more
than may be 100 REST end points.</p>
</blockquote>
<p>you can create the <strong>1 ingresses</strong> for <strong>each microservice</strong> with different <strong>domain</strong> routing or else with different <strong>path-based</strong> routing.</p>
<p><strong>Sub-Domain</strong> based routing</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
  rules:
    - host: service-1.example.com
      http:
        paths:
          - backend:
              serviceName: service-1
              servicePort: 9000
            path: /(.*)
    - host: service-2.example.com
      http:
        paths:
          - backend:
              serviceName: service-2
              servicePort: 8000
            path: /(.*)
    - host: service-3.example.com
      http:
        paths:
          - backend:
              serviceName: service-3
              servicePort: 8000
            path: /(.*)
</code></pre>
<p><strong>Path</strong> based routing with single domain <code>api.example.com</code></p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  -  host: api.example.com 
     http:
      paths:
      - path: /service-1
        pathType: Prefix
        backend:
          service:
            name: service-1
            port:
              number: 80
      - path: /service-2
        pathType: Prefix
        backend:
          service:
            name: service-2
            port:
              number: 80
</code></pre>
<p>So domain one will route your request to service when any request goes to that specific service.</p>
<pre><code>service-2.example.com ---&gt; service-2 
service-3.example.com ---&gt; service-3 
</code></pre>
<p>While in <strong>path-based</strong> Nginx will redirect requests based on path prefix in URL</p>
<pre><code>api.example.com/service-2/* ---&gt; service-2 
</code></pre>
