Skip to content

Topology spread vs pod anti affinity #613

Description

@mbyio

Which version of kube-score are you using?

kube-score version: 1.18.0

What did you do?

A deployment has a topology spread constraint like this:

- maxSkew: 4
  minDomains: 3
  topologyKey: kubernetes.io/hostname
  whenUnsatisfiable: DoNotSchedule
  labelSelector:
    matchLabels:
    # ...
  matchLabelKeys:
    - pod-template-hash
- maxSkew: 1
  minDomains: 2
  topologyKey: topology.kubernetes.io/zone
  whenUnsatisfiable: DoNotSchedule
  labelSelector:
    matchLabels:
      # ...
  matchLabelKeys:
    - pod-template-hash

What did you expect to see?

This topology spread constraint will force the deployment to spread pods across multiple nodes and zones. It is about as safe as the pod anti affinity rule, and it is more efficient, because we can have multiple pods on the same node.

What did you see instead?

kube-score fails with a warning about missing a pod anti-affinity rule. In this case, an anti-affinity rule would force every pod to be on its own node, which would be inefficient.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions