Skip to content
Preptima
mediumScenarioConceptMidSenior

Your Spring Boot service needs 50 seconds to start and Kubernetes keeps killing it before it is ready. What do you change, and in which order?

First stop the kills: add a Kubernetes startup probe with a budget longer than the worst observed start, and point liveness and readiness at Actuator's separate health groups. Then measure where the 50 seconds goes before tuning, because lazy initialisation only moves the cost onto the first requests.

4 min readUpdated 2026-10-09Target archetype: Enterprise Captive

Answer

Short answer

Fix the restarts before the speed. Add a Kubernetes startup probe whose failure budget comfortably exceeds the slowest Spring Boot startup you have measured, and point liveness and readiness at Actuator's health/liveness and health/readiness groups. Once the pod survives, measure the 50 seconds with a startup breakdown and remove the biggest items. Lazy initialisation is not a fix, because it moves the cost to the first real requests.

Was this answer helpful?

Likely follow-ups

  • What does the startup endpoint record, and why must the buffering implementation be installed before the application runs?
  • If Flyway migrations take twenty of the fifty seconds, where would you run them instead?
  • How would a CPU limit sized for steady state change the startup time you measured locally?
  • What happens to a rolling update with maxUnavailable of zero when each new pod takes a minute to become ready?

Related questions

Further reading

Related Topics