探针职责
| 探针 | 失败后果 | 典型场景 |
|---|---|---|
| readinessProbe | 从 Endpoints 摘除,不重启 | 依赖未就绪临时摘流 |
| livenessProbe | 重启容器 | 死锁/卡死自动恢复 |
| startupProbe | 重启(大间隔判定) | 慢启动应用防误杀 |
探针示例
探针示例
containers:
- name: web
image: registry.example.com/team/web:1.2.3
readinessProbe:
httpGet: { path: /healthz, port: 8080 }
periodSeconds: 5
failureThreshold: 3
livenessProbe:
httpGet: { path: /livez, port: 8080 }
periodSeconds: 10
failureThreshold: 3
startupProbe:
httpGet: { path: /healthz, port: 8080 }
periodSeconds: 5
failureThreshold: 60
liveness 探针指向『会因外部依赖失败』的接口是经典错误:数据库抖动会引发全量重启风暴。liveness 只探进程自身活性。