Concepts
LeaderWorkerSet (LWS)
An LWS creates a group of pods based on two different templates (the leader template and the worker template), and controls their lifecycle.
Conceptual Diagram
Running an Example LeaderWorkerSet
Here is an example LeaderWorkerSet
To list all the pods that belong to a LWS, you can use a command like this:
The output should be similar to
Multi-Template for Pods
LWS support using different templates for leader and worker pods, if a leaderTemplate
field is specified. If it isn’t, the template used for
workerTemplate
will apply to both leader and worker pods.
Exclusive LWS to Topology Placement
The LWS annotation leaderworkerset.sigs.k8s.io/exclusive-topology
defines a 1:1 LWS replica to topology placement. For example,
you want an LWS replica to be scheduled on the same rack in order to maximize cross-node communcation for distributed inference. This
can be done as follows:
Subgroup and Exclusive Placement
The LWS annotation leaderworkerset.sigs.k8s.io/subgroup-exclusive-topology
defines a 1:1 between an LWS subgroup to topology placement. This can
be useful for dissagregated serving in order to place the prefill pod group in the same rack, but on a seperate rack from the decode pod group, assuming
same hardware requirements.