I am trying to reproduce this configuration from regular NGinx in Kubernetes NGinx ingress:
location /addresslookup/ {
...
proxy_pass https://fmt-address-lookup-service:5005/addresslookup/;
}
location /geocode/ {
...
proxy_pass https://fmt-address-lookup-service:5005/geocode/;
}
Basically I want two different external endpoints to feed through to two different paths on the same Kubernetes service. I can see how to setup the two endpoints and point them to the service:
rules:
- host: api2.findmytea.co.uk
http:
paths:
- path: /addresslookup/(.*)
backend:
serviceName: fmt-address-lookup
servicePort: 5004
- path: /geocode/(.*)
backend:
serviceName: fmt-address-lookup
servicePort: 5004
But I cannot find an example of how to make it direct to a certain path on the service.
What am I missing?
You need just one path to redirect traffic to your service. Routing within the app should be handled by the app. So, there should be no need to define multiple paths in ingress for the same service.
Here are multiple examples (NodeJS/Express) how an app can handle internal routing https://expressjs.com/en/guide/routing.html
Refer to my response to a similar thread: https://stackoverflow.com/a/67975782/2777988