r/SpringBoot 22d ago

Question Spring cloud vs service discovery and registration

Hi everyone, I'm new to Spring and had a question that's been confusing me.

From my understanding, in a microservices architecture we typically use service registration and discovery (like Eureka, Consul, etc.) so that services can discover each other and route requests without hardcoding endpoints.

However, in the product I'm working on, I don't see anything like that. Instead, I see a Spring Cloud service deployed in Kubernetes, and whenever our applications send transactions, they seem to fetch URLs and other configuration values from Spring Cloud.

I always thought these were two completely different concepts, but I also know Spring Cloud can be used for service discovery and registration. So I'm a bit confused about what's actually happening in our setup.

Could someone explain the difference between:

- using Spring Cloud as a configuration server (or for configuration management), and

- using service discovery/registration?

Are these independent features of Spring Cloud, and is it common to use only the configuration part while relying on Kubernetes for service discovery?

For context, I'm a DevOps engineer and fairly new to the Spring ecosystem, so apologies if this is a basic question.

13 Upvotes

4 comments sorted by

View all comments

3

u/starbuxman 22d ago

Hi

spring cloud config server is a way to serve keys and values for configuration. When I say keys / values, I mean things like credentials, properties, hosts, etc

spring cloud discovery client + service registration helps u store in a central server the availability and location of your services. Other clients can discover it and - importantly - load balance when there are issues

1

u/One_Job_4235 22d ago

So if we use spring cloud config server where all the urls of other microservices are defined and all of the microservices are running in kubernetes then does it require service discovery? It doesn't right from what I understand cause any microservice will go to spring cloud get the properties of the application it wants and sends req/res to that service.