llm-wiki wiki · sources 2026-06-14

原文:raw/lws-architecture-analysis.md · 仓库:https://github.com/kubernetes-sigs/lws · 优先级 P1

一句话定位

LeaderWorkerSet 用一组 leader/worker Pods 表达一个复制单元,适合 LLM inference、分布式 serving 和需要稳定 group 语义的 workload。

核心架构图

┌────────────────────────────────────────────────────────────────────────────┐
│ Distributed workload intent                                                │
│ A workload needs one leader plus a group of homogeneous worker Pods.       │
└────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌────────────────────────────────────────────────────────────────────────────┐
│ LeaderWorkerSet API                                                        │
│ Group size, replicas, pod templates, rollout policy, and status model the  │
│ group.                                                                     │
└────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌────────────────────────────────────────────────────────────────────────────┐
│ LWS controller                                                             │
│ Reconciles leader/worker Pods and keeps grouped replicas in a coherent     │
│ lifecycle.                                                                 │
└────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌────────────────────────────────────────────────────────────────────────────┐
│ Runtime boundary                                                           │
│ Services, scheduler, Pods, and AI/HPC runtimes consume the generated       │
│ group.                                                                     │
└────────────────────────────────────────────────────────────────────────────┘

模块分层

层 / 模块 职责
API LeaderWorkerSet CRD
Controller replica group rollout/status
Pod template leader/worker roles
Integrations serving/HPC/AI workload

关键数据流

用户声明 LeaderWorkerSet
        │
        ▼
controller 创建 leader/worker pod group
        │
        ▼
维护副本、状态和滚动更新
        │
        ▼
服务或上层 operator 连接每组 leader/worker

设计决策与哲学