I would like the pod to wait some additional seconds before treat it as ready when rolling restart statefulset. I have searched the doc, it says minReadySeconds
is used to do so. But in my testing, if I set podManagementPolicy
to Parallel
, the minReadySeconds
won’t take effective. If I use the default podManagementPolicy
, it can work. Is it expected?
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: web
spec:
selector:
matchLabels:
app: nginx # has to match .spec.template.metadata.labels
serviceName: "nginx"
replicas: 2 # by default is 1
minReadySeconds: 30 # by default is 0
podManagementPolicy: Parallel
updateStrategy:
type: RollingUpdate
template:
I am testing it on k8s 1.24
2
Answers
MinReadySeconds indicates how long will the pod be considered ready after it’s updated. MinReadySeconds works with both OrderedReady and Parallel podManagementPolicy. It affects the pod scale up speed when the podManagementPolicy is set to be OrderedReady the default one
Another note:Combined with MaxUnavailable, it affects the pod update speed regardless of podManagementPolicy
@leonard520 That is related to the default recreate deployment strategy of Kubernetes, it terminates the old pod the starts the new one sequentially. If you ever want to update it the way that it starts the termination of the old pod and the creation of the new one paralelly, you can update the deployment strategy and replace it with rollingUpdate with 1 maxSurge & 1 maxUnavailable under spec section:
Here is an attached reference to deeply understand how deployment strategies exactly work & how you can manage them relating to the desired result: https://www.youtube.com/watch?v=LQI19ngeLsA