I have updated spring boot to 2.5.3 from 2.1.8.RELEASE. Before that liveness and readiness probe was fine. Now after updating the spring boot I have updated my application properties file as follows:
management.endpoint.health.probes.enabled=true
management.health.livenessstate.enabled=true
management.health.readinessstate.enabled=true
management.endpoint.health.show-details=always
Running project locally gives out of service on http://localhost:8090/actuator/health:
{
"status": "OUT_OF_SERVICE",
"components": {
"diskSpace": {
"status": "UP",
"details": {
"total": 499963174912,
"free": 326313852928,
"threshold": 10485760,
"exists": true
}
},
"livenessState": {
"status": "UP"
},
"ping": {
"status": "UP"
},
"readinessState": {
"status": "OUT_OF_SERVICE"
}
},
"groups": [
"liveness",
"readiness"
]
}
And on kubernates:
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
location-config-config:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: location-config-config
Optional: false
default-token-md4l8:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-md4l8
Optional: false
QoS Class: Burstable
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning Unhealthy 2m32s (x215 over 109m) kubelet Readiness probe failed: HTTP probe failed with statuscode: 503
config-rc.yaml:
readinessProbe:
failureThreshold: 3
periodSeconds: 30
initialDelaySeconds: 180
httpGet:
path: /actuator/health/readiness
port: 8090
scheme: HTTP
livenessProbe:
failureThreshold: 3
periodSeconds: 30
initialDelaySeconds: 60
httpGet:
path: /actuator/health/liveness
port: 8090
scheme: HTTP
I have updated the path accordingly, the liveness gives status up always but getting 503 for readiness. What configuration is missing here? Or should I not update the spring-boot.
Comment From: snicoll
Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.
As a side note, health probes have been introduced as of Spring Boot 2.3. It looks like the probesis reachable but fails, checking the logs to see if your application has started successfully is what I'd do next. For follow-up, please use StackOverflow.