POD 完整生命周期状态转换

创建 Pod
   ↓
[Phase: Pending]
[Conditions: PodScheduled=False]
   ↓
Scheduler 调度
   ↓
[Phase: Pending]
[Conditions: PodScheduled=True, Initialized=False]
   ↓
Kubelet 创建 Sandbox + 启动 Init 容器
   ↓
[Phase: Pending]
[Conditions: PodReadyToStartContainers=True, Initialized=False]
   ↓
Init 容器全部成功
   ↓
[Phase: Pending]
[Conditions: Initialized=True, ContainersReady=False]
   ↓
启动主容器 + Readiness Probe 通过
   ↓
[Phase: Running] ← 关键转换点
[Conditions: ContainersReady=True, Ready=True]
   ↓
容器运行中...
   ↓
─────────────分支 1: 正常完成─────────────
容器以 Exit 0 退出(RestartPolicy=Never)
   ↓
[Phase: Succeeded] ← 终态
[Conditions: ContainersReady=False, Ready=False]
   
─────────────分支 2: 失败终止─────────────
容器崩溃/被杀死(RestartPolicy=Never)
   ↓
[Phase: Failed] ← 终态
[Conditions: ContainersReady=False, Ready=False]

─────────────分支 3: 持续运行─────────────
容器继续运行(RestartPolicy=Always)
   ↓
[Phase: Running]
[Conditions: Ready=True(随 Probe 结果动态变化)]

posted @ 2026-01-08 16:27  sugare  阅读(2)  评论(0)    收藏  举报