To check the health of a Spring Boot application, add the spring-boot-starter-actuator dependency and send requests to /actuator/health.
Apparently, /actuator/health checks not only the application itself but also the various endpoints it accesses, such as DB, Kafka, and Redis.
A particular Pod was restarting intermittently, so I set actuator-related logging to debug and examined the logs.
Frequent login attempts to the SMTP server were being rejected. It seems this caused 503 responses, which in turn caused the health checks to fail.
You can disable the SMTP server health check in /actuator/health as shown below. After applying this, the restart issue was resolved..! 🤭
yaml
management:
health:
mail:
enabled: false