Search code examples
javaspring-bootnetflix-eurekaspring-boot-admin

Spring boot admin doesn't fetch registry from eureka


I use spring boot 2.0.X and want to use an admin-server that automatically detects other services registered at Eureka. I have followed this guide to the letter, but none of the applications are shown in the admin console. All applications are registered with Eureka successfully.

Admin-server configuration:

server:
  port: 8762

spring:
  application:
    name: admin-server
  boot:
    admin:
      discovery:
        ignored-services: admin-server
#The admin server will automatically pick up all services at eureka and register them to itself.
eureka:
  instance:
    leaseRenewalIntervalInSeconds: 10
    health-check-url-path: /actuator/health
    metadata-map:
      startup: ${random.int}    #needed to trigger info and endpoint update after restart
  client:
    registryFetchIntervalSeconds: 5
    registerWithEureka: true #default true
    fetchRegistry: true #default true
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

management:
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: ALWAYS

Eureka server configuration:

server:
  port: 8761
spring:
  application:
    name: discovery-server
eureka:
  instance:
    hostname: localhost
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

Some thoughts:

  • We migrated from spring boot 1.5.x to 2.0.x, is there a problem with security? We don't use spring-security anywhere but I read that some http endpoints are not "reachable" or "active" by default anymore. But I see no errors or warning in the logf of the admin server or eureka server about this.
  • None of my other applications have the spring boot admin starter client dependency in their pom, because I don't want THAT to be the part that is responsible for registering ith the admin console, I want it be done dynamically through Eureka
  • All applications, except the admin server and the eureka server, use the config-server to fetch their configuration. Does this cause problems?

The application.yml that all other applications get from the config server contains the following:

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
spring:
  boot:
    admin:
      url: http://localhost:8762
management: #exposing all endpoints is not safe for production, especially not if spring security gets involved
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: ALWAYS

Solution

  • I had the same issue when upgrading to SBA2.

    Versions of spring-boot, spring-cloud and SBA should match. I used:

    spring-boot:  2.0.7.RELEASE
    spring-cloud: Finchley.SR2
    SBA:          2.0.4
    

    In my case the trick was to use spring-boot-admin-starter-server as dependency instead of plain dependencies (spring-boot-admin-server, spring-boot-admin-server-ui, spring-boot-admin-server-cloud) as it is descriped here: https://github.com/codecentric/spring-boot-admin/issues/776