Search code examples
javaspringspring-bootspring-boot-adminspring-cloud-kubernetes

Spring Boot Admin does not detect service after restarting


I have an environment with different services. They all are deployed and managed by Docker images and Kubernetes. I also use spring-boot-admin in order to monitor them all and spring-cloud-kubernetes to discover all the services automatically. This my properties file.

application.yml (In the SBA project)

server:
 port: ${admin-server.port:8086}
 tomcat:
remote-ip-header: x-forwarded-for
protocol-header: x-forwarded-proto
spring:
application:
name: admin-server
security:
user:
  name: ${spring-security.admin.username:****}
  password:  ${spring-security.admin.password:****}
boot:
admin:
  discovery:
    ignored-services: admin-server
  notify:
    mail:
      enabled: ${admin-mail.enabled:true}
      to: ${admin-mail.recipients:******}
      from: ${admin-mail.from:******}
      template: classpath:/template/status-changed.html
      ignore-changes: OFFLINE:UP, DOWN:UP
    slack:
      webhook-url: ${admin-slack.webhook:*******}
      ignore-changes: OFFLINE:UP, DOWN:UP
      enabled: true
 mail:
test-connection: false
host: smtpjc.*****
port: 25
properties:
  mail:
    smtp:
      connectiontimeout: 5000
      timeout: 3000
      writetimeout: 5000
    debug: ${admin-mail.debug:true}

It works perfectly whenever I restart the SBA project, it discovers every service. My problem comes when I restart a single project, it is shown as OFFLINE in the SBA and it does not change its status.

What am I missing?


Solution

  • I have found the issue and fixed it like this:

    spring.cloud.kubernetes.reload.enabled: true

    I should have added this line to the config file.