Kubernetes. Statefulset objects are by default spread among worker nodes?

10/25/2018

All the times I scale a statefulset the pods are started in different nodes.

I have tried to find documentation about this but I have not found anything.

Is this a default behavior of the Statefulset objects?

Thank you.

-- Jxadro
kubernetes

1 Answer

10/26/2018

You can control the scheduling of your pods by editing the affinity of the statefulset. (https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity)

But be aware that running all instances of a statefulset on one node causes an outage of your service if that node fails/dies. I would absolutely not recommend to schedule all instances of a statefulset on a single node.

-- Louis Baumann
Source: StackOverflow