0

I want to try to have only one webserver per node, and if one webserver my autoscaler will add a new node but the scheduler seems to doesn't care about my podAntiAffinity rule. I think it's because of my "webserver-*". As the value can be random (it's a generated id so webserver-id)

tolerations:
  - key: "webserver-dedicated"
    operator: "Exists"
    effect: "NoSchedule"
affinity:
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
    - labelSelector:
        matchExpressions:
        - key: app
          operator: In
          values: 
          - webserver-*
      topologyKey: "kubernetes.io/hostname"
  nodeAffinity: 
    requiredDuringSchedulingIgnoredDuringExecution: 
      nodeSelectorTerms:
      - matchExpressions:
        - key: role 
          operator: In 
          values:
          - webserver 

That's what i've tried and i really don't understand why my podantiaffinity rule doesn't work

David Maze
  • 130,717
  • 29
  • 175
  • 215
tayka
  • 1
  • Does this answer your question? [Kubernetes : How to ensure one pod gets scheduled on each worker node?](https://stackoverflow.com/questions/66402138/kubernetes-how-to-ensure-one-pod-gets-scheduled-on-each-worker-node) – Software Engineer Nov 03 '22 at 19:13
  • Not really, i want to understand : Why two pod with label app=webserver are in same node, with the good toleration. Why the autoscaler didn't triggered a new node in this node pool with the good taints as i have a toleration and a node pool – tayka Nov 04 '22 at 18:48

0 Answers0