Skip to content

Commit afeca10

Browse files
authored
Merge pull request #29193 from sftim/20210802_improve_statefulset_minreadyseconds_docs
Improve StatefulSet .minReadySeconds docs
2 parents 722d7bc + 03c2c0f commit afeca10

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

content/en/docs/concepts/workloads/controllers/statefulset.md

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -228,39 +228,33 @@ and Ready or completely terminated prior to launching or terminating another
228228
Pod. This option only affects the behavior for scaling operations. Updates are not
229229
affected.
230230

231-
#### Minimum Ready Seconds
232231

233-
{{< feature-state for_k8s_version="v1.22" state="alpha" >}}
234-
235-
`.spec.minReadySeconds` is an optional field that specifies the minimum number of seconds for which a newly
236-
created Pod should be ready without any of its containers crashing, for it to be considered available.
237-
This defaults to 0 (the Pod will be considered available as soon as it is ready). To learn more about when
238-
a Pod is considered ready, see [Container Probes](/docs/concepts/workloads/pods/pod-lifecycle/#container-probes).
232+
## Update strategies
239233

240-
Please note that this field only works if you enable the `StatefulSetMinReadySeconds` feature gate.
241-
## Update Strategies
242-
243-
In Kubernetes 1.7 and later, StatefulSet's `.spec.updateStrategy` field allows you to configure
234+
A StatefulSet's `.spec.updateStrategy` field allows you to configure
244235
and disable automated rolling updates for containers, labels, resource request/limits, and
245-
annotations for the Pods in a StatefulSet.
236+
annotations for the Pods in a StatefulSet. There are two possible values:
246237

247-
### On Delete
238+
`OnDelete`
239+
: When a StatefulSet's `.spec.updateStrategy.type` is set to `OnDelete`,
240+
the StatefulSet controller will not automatically update the Pods in a
241+
StatefulSet. Users must manually delete Pods to cause the controller to
242+
create new Pods that reflect modifications made to a StatefulSet's `.spec.template`.
248243

249-
The `OnDelete` update strategy implements the legacy (1.6 and prior) behavior. When a StatefulSet's
250-
`.spec.updateStrategy.type` is set to `OnDelete`, the StatefulSet controller will not automatically
251-
update the Pods in a StatefulSet. Users must manually delete Pods to cause the controller to
252-
create new Pods that reflect modifications made to a StatefulSet's `.spec.template`.
244+
`RollingUpdate`
245+
: The `RollingUpdate` update strategy implements automated, rolling update for the Pods in a StatefulSet. This is the default update strategy.
253246

254-
### Rolling Updates
247+
## Rolling Updates
255248

256-
The `RollingUpdate` update strategy implements automated, rolling update for the Pods in a
257-
StatefulSet. It is the default strategy when `.spec.updateStrategy` is left unspecified. When a StatefulSet's `.spec.updateStrategy.type` is set to `RollingUpdate`, the
249+
When a StatefulSet's `.spec.updateStrategy.type` is set to `RollingUpdate`, the
258250
StatefulSet controller will delete and recreate each Pod in the StatefulSet. It will proceed
259251
in the same order as Pod termination (from the largest ordinal to the smallest), updating
260-
each Pod one at a time. It will wait until an updated Pod is Running and Ready prior to
261-
updating its predecessor.
252+
each Pod one at a time.
253+
254+
The Kubernetes control plane waits until an updated Pod is Running and Ready prior
255+
to updating its predecessor. If you have set `.spec.minReadySeconds` (see [Minimum Ready Seconds](#minimum-ready-seconds)), the control plane additionally waits that amount of time after the Pod turns ready, before moving on.
262256

263-
#### Partitions
257+
### Partitioned rolling updates {#partitions}
264258

265259
The `RollingUpdate` update strategy can be partitioned, by specifying a
266260
`.spec.updateStrategy.rollingUpdate.partition`. If a partition is specified, all Pods with an
@@ -272,7 +266,7 @@ updates to its `.spec.template` will not be propagated to its Pods.
272266
In most cases you will not need to use a partition, but they are useful if you want to stage an
273267
update, roll out a canary, or perform a phased roll out.
274268

275-
#### Forced Rollback
269+
### Forced rollback
276270

277271
When using [Rolling Updates](#rolling-updates) with the default
278272
[Pod Management Policy](#pod-management-policies) (`OrderedReady`),
@@ -292,6 +286,16 @@ After reverting the template, you must also delete any Pods that StatefulSet had
292286
already attempted to run with the bad configuration.
293287
StatefulSet will then begin to recreate the Pods using the reverted template.
294288

289+
### Minimum ready seconds
290+
291+
{{< feature-state for_k8s_version="v1.22" state="alpha" >}}
292+
293+
`.spec.minReadySeconds` is an optional field that specifies the minimum number of seconds for which a newly
294+
created Pod should be ready without any of its containers crashing, for it to be considered available.
295+
This defaults to 0 (the Pod will be considered available as soon as it is ready). To learn more about when
296+
a Pod is considered ready, see [Container Probes](/docs/concepts/workloads/pods/pod-lifecycle/#container-probes).
297+
298+
Please note that this field only works if you enable the `StatefulSetMinReadySeconds` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/).
295299

296300
## {{% heading "whatsnext" %}}
297301

0 commit comments

Comments
 (0)