What is LeaderWorkerSet (LWS)?
mainLeaderWorkerSet (LWS) is a Kubernetes API designed to deploy a group of pods as a single unit of replication. It is specifically optimized for AI/ML inference workloads, particularly multi-host inference where a Large Language Model (LLM) is sharded across multiple devices and nodes.
Key characteristics of an LWS group include:
- Unique Pod Identity: Each pod within a group is assigned a unique index from
0ton-1. - Parallel Lifecycle: Pods in a group are created in parallel and share the same lifecycle.
- Dual-Template Support: You can specify a template for workers and an optional separate template for the leader pod.
- Group-Level Operations: Scaling, rolling updates, and rollouts are performed at the group level. When a group is updated, all pods within that group are updated together as a single unit.
- Topology-Aware Placement: Supports opt-in co-location of pods within the same group in the same topology.
- All-or-nothing Restart: Supports opt-in policies where all pods in a group are recreated if a single pod fails or a container restarts.