I apologize for the confusion, I hope I am not missing something.
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:
http://localhost:8088/reader/info
and get the response. it uses the port 8088 and has "reader/info " API defined in it.
Now moving forward to Kubernetes:
I have deployed:
ingress resource
deployment of my application (same microservice that works with http://localhost:8088/reader/info locally and not in Kubernetes)
service of type clusterIP for my application
in the ingress resource: I have defined the host name: debug.com, and I would like the requests to be forwarded to service "reader-service".
my question is: how do I forward the request "reader/info" 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.
obviously, I am missing something here..
Ingress resource
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
deployment + service:
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