<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="675" viewBox="0 0 1200 675" preserveAspectRatio="xMidYMid meet" role="img" aria-labelledby="title desc" data-image-type="timeline">
  <title id="title">Pod终止时间线</title>
  <desc id="desc">image_type=timeline; target_section=先理解Pod终止生命周期; purpose=展示Terminating、preStop、SIGTERM、宽限期预算、端点状态更新、SIGKILL和drain的先后关系; key_terms=Terminating,preStop,SIGTERM,TGPS,EndpointSlice,SIGKILL,drain; reader_task=理解preStop、SIGTERM和宽限期预算的先后关系。</desc>
  <defs>
    <style>
      text{font-family:system-ui,Arial,Helvetica,"Microsoft YaHei","PingFang SC",sans-serif;fill:#142033}.title{font-size:24px;font-weight:700}.sub{font-size:16px;fill:#5e6b7a}.node{font-size:17px;font-weight:700}.desc{font-size:15px;fill:#526070}.time{font-size:14px;fill:#6b7788}.phase{fill:#eef6ff;stroke:#a9c8eb;stroke-width:2}.warn{fill:#fff3ec;stroke:#eca383;stroke-width:2}.band{fill:#eef7f2;stroke:#a9d3ba;stroke-width:2}.budget{fill:#f7fafc;stroke:#d4dee9;stroke-width:2}.dot{fill:#356aa0}
    </style>
  </defs>
  <rect width="1200" height="675" fill="#f4f8fc"/>
  <rect x="70" y="55" width="1060" height="565" rx="30" fill="#ffffff" stroke="#d9e4f2" stroke-width="2"/>
  <text x="600" y="100" text-anchor="middle" class="title">终止时间线</text>
  <text x="600" y="130" text-anchor="middle" class="sub">宽限期覆盖preStop、应用退出和强制结束窗口</text>

  <rect x="145" y="166" width="910" height="84" rx="22" class="band"/>
  <text x="194" y="200" class="node">流量摘除窗口</text>
  <text x="194" y="226" class="desc">端点状态更新，入口层逐步停止分配新请求</text>
  <text x="896" y="218" class="desc" text-anchor="middle">drain状态</text>

  <rect x="112" y="306" width="196" height="112" rx="20" class="phase"/>
  <circle cx="135" cy="332" r="9" class="dot"/>
  <text x="210" y="342" text-anchor="middle" class="node">Terminating</text>
  <text x="210" y="369" text-anchor="middle" class="desc">开始倒计时</text>
  <text x="210" y="394" text-anchor="middle" class="time">Pod进入退出</text>

  <rect x="360" y="306" width="196" height="112" rx="20" class="phase"/>
  <circle cx="383" cy="332" r="9" class="dot"/>
  <text x="458" y="342" text-anchor="middle" class="node">preStop</text>
  <text x="458" y="369" text-anchor="middle" class="desc">触发轻量摘流</text>
  <text x="458" y="394" text-anchor="middle" class="time">耗时计入窗口</text>

  <rect x="608" y="306" width="196" height="112" rx="20" class="phase"/>
  <circle cx="631" cy="332" r="9" class="dot"/>
  <text x="706" y="342" text-anchor="middle" class="node">SIGTERM</text>
  <text x="706" y="369" text-anchor="middle" class="desc">应用停止接单</text>
  <text x="706" y="394" text-anchor="middle" class="time">等待请求完成</text>

  <rect x="856" y="306" width="196" height="112" rx="20" class="warn"/>
  <circle cx="879" cy="332" r="9" fill="#c75b39"/>
  <text x="954" y="342" text-anchor="middle" class="node">SIGKILL</text>
  <text x="954" y="369" text-anchor="middle" class="desc">窗口耗尽触发</text>
  <text x="954" y="394" text-anchor="middle" class="time">应作为兜底</text>

  <rect x="175" y="486" width="850" height="82" rx="22" class="budget"/>
  <text x="220" y="520" class="node">宽限期预算（TGPS）</text>
  <text x="220" y="548" class="desc">预算 = 摘流耗时 + 请求处理 + 资源清理 + 少量缓冲</text>
</svg>
