How to select concrete Pod from StatefulSet and assign it to concrete Node

6/19/2018

Good day, does kubernetes StatefulSet has an option for set concrete Pod to concrete Node.

For example: we have StatefulSet that contained 3 replicas of Pod's with unique labels (app-0, app-1, app-2) and 3 Node's with labels (node-0, node-1, node-2). How to point on Pod from StatefulSet with label app-0 to node with label node-0? In official documentation of StatefulSet, PodAffinity and NodeAffifnity i dont find any information how to do this.

Any suggestions

-- Alexey Nikulin
kubernetes
statefulset

1 Answer

6/20/2018

Unfortunately, now in Kubernetes v1.10 there’s no instrument to do this, but anyway, with pod affinity, you can distribute your pods on each node, and if memory serves me, in StatefulSets you have absolutely the same pod. It is not critical if pod app-1 is stored on node-2 and pod app-2 on node-1 because you still have the same two pods on 2 different nodes, haven’t you?

-- Nick Rak
Source: StackOverflow