<p>I apologize for the confusion, I hope I am not missing something.</p>
<p>I am trying to understand the way I forward http request through ingress in Kubernetes cluster.
I have a spring-boot microservice. if I run an image of it locally (NOT IN KUBERNETES)then I would send the following HTTP request:</p>
<pre><code>  http://localhost:8088/reader/info 
</code></pre>
<p>and get the response. it uses the port 8088 and has &quot;reader/info &quot; API defined in it.</p>
<p><strong>Now moving forward to Kubernetes:</strong></p>
<p>I have deployed:</p>
<ol>
<li><p>ingress resource</p>
</li>
<li><p>deployment of my application (same microservice that works with     http://localhost:8088/reader/info locally and not in Kubernetes)</p>
</li>
<li><p>service of type clusterIP for my application</p>
</li>
</ol>
<p><strong>in the ingress resource:</strong>
I have defined the host name: <strong>debug.com</strong>, and I would like the requests to be forwarded to service &quot;reader-service&quot;.</p>
<p>my question is: how do I forward the request <strong>&quot;reader/info&quot;</strong> to the service through ingress(which is the original path that the application expects)? do I need to define that URL reader/info in the ingress itself? or in the parameters of the request?
what should be in the URL that I send? because obviously I can have 100 microservices with completely different URL.</p>
<p>obviously, I am missing something here..</p>
<p><strong>Ingress resource</strong></p>
<pre><code>apiVersion: networking.k8s.io/v1  
kind: Ingress
   
metadata:
   
  name: ingress-rules
  namespace: default
    
spec:
  ingressClassName: nginx
  rules: 
    - host: debug.com
      http:  
        paths:  
          - path: /  
            pathType: Prefix  
            backend:  
              service: 
                name: reader-service 
                port:
                  #same port of clusterIp
                   number: 80
          
          - path: /search
            pathType: Prefix  
            backend:  
              service: 
                name: reader-service
                port:
                  #same port of clusterIp
                  number: 80
</code></pre>
<p><strong>deployment + service:</strong></p>
<pre><code>apiVersion: apps/v1

 kind: Deployment

 metadata:
   name: reader-deployment
   labels: 
    app: reader

 spec:

   replicas: 3
   selector:
    matchLabels:
      app: reader
      version: v1
   
   template:
    metadata:
      labels:
        app: reader
        version: v1
    spec:
      containers:
      - name: reader
        image: artifactory-iky.com:5654/reader:v1.0.0
        ports:
        - containerPort: 8088       
      imagePullSecrets:
        - name: registrykey
---
apiVersion: v1 
kind: Service 

metadata:
  name: reader-service
spec:
  type: ClusterIP

  selector:
    app: reader

  ports:
    - targetPort:  8088
      port: 80


      
</code></pre>

Ohad
<p>My recommendation is:</p>
<ol>
<li>Configure your applications to work without path (at location &quot;/&quot;).</li>
<li>Configure Ingress with desired application path.</li>
<li>Configure Ingress to strip path in the requests to the backend.</li>
</ol>
<p>See: <a href="https://stackoverflow.com/questions/52923298/remove-routing-path-from-kubernetes-ingress">Remove routing path from Kubernetes ingress</a></p>
<p>Of course, You can use the application path in the Ingress configuration or you can rewrite the location to the application path, but then you'll have to configure each application rewrite rule.</p>
