Run LeaderWorkerSet in Multi-Cluster
Before you begin
Check the MultiKueue installation guide on how to properly setup MultiKueue clusters.
How it works
LeaderWorkerSet creates one Workload per replica, which requires special handling in MultiKueue.
All workloads from a LeaderWorkerSet are dispatched to the same worker cluster atomically:
- Each workload waits for all workload group members to exist on the manager cluster.
- The primary workload (index 0) nominates and dispatches to the target worker cluster.
- Once the remote workload is admitted on the worker, the primary’s
ClusterNameis set. - All other workload group members see the
ClusterNameand follow to the same worker cluster. - The LeaderWorkerSet is created on the worker cluster after all workloads are synchronized.
This ensures that all replicas of a LeaderWorkerSet run together on the same worker cluster.
Limitation
LeaderWorkerSet does not currently support the managedBy field.
As a limitation of this, to get the actual status of the LeaderWorkerSet, you need to access the worker cluster.
Example
Here is a sample LeaderWorkerSet:
apiVersion: leaderworkerset.x-k8s.io/v1
kind: LeaderWorkerSet
metadata:
name: nginx-leaderworkerset
labels:
app: nginx
kueue.x-k8s.io/queue-name: user-queue
spec:
replicas: 2
leaderWorkerTemplate:
leaderTemplate:
spec:
containers:
- name: nginx-leader
image: registry.k8s.io/nginx-slim:0.27
resources:
requests:
cpu: "100m"
ports:
- containerPort: 80
size: 3
workerTemplate:
spec:
containers:
- name: nginx-worker
image: registry.k8s.io/nginx-slim:0.27
resources:
requests:
cpu: "200m"
ports:
- containerPort: 80You can create the LeaderWorkerSet using the following command:
kubectl create -f sample-leaderworkerset.yaml
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.