Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Affinity and anti-affinity

Sumit Rawal answered on May 6, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • What is a node affinity and anti-affinity?

  • Affinity and anti-affinity

    0

    nodeSelector is the simplest way to constrain Pods to nodes with specific labels. Affinity and anti-affinity expands

    the types of constraints you can define. Some of the benefits of affinity and anti-affinity include:

    The affinity/anti-affinity language is more expressive. nodeSelector only selects nodes with all the specified

    labels. Affinity/anti-affinity gives you more control over the selection logic.

    You can indicate that a rule is soft or preferred, so that the scheduler still schedules the Pod even if it can't

    find a matching node.

    You can constrain a Pod using labels on other Pods running on the node (or other topological domain),

    instead of just node labels, which allows you to define rules for which Pods can be co-located on a node.

    The affinity feature consists of two types of affinity:

    • Node affinity functions like the nodeSelector field but is more expressive and allows you to specify soft rules.

    • Inter-pod affinity/anti-affinity allows you to constrain Pods against labels on other Pods

    There are two types of node affinity:

    requiredDuringSchedulingIgnoredDuringExecution: The scheduler can't schedule the Pod unless the rule is

    met. This functions like nodeSelector, but with a more expressive syntax.

    preferredDuringSchedulingIgnoredDuringExecution: The scheduler tries to find a node that meets the rule. If a

    matching node is not available, the scheduler still schedules the Pod

    Note: want to see the example and want to read more than refer this link. 

    Popularity 1/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on May 06 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.