Fabry
Fabry

Reputation: 1650

Service discovery in kubernetes/ spring boot

What are the benefits to use "spring service discovery kubernetes" instead of using directly the Service DNS coming from Kubernetes?

I mean, If I deploy in kubernetes 2 services (service-a and service-b), and service-b exposes a Rest API. service-a can easily connect to service-b using the url "http://service-b/...".

Question #1. In order to let service-a be able to connect to service-b using the service DNS, service-b has to be deployed before service-a?

Question #2. What are the pros/cons using the spring discovery?

Upvotes: 1

Views: 368

Answers (1)

JArgente
JArgente

Reputation: 2297

Question #1: No, the order in which you deploy the services is not important to use the kubernetes DNS services to resolve the ips, the only thing here is that if you deploy serviceA after serviceB, you will have in serviceA as an environment variable the ip of serviceB but not the inverse.

Question #2: The spring service discovery is an alternative to the native kubernetes service discovery and it is used by other spring cloud projects like spring-cloud-eureka to perform the service discovery. The only pros I see in this approach is that you can custom the load balancing algorithm tath you can use to spread the load among the different instances

Upvotes: 1

Related Questions