3

I want a Kubernetes StatefulSet with:

  • Number of Replicas/Pods = Number of Nodes in Kubernetes Cluster
  • One Pod on on every node

Is there a simple example on how to solve this typical requirement?

Community
  • 1
  • 1
Simon_Prewo_Frankfurt
  • 1,209
  • 2
  • 11
  • 18
  • You can use daemonset for this requirement instead of statefulsets. Daemonset provides you a pod on each node. https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ – Prafull Ladha Mar 12 '19 at 11:48

1 Answers1

3

DaemonSets are exactly what you're looking for. They're a tool which will run a single Pod on every node for your resource. If a new node is created - a new Pod is created on it.

You can find further information onto how they're implemented at the following URL in the documentation:

https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/

Neekoy
  • 2,325
  • 5
  • 29
  • 48
  • 2
    What if OP (or me actually) needs a stateful set for some of gurantees it provides (ex stable, unique network identifiers or ordered, automated rolling updates.) – Lan Jun 10 '19 at 18:34
  • I think --max-pods can also be used to limit the no of pod. https://stackoverflow.com/questions/60278561/increase-max-pod-on-node – TechDog Sep 27 '22 at 12:19