LeaderWorkerSet API

Generated API reference documentation for leaderworkerset.x-k8s.io/v1.

Resource Types

LeaderWorkerSet

Appears in:

LeaderWorkerSet is the Schema for the leaderworkersets API

FieldDescription
apiVersion
string
leaderworkerset.x-k8s.io/v1
kind
string
LeaderWorkerSet
spec [Required]
LeaderWorkerSetSpec

spec defines the desired behavior of LeaderWorkerSet.

status [Required]
LeaderWorkerSetStatus

status represents the current status of LeaderWorkerSet.

GroupIdentityType

(Alias of string)

Appears in:

GroupIdentityType defines how group identities are assigned.

GroupReplacementPolicyType

(Alias of string)

Appears in:

GroupReplacementPolicyType defines when a replacement group may start scheduling.

LeaderWorkerSetLeaderScheduling

Appears in:

LeaderWorkerSetLeaderScheduling defines scheduling for the leader PodGroup.

FieldDescription
schedulingPolicy
k8s.io/api/scheduling/v1alpha3.WorkloadPodGroupSchedulingPolicy

schedulingPolicy defines scheduling for the leader PodGroup.

schedulingConstraints
k8s.io/api/scheduling/v1alpha3.WorkloadPodGroupSchedulingConstraints

schedulingConstraints defines placement constraints for the leader PodGroup.

disruptionMode
k8s.io/api/scheduling/v1alpha3.WorkloadPodGroupDisruptionMode

disruptionMode defines how leader pods may be disrupted.

resourceClaims
[]k8s.io/api/scheduling/v1alpha3.WorkloadPodGroupResourceClaim

resourceClaims lists dynamic resource claims shared by leader pods.

LeaderWorkerSetReplicaScheduling

Appears in:

LeaderWorkerSetReplicaScheduling defines scheduling for a leader and its workers.

FieldDescription
schedulingPolicy
k8s.io/api/scheduling/v1alpha3.WorkloadCompositePodGroupSchedulingPolicy

schedulingPolicy defines scheduling for a leader and its workers.

schedulingConstraints
k8s.io/api/scheduling/v1alpha3.WorkloadCompositePodGroupSchedulingConstraints

schedulingConstraints defines placement constraints for a replica.

disruptionMode
k8s.io/api/scheduling/v1alpha3.WorkloadCompositePodGroupDisruptionMode

disruptionMode defines how the leader and worker groups may be disrupted.

leader
LeaderWorkerSetLeaderScheduling

leader defines scheduling for the leader PodGroup.

worker
LeaderWorkerSetWorkerScheduling

worker defines scheduling for the worker PodGroup.

LeaderWorkerSetScheduling

Appears in:

LeaderWorkerSetScheduling defines scheduling for all replicas.

FieldDescription
schedulingPolicy
k8s.io/api/scheduling/v1alpha3.WorkloadCompositePodGroupSchedulingPolicy

schedulingPolicy defines scheduling for all replicas.

schedulingConstraints
k8s.io/api/scheduling/v1alpha3.WorkloadCompositePodGroupSchedulingConstraints

schedulingConstraints defines placement constraints for all replicas.

disruptionMode
k8s.io/api/scheduling/v1alpha3.WorkloadCompositePodGroupDisruptionMode

disruptionMode defines how replica groups may be disrupted.

replica
LeaderWorkerSetReplicaScheduling

replica defines scheduling for each replica.

LeaderWorkerSetSpec

Appears in:

One group consists of a single leader and M workers, and the total number of pods in a group is M+1. LeaderWorkerSet will create N replicas of leader-worker pod groups (hereinafter referred to as group).

Each group has a unique index between 0 and N-1. We call this the leaderIndex. The leaderIndex is used to uniquely name the leader pod of each group in the following format: leaderWorkerSetName-leaderIndex. This is considered as the name of the group too.

Each worker pod in the group has a unique workerIndex between 1 and M. The leader also gets a workerIndex, and it is always set to 0. Worker pods are named using the format: leaderWorkerSetName-leaderIndex-workerIndex.

FieldDescription
replicas
int32

replicas is the number of leader-workers groups. A scale subresource is available to enable HPA. The selector for HPA will be that of the leader pod, and so practically HPA will be looking up the leader pod metrics. Note that the leader pod could aggregate metrics from the rest of the group and expose them as a summary custom metric representing the whole group. On scale down, the leader pod as well as the workers statefulset will be deleted. Default to 1.

leaderWorkerTemplate [Required]
LeaderWorkerTemplate

leaderWorkerTemplate defines the template for leader/worker pods

rolloutStrategy
RolloutStrategy

rolloutStrategy defines the strategy that will be applied to update replicas when a revision is made to the leaderWorkerTemplate.

startupPolicy
StartupPolicyType

startupPolicy determines the startup policy for the worker statefulset.

networkConfig
NetworkConfig

networkConfig defines the network configuration of the group

scheduling
LeaderWorkerSetScheduling

scheduling defines Workload-Aware Scheduling for this LeaderWorkerSet. This field is immutable.

groupIdentity
GroupIdentityType

groupIdentity determines how group identities are assigned. Ordinal (default) manages leaders through a StatefulSet: groups are named -0..-N-1 and scale down always removes the highest ordinal. Hash manages leaders through a Deployment: group names are hash-suffixed, scale down prefers unscheduled and not-ready groups over healthy ones, and rollouts are paced by a group readiness gate on the leader pods. This field is immutable.

groupReplacementPolicy
GroupReplacementPolicyType

groupReplacementPolicy controls when a replacement group may start scheduling after a group is deleted, whether by the restart policy recreating a failed group, by a rolling update or by a scale down that races a scale up. PostTermination (default) admits a replacement only once a previously deleted group has been fully removed, so the new group lands on the capacity the old one released instead of preempting other workloads. This matches the StatefulSet semantics of groupIdentity Ordinal, where a leader pod cannot be recreated until its predecessor is gone, and is the only supported value in that mode. Immediate admits replacement groups as soon as the leader Deployment creates them, overlapping with the teardown of the old group. Only supported with groupIdentity Hash.

LeaderWorkerSetStatus

Appears in:

LeaderWorkerSetStatus defines the observed state of LeaderWorkerSet

FieldDescription
conditions
[]k8s.io/apimachinery/pkg/apis/meta/v1.Condition

conditions track the condition of the leaderworkerset.

readyReplicas
int32

readyReplicas track the number of groups that are in ready state (updated or not).

updatedReplicas
int32

updatedReplicas track the number of groups that have been updated (ready or not).

replicas
int32

replicas track the total number of groups that have been created (updated or not, ready or not)

hpaPodSelector
string

hpaPodSelector for pods that belong to the LeaderWorkerSet object, this is needed for HPA to know what pods belong to the LeaderWorkerSet object. Here we only select the leader pods.

observedGeneration
int64

observedGeneration is the most recent generation observed for this LeaderWorkerSet.

LeaderWorkerSetWorkerScheduling

Appears in:

LeaderWorkerSetWorkerScheduling defines scheduling for the worker PodGroup.

FieldDescription
schedulingPolicy
k8s.io/api/scheduling/v1alpha3.WorkloadPodGroupSchedulingPolicy

schedulingPolicy defines scheduling for the worker PodGroup.

schedulingConstraints
k8s.io/api/scheduling/v1alpha3.WorkloadPodGroupSchedulingConstraints

schedulingConstraints defines placement constraints for the worker PodGroup.

disruptionMode
k8s.io/api/scheduling/v1alpha3.WorkloadPodGroupDisruptionMode

disruptionMode defines how worker pods may be disrupted.

resourceClaims
[]k8s.io/api/scheduling/v1alpha3.WorkloadPodGroupResourceClaim

resourceClaims lists dynamic resource claims shared by worker pods.

LeaderWorkerTemplate

Appears in:

Template of the leader/worker pods, the group will include at least one leader pod. Defaults to the worker template if not specified. The idea is to allow users to create a group with identical templates without needing to specify the template in both places. For the leader it represents the id of the group, while for the workers it represents the index within the group. For this reason, users should depend on the labels injected by this API whenever possible.

FieldDescription
leaderTemplate [Required]
k8s.io/api/core/v1.PodTemplateSpec

leaderTemplate defines the pod template for leader pods.

workerTemplate [Required]
k8s.io/api/core/v1.PodTemplateSpec

workerTemplate defines the pod template for worker pods.

size
int32

size is the number of pods to create. It is the total number of pods in each group. The minimum is 1 which represent the leader. When set to 1, the leader pod is created for each group as well as a 0-replica StatefulSet for the workers. Default to 1.

restartPolicy
RestartPolicyType

restartPolicy defines the restart policy when pod failures happen. The former named Default policy is deprecated, will be removed in the future, replace with None policy for the same behavior.

maxGroupRestarts
int32

maxGroupRestarts bounds how many times the controller can recreate a group under RecreateGroupOnPodRestart or RecreateGroupAfterStart. Once exhausted, the controller terminates the group, retains Pod API objects that can still receive finalizers, and stops automatic group recreation. Setting leaderworkerset.sigs.k8s.io/recover=true on the retained leader Pod resets that revision/group's budget and allows recovery. Changing this value does not resume an exhausted group. It is opt-in: when unset (nil), group recreation is unlimited. Budget exhaustion handling requires Kubernetes 1.27 or later because it relies on deleted Pods reaching a terminal phase while finalizers retain their API objects.

subGroupPolicy
SubGroupPolicy

subGroupPolicy describes the policy that will be applied when creating subgroups in each replica.

volumeClaimTemplates
[]k8s.io/api/core/v1.PersistentVolumeClaim

volumeClaimTemplates is a list of claims that pods are allowed to reference. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.

persistentVolumeClaimRetentionPolicy
k8s.io/api/apps/v1.StatefulSetPersistentVolumeClaimRetentionPolicy

persistentVolumeClaimRetentionPolicy describes the policy used for PVCs created from the VolumeClaimTemplates.

NetworkConfig

Appears in:

FieldDescription
subdomainPolicy [Required]
SubdomainPolicy

subdomainPolicy determines the policy that will be used when creating the headless service, defaults to shared

RestartPolicyType

(Alias of string)

Appears in:

RollingUpdateConfiguration

Appears in:

RollingUpdateConfiguration defines the parameters to be used for RollingUpdateStrategyType.

FieldDescription
partition
int32

partition indicates the ordinal at which the lws should be partitioned for updates. During a rolling update, all the groups from ordinal Partition to Replicas-1 will be updated. The groups from 0 to Partition-1 will not be updated. This is helpful in incremental rollout strategies like canary deployments or interactive rollout strategies for multiple replicas like xPyD deployments. Once partition field and maxSurge field both set, the bursted replicas will keep remaining until the rolling update is completely done and the partition field is reset to 0. This is as expected to reduce the reconciling complexity. The default value is 0.

maxUnavailable [Required]
k8s.io/apimachinery/pkg/util/intstr.IntOrString

maxUnavailable is the maximum number of replicas that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of total replicas at the start of update (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. By default, a fixed value of 1 is used. Example: when this is set to 30%, the old replicas can be scaled down by 30% immediately when the rolling update starts. Once new replicas are ready, old replicas can be scaled down further, followed by scaling up the new replicas, ensuring that at least 70% of original number of replicas are available at all times during the update.

maxSurge [Required]
k8s.io/apimachinery/pkg/util/intstr.IntOrString

maxSurge is the maximum number of replicas that can be scheduled above the original number of replicas. Value can be an absolute number (ex: 5) or a percentage of total replicas at the start of the update (ex: 10%). Absolute number is calculated from percentage by rounding up. By default, a value of 0 is used. Example: when this is set to 30%, the new replicas can be scaled up by 30% immediately when the rolling update starts. Once old replicas have been deleted, new replicas can be scaled up further, ensuring that total number of replicas running at any time during the update is at most 130% of original replicas. When rolling update completes, replicas will fall back to the original replicas.

RolloutStrategy

Appears in:

RolloutStrategy defines the strategy that the leaderWorkerSet controller will use to perform replica updates.

FieldDescription
type [Required]
RolloutStrategyType

type defines the rollout strategy, it can only be “RollingUpdate” for now.

rollingUpdateConfiguration
RollingUpdateConfiguration

rollingUpdateConfiguration defines the parameters to be used when type is RollingUpdateStrategyType.

RolloutStrategyType

(Alias of string)

Appears in:

StartupPolicyType

(Alias of string)

Appears in:

SubGroupPolicy

Appears in:

SubGroupPolicy describes the policy that will be applied when creating subgroups.

FieldDescription
subGroupPolicyType
SubGroupPolicyType

subGroupPolicyType defines what type of Subgroups to create. Defaults to LeaderWorker

subGroupSize [Required]
int32

subGroupSize is the number of pods per subgroup. This value is immutable, and must not be greater than LeaderWorkerSet.Spec.Size. Size must be divisible by subGroupSize in which case the subgroups will be of equal size. Or size - 1 is divisible by subGroupSize, in which case the leader is considered as the extra pod, and will be part of the first subgroup.

SubGroupPolicyType

(Alias of string)

Appears in:

SubdomainPolicy

(Alias of string)

Appears in:

Feedback

Was this page helpful?