I’m a beginner system administrator and I’m currently learning how to implement an API Gateway in the infrastructure.
We have currently about 5 microservices, each in a docker container. Each container listens on a specific port, and has two or more paths (“isalive” for the container status, and “servicename” for the actual service).
I have a hard time understanding paths, I’m sure it’s not complicated at all but my mind seems to not be shaped the right way.
I currently have created a service with that URL: “http://10.1.2.5:8082” and two routes, one named “Health Check” with the path “/isalive” and the other called “Service” with the path “/service”.
But then I read another guide which made me doubt. Is it better to create two services for that container, with URL “http://10.1.2.5:8082/isalive” and path “/service_isalive” for the health check for example ?
As I understand the path /isalive, which will be used in the request “http://localhost:8000/isalive” will be forwarded to “http://10.1.2.5:8082” and not “http://10.1.2.5:8082/isalive”, right ?
For simplicity of getting started, I would setup your service (servicename) and associate it with your backend -http://10.1.2.5:8082
Then create one route to it with the path /servicename. By default, the path /servicename will be stripped from the URL when proxied to the backend service and thus:
localhost:8000/servicename/ -> 10.1.2.5:8082/
The only reason to create multiple routes is if you wanted to add plugins specific to those routes. For instance, /isalive, to limit access by IP addresss, apply rate limiting, etc. that would differ from the backend service itself.
Let me know if you need further assistance!
Thanks a lot, I understand how that works now.