Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for discovering new microservice containers that get created after spring boot admin is deployed #3556

Open
breckenenneking opened this issue Aug 2, 2024 · 5 comments

Comments

@breckenenneking
Copy link

Whenever a new microservice container is created after the spring boot admin container is created, a restart is required for spring boot admin to begin monitoring this microservice container.

I would like to request a way for continuous discovery of new containers that get created even if that container was not present during startup of the spring boot admin container.

@SteKoe
Copy link
Contributor

SteKoe commented Aug 4, 2024

Hi @breckenenneking,

SBA does, of course, support auto discovery of newly created services. Have you added @EnableScheduling annotation along with @EnableAdminServer?

What type of detection/registration are you using? Which Spring Boot Admin version are you running and what versions of Spring Boot services are you trying register?

Regards,
SteKoe

@breckenenneking
Copy link
Author

Hi @SteKoe,

I do have both the @EnableScheduling annotation as well as the @EnableAdminServer annotation enabled.

As for the detection/registration, I am not sure if this is what you are looking for but we use service discovery through spring cloud kubernetes to connect to various deployments.

The spring boot admin version I use is 3.3.3 with spring boot services using spring boot 3.3.2

I do see some new services being discovered but they take at least 5 minutes from when the pod is deployed with some services not being discovered at all on spring admin even after an hour

@erikpetzold
Copy link
Member

To me this sounds like a configuration issue in kubernetes or spring-cloud-kubernetes. Spring Boot Admin relies on the discovery client here.

Maybe your services are not visible (e.g. no access to namespace) or not ready (you would need to tell discoveryclient to include these: includeNotReadyAddresses – include as discovered if endpoint addresses is not marked with 'ready' by kubernetes).
Or they are missing some label that you use for filtering in Spring Boot Admin.

You could try to enable more logging for spring-cloud-kubernetes and maybe also debug for "de.codecentric.boot.admin.server.cloud.discovery" to see when discovery is running.

We also have a demo setup here: https://github.com/codecentric/spring-boot-admin-runtime-playground/tree/main/kubernetes but as it seems to work "a bit" I guess you already have the basic setup.

@breckenenneking
Copy link
Author

I don't think it is a kubernetes problem because after doing some debugging, the new service is available in the discovery client as soon as it is made ready in kubernetes (which takes around 10-20 seconds from when I deploy the service).

Once the list of services is retrieved from the discovery client, how is it processed?

@erikpetzold
Copy link
Member

Sorry for the late reply, but if you have already debugged you should see what happens :)

The InstanceDiscoveryListener gets notified that something changed and runs the discover() method which converts the service model from Spring Cloud to Spring Boot Admin and adds the service to the internal Service Registry (which is also accessed by the api, so then the service should be visible).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants