kubernetes / website

Kubernetes website and documentation repo:
https://kubernetes.io
Creative Commons Attribution 4.0 International
4.37k stars 14.15k forks source link

Clarify behavior of parallel pod management policy of stateful sets #47085

Open mittal-ishaan opened 3 weeks ago

mittal-ishaan commented 3 weeks ago

Problem: I was facing the issue described in https://github.com/kubernetes/kubernetes/issues/67250

The way around discussed by community users to avoid this is to set the podManagementPolicy to Parallel. As suggested here

I have tried this and it works as expected, when I update the pod template to a good configuration it terminates all pods and does not wait for pods to be Running and Ready or completely terminated before launching or terminating another Pod.

All was good until I read the documentation for podManagementPolicy further, I saw one more line stated here

This option only affects the behaviour for scaling operations. Updates are not affected.

Setting it to Parallel worked for me and when I update the configuration, it works, contradicting what the above line in the docs says.

I went through the code for it and saw

https://github.com/kubernetes/kubernetes/blob/88313a445174e21ed326f40802429b854e5be9ba/pkg/controller/statefulset/stateful_set_control.go#L436-L440

when we set podManagementPolicy to parallel, monotonic is set to false and we never enter this if block. this in turn at the end leads to updating the pods.

https://github.com/kubernetes/kubernetes/blob/88313a445174e21ed326f40802429b854e5be9ba/pkg/controller/statefulset/stateful_set_control.go#L459

Proposed Solution: This doc change was added for the Kubernetes 1.11 version and I suppose the code has changed for it since then. I have verified that updates are indeed affected by the parallel pod management policy. We should update the docs to remove the line stating updates are not affected.

Page to Update: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset

Kubernetes Version: v1.30.0

k8s-ci-robot commented 3 weeks ago

This issue is currently awaiting triage.

SIG Docs takes a lead on issue triage for this website, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
Ritikaa96 commented 3 weeks ago

/sig apps /sig architecture /sig scheduling /kind bug