Fay*_*007 5 maven spring-boot kubernetes readinessprobe livenessprobe
我已将 Spring Boot 更新为2.5.2从2.1.8.RELEASE. 在此之前,活性和就绪性探测都很好。现在,在更新 Spring Boot 后,我更新了我的应用程序属性文件:
management.endpoints.web.exposure.include=*
management.endpoints.jmx.exposure.include=health,info
management.endpoint.metrics.enabled=true
management.endpoint.prometheus.enabled=true
management.metrics.enable.*=true
management.metrics.enable.all=true
management.metrics.export.prometheus.enabled=true
management.metrics.use-global-registry=true
management.endpoint.health.probes.enabled=true
management.health.livenessstate.enabled=true
management.health.readinessstate.enabled=true
management.endpoint.health.show-details=always
Run Code Online (Sandbox Code Playgroud)
我已分别向某些文档添加了最后 4 行。
在本地启动项目并从浏览器检查后:
http://localhost:8090/actuator/health/liveness给出{"status":"UP"}
但
http://localhost:8090/actuator/health/readiness给出{"status":"OUT_OF_SERVICE"}的是 503 状态。
{
"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"
]
}
Run Code Online (Sandbox Code Playgroud)
在我的 pom 文件中的依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>${spring-boot.version}</version>
<scope>runtime</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3455 次 |
| 最近记录: |