Affinity

Affinity

NodeAffinity

core.v1.NodeAffinity

Node affinity is a group of node affinity scheduling rules.

  • preferredDuringSchedulingIgnoredDuringExecution ([]PreferredSchedulingTerm)
    The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.

    • preferredDuringSchedulingIgnoredDuringExecution.preference (NodeSelectorTerm)
      A node selector term, associated with the corresponding weight.

    • preferredDuringSchedulingIgnoredDuringExecution.weight (integer)
      Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.

  • requiredDuringSchedulingIgnoredDuringExecution (NodeSelector)
    If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to an update), the system may or may not try to eventually evict the pod from its node.

PodAffinity

core.v1.PodAffinity

Pod affinity is a group of inter pod affinity scheduling rules.

  • preferredDuringSchedulingIgnoredDuringExecution ([]WeightedPodAffinityTerm)
    The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.

    • preferredDuringSchedulingIgnoredDuringExecution.podAffinityTerm (PodAffinityTerm)
      Required. A pod affinity term, associated with the corresponding weight.

    • preferredDuringSchedulingIgnoredDuringExecution.weight (integer)
      weight associated with matching the corresponding podAffinityTerm, in the range 1-100.

  • requiredDuringSchedulingIgnoredDuringExecution ([]PodAffinityTerm)
    If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.

PodAntiAffinity

core.v1.PodAntiAffinity

Pod anti affinity is a group of inter pod anti affinity scheduling rules.

  • preferredDuringSchedulingIgnoredDuringExecution ([]WeightedPodAffinityTerm)
    The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.

    • preferredDuringSchedulingIgnoredDuringExecution.podAffinityTerm (PodAffinityTerm)
      Required. A pod affinity term, associated with the corresponding weight.

    • preferredDuringSchedulingIgnoredDuringExecution.weight (integer)
      weight associated with matching the corresponding podAffinityTerm, in the range 1-100.

  • requiredDuringSchedulingIgnoredDuringExecution ([]PodAffinityTerm)
    If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.

PreferredSchedulingTerm

core.v1.PreferredSchedulingTerm

An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).

  • preference (NodeSelectorTerm)
    A node selector term, associated with the corresponding weight.

  • weight (integer)
    Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.

PodAffinityTerm

core.v1.PodAffinityTerm

Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key <topologyKey> matches that of any node on which a pod of the set of pods is running

  • labelSelector (LabelSelector)
    A label query over a set of resources, in this case pods.

  • namespaces ([]string)
    namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means "this pod's namespace"

  • topologyKey (string)
    This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.

NodeSelector

core.v1.NodeSelector

A node selector represents the union of the results of one or more label queries over a set of nodes; that is, it represents the OR of the selectors represented by the node selector terms.

  • nodeSelectorTerms ([]NodeSelectorTerm)
    Required. A list of node selector terms. The terms are ORed.

NodeSelectorTerm

core.v1.NodeSelectorTerm

A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.

  • matchExpressions ([]NodeSelectorRequirement)
    A list of node selector requirements by node's labels.

  • matchFields ([]NodeSelectorRequirement)
    A list of node selector requirements by node's fields.

NodeSelectorRequirement

core.v1.NodeSelectorRequirement

A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.

  • key (string)
    The label key that the selector applies to.

  • operator (string)
    Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.

  • values ([]string)
    An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.