spring-bootkubernetesstartupspring-boot-actuatorreadinessprobe

How to configure Kubernetes startup probe with Spring Actuator


I have read a few documentations and figured out how to set up readiness and liveness endpoints with Actuator, like this one. But I am not able to figure out how to set-up the endpoint for the 'startup' probe.

My application yml:

management:
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: "ALWAYS"
      group:
        readiness.include: readinessProbe, dataStream
        startup.include: readinessProbe, dataStream

My deployment config:

  livenessProbe:
    httpGet:
      path: "/actuator/health/liveness"
      port: "http"
    initialDelaySeconds: 600
    periodSeconds: 15
  readinessProbe:
    httpGet:
      path: "/actuator/health/readiness"
      port: "http"
    periodSeconds: 30
    failureThreshold: 15
  startupProbe:
    httpGet:
      path: "/actuator/health/startup"
      port: "http"
    initialDelaySeconds: 150
    periodSeconds: 10
    failureThreshold: 30

The actuator doesn't seem to provide the URL for the 'startup' probe, or in other words, http://localhost:8080/actuator/health/startup doesn't work. How can I set it up?


Solution

  • Spring boot does not expose a separate endpoint for the startup probe. You could use the liveness probe for this use case as well. The reasoning to have a different probe in kubernetes is to enable a long timeout for the initial startup of the application, which might take some time. After the first successful startup probe call the liveness probe takes over, having reduced timeout values to quickly detect a failure and restart the application.