I'm a super beginner with Kubernetes and I'm trying to imagine how to split my monolithic application in different micro services. Let's say i'm writing my micro services application in Flask and each of them exposes some endpoints like:
Micro service 1:
- /v1/user-accounts
Micro service 2:
- /v1/savings
Micro service 3:
- /v1/auth
If all of them were running as blueprints in a monolithic application all of them would be prefixed with the same IP, that is the IP of the host server my application is running on, like 10.12.234.69, eg.
Now, deploying those 3 "blueprints" on 3 different POD/Nodes in Kubernetes will change the IP address of each endpoint having maybe 10.12.234.69, than 10.12.234.70 or 10.12.234.75
How can i write an application that keep the URL reference constant even if the IP address changes?
- Would a Load Balancer Service do the trick?
- Maybe the Service Registry feature of Kubernetes does the "DNS" part for me?
I know It can sounds very obvious question but still I cannot find any reference/example to this simple problem.
Thanks in advance!
EDIT: (as follow up to simon answer)
questions:
given the fact that the Ingress service spawns a load balancer and is possible to have all the routes reachable from the http/path prefixed by the IP (
http://<ADDRESS>/v1/savings) of the load balancer, how can I associate IP to the load balancer to match the ip of the pod on which flask web server is running?in case I add other sub routes to the same paths, like
/v1/savings/getand/v1/savings/get/id/<var_id>, should i update all of them in the ingress http path in order for them to be reachable by the load balancer ?