L
L
lugange2021-07-30 16:09:48
YAML
lugange, 2021-07-30 16:09:48

Pod Anti Affinity how to put two services on different nodes?

I made my chart with Vernemq in which I need to avoid hitting vernemq and kafka itself on the same node, added anti-affinity for this, but there is a problem, I want it to avoid hitting any node where there is at least something where kafka is present, how can i make it include all possible kafka service names here?

affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app.kubernetes.io/name
                operator: In
                values:
                - {{ include "vernemq.name" . }}
                - kafka
            topologyKey: "kubernetes.io/hostname"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vovanys, 2021-08-12
@lugange

well, add another custom label to the kafkas. and see that there are no intersections with it.
affinity label type. if this occurs, we do not populate the node.

U
unseriously, 2021-07-30
@unseriously

regex?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question