Imagine I have some pods I need on separate k8s nodes, I could use something like this if I know both pods have a label my/label=somevalue
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 2
podAffinityTerm:
labelSelector:
matchLabels:
my/label: somevalue
I have some pods I need separated, according to multiple values of the same label, which doesn't known up-front (it's a shared key which is calculated by an operator).
Is there a way of specifying a podAffinityTerm
which applies to any pods sharing the same value of my.label
, regardless of the actual value?
E.g.
Pod a has my/label=x
Pod b has my/label=x
Pod c has my/label=y
Pod d has my/label=y
I'd need pods a & b separated from each other, and pods c & d separated form each other, but e.g. a and d can coexist on the same node