Share via


TopologySpreadConstraintV1 Class

Definition

Represents the topology spread constraints for distributing pods across a Kubernetes cluster. These constraints define policies for balancing pods across different node topologies such as zones or regions. The constraints aim to ensure high availability and resilience by spreading pods evenly based on the specified rules.

[YamlDotNet.Serialization.YamlSerializable]
public sealed class TopologySpreadConstraintV1
[<YamlDotNet.Serialization.YamlSerializable>]
type TopologySpreadConstraintV1 = class
Public NotInheritable Class TopologySpreadConstraintV1
Inheritance
TopologySpreadConstraintV1
Attributes
YamlDotNet.Serialization.YamlSerializableAttribute

Remarks

The following properties define the rules for the constraint: - `WhenUnsatisfiable`: Defines the behavior when the constraint is unsatisfiable. For example, it can be set to "DoNotSchedule" to prevent scheduling pods if the rule cannot be satisfied. - `LabelSelector`: Specifies the selector to identify the set of target pods for applying the constraint. - `MatchLabelKeys`: A list of label key names that must exist on nodes to be considered during the spread calculation. - `MinDomains`: Specifies the minimum number of topology domains that must satisfy the spread constraint. - `MaxSkew`: Defines the maximum skew, which is the difference in the number of pods across the topology domains. An uneven skew would trigger balancing of pods. - `NodeAffinityPolicy`: Determines the policy for using node affinity to influence pod placement. - `NodeTaintsPolicy`: Specifies the policy regarding node taints when scheduling the pods. - `TopologyKey`: Represents the key of a label that defines the topology domains for spreading, such as "zone" or "rack".

Constructors

TopologySpreadConstraintV1()

Properties

LabelSelector

Gets or sets the label selector used for dynamically filtering Kubernetes resources based on their labels. This property enables the selection of specific objects by defining criteria that must match the labels within the resource set.

MatchLabelKeys

Defines a list of specific label keys that are required to be matched for topology spreading constraints.

MaxSkew

Represents the maximum allowed skew for a topology spread constraint in Kubernetes. Skew is defined as the difference in the number of matching pods between the target and the other domains defined by the topologyKey.

MinDomains

Specifies the minimum number of topology domains that must have at least one replica present for resource scheduling. This is used to ensure that replicas are distributed across a certain number of domains to achieve a balanced topology spread for better availability and fault tolerance.

NodeAffinityPolicy

Defines the policy for node affinity within a Kubernetes topology spread constraint. Determines how nodes are selected to satisfy the specified affinity rules.

NodeTaintsPolicy

Gets or sets the policy for handling node taints within a topology spread constraint.

TopologyKey

Represents the key used to indicate the topology ___domain of a Kubernetes resource. The TopologyKey defines the scope for spreading or balancing resources across nodes based on the specified topology rule. It is typically matched to a node label, such as failure-___domain.beta.kubernetes.io/zone or kubernetes.io/hostname, to align resources with the desired ___domain or affinity policy.

WhenUnsatisfiable

Specifies the behavior when the constraints defined for topology spreading cannot be satisfied. This is used to handle scenarios where the node placement does not meet the desired topology spread constraints.

Applies to