Share via


PodAffinityTermV1 Class

Definition

Represents a term used to define pod affinity/anti-affinity requirements in Kubernetes. The PodAffinityTermV1 specifies conditions such as label selectors, namespace selectors, and topology keys that determine the placement of pods in relation to other pods in a cluster.

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

Constructors

PodAffinityTermV1()

Properties

LabelSelector

Gets or sets the label selector used to filter Kubernetes resources based on their labels. The label selector enables dynamic selection of a specific set of objects by matching labels or expressions that satisfy the requirements.

MatchLabelKeys

A list of label keys that should match for the associated Kubernetes resource. This property specifies a set of labels that must be present and match among a group of resources when certain constraints, such as affinity or anti-affinity rules, are applied.

MismatchLabelKeys

Represents a list of label keys that must NOT be matched by the target resources. This property is used as part of the label-based selection mechanism to exclude resources that have specific labels from being selected.

Namespaces

The Namespaces property represents a list of strings that define the specific namespaces within which the label selector or namespace selector should apply. This property is particularly useful when specifying criteria for selecting pods or other Kubernetes resources constrained to particular namespaces.

NamespaceSelector

Gets or sets the namespace selector used to identify namespaces to which the label selector applies. This property specifies a label-based filter that restricts the namespaces considered by the associated label selector.

TopologyKey

Specifies the key for the node's topology on which matching should occur. The value of this property is used to categorize nodes in a cluster based on specific characteristics, such as region or zone. This is commonly used in Kubernetes for pod affinity and anti-affinity rules to determine how pods are scheduled across nodes.

Applies to