Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Immediately scale up Kubernetes Statefulset/Deployment to full capacity

currently we scaled one of our statefulsets to have 11 replicas. Our current updateStrategy is

updateStrategy:
  type: RollingUpdate

If we deploy the statefulset from scratch, Kubernetes starts them one after another. To start one replica it needs around 5 Minutes. So in total we wait 55 Minutes just to fill up the capacity.

Is there a way to fill up the capacity at once when starting from scratch? So that all 11 replicas will start simultaneously?

Upgrades on the already existing statefulset should be handled via RollingUpdate due to failure safety.

Best wishes, Stephan

like image 341
Stephan Avatar asked Nov 15 '25 04:11

Stephan


2 Answers

we found the answer hiding deep in the documentation:

https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#parallel-pod-management

https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#pod-management-policies

Pod Management Policies

In Kubernetes 1.7 and later, StatefulSet allows you to relax its ordering guarantees while preserving its uniqueness and identity guarantees via its .spec.podManagementPolicy field.

OrderedReady Pod Management

OrderedReady pod management is the default for StatefulSets. It implements the behavior described above.

Parallel Pod Management

Parallel pod management tells the StatefulSet controller to launch or terminate all Pods in parallel, and to not wait for Pods to become Running and Ready or completely terminated prior to launching or terminating another Pod. This option only affects the behavior for scaling operations. Updates are not affected.

like image 138
Stephan Avatar answered Nov 17 '25 18:11

Stephan


I don't think so. StatefulSets are designed for safety above all else so the controller operates one pod at a time.

like image 30
coderanger Avatar answered Nov 17 '25 20:11

coderanger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!