My spring boot application needs to call or consume rest api from another spring boot application.
I want to use Kubernetes to manage my application and its multiple instances. But I am struggling to get rest-endpoint of another service.
Lets say....
app1 calls app2,
app2 consume app3,
app4 calls app1 and app2.
Here how should I get app1, app2.. app4 endpoint to communicate each other.
Can anyone help me with this scenario.
Usually you would use Kubernetes Services for this communication. Each service can be accessed via its name in the cluster (<service_name>.<namespace>.svc.cluster.local
).
So the solution is to define a Kubernetes ClusterIP service for each of your apps and then access them via those services. For example, if any application wants to access an HTTP service called "app2" in the "default" namespaces it would call http://app2.default.svc.cluster.local
.