0

I am in situation where number of nodes is reasonably large. Nodes are consumable and can be added and removed (if idle) at any time. All nodes would have labels

label.category=A or label.category=B

I want to schedule my pods onto nodes with the same category. I really do not wish to hardcode which one. All I want is that a group of pods would end up in the same category nodes.

bioffe
  • 6,283
  • 3
  • 50
  • 65

1 Answers1

4

you may wanted to use Pod Topology Spread Constraints, as example below

apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
 topologySpreadConstraints:
    - maxSkew: <integer>
      topologyKey: <string>
      whenUnsatisfiable: <string>
      labelSelector: <object>
  • 1
    topologyKey is the secret souce. Thank you very much. I wish I could upvote your answer several times. – bioffe Feb 25 '21 at 23:26