StatefulSet partition controls phased rolling updates by specifying which pod ordinals receive new versions. Misconfigured partitions can prevent updates from propagating or leave StatefulSets stuck in non-ready states. Fix by correctly configuring the updateStrategy.rollingUpdate.partition value relative to replicas.
StatefulSets support partitioned rolling updates via the .spec.updateStrategy.rollingUpdate.partition field. This allows staged deployments: pods with ordinals >= partition receive new template versions, while pods with ordinals < partition retain the old version. This is useful for canary deployments and phased rollouts. Issues occur when the partition value is misconfigured relative to the number of replicas, preventing updates or blocking pod readiness.
Check the StatefulSet spec and current pod states:
kubectl get statefulset <name> -o jsonpath='{.spec.updateStrategy.rollingUpdate.partition}'
# Should return a number or null (0)
kubectl get statefulset <name> -o yaml | grep -A 5 updateStrategy
kubectl get pods -l app=<app-label> --sort-by=.metadata.nameNote the current partition value and number of replicas.
StatefulSet partition works as follows:
replicas: 3 (pods: app-0, app-1, app-2)
partition: 2
Result:
- Pods app-2 (ordinal >= 2): Get NEW template
- Pods app-0, app-1 (ordinal < 2): Keep OLD templateIf partition is greater than or equal to replicas, NO pods receive updates:
replicas: 3
partition: 3 # BUG - no pods update
partition: 5 # BUG - no pods updateIf StatefulSet is stuck, reset partition to 0 (all pods get updated):
kubectl patch statefulset <name> -p '{"spec":{"updateStrategy":{"type":"RollingUpdate","rollingUpdate":{"partition":0}}}}'
# Verify patch applied
kubectl get statefulset <name> -o jsonpath='{.spec.updateStrategy.rollingUpdate.partition}'This forces the rolling update to proceed for all pods.
To update only pods with ordinal >= N:
# Test update on pod-2 only (3 replicas, partition=2)
kubectl patch statefulset web -p '{"spec":{"updateStrategy":{"type":"RollingUpdate","rollingUpdate":{"partition":2}}}}'
# Update pod template
kubectl set image statefulset/web web=myapp:v2
# Monitor pod-2 update
kubectl rollout status statefulset/web
# Once pod-2 is healthy, allow pod-1
kubectl patch statefulset web -p '{"spec":{"updateStrategy":{"type":"RollingUpdate","rollingUpdate":{"partition":1}}}}'
# Finally, allow pod-0
kubectl patch statefulset web -p '{"spec":{"updateStrategy":{"type":"RollingUpdate","rollingUpdate":{"partition":0}}}}'If pods are stuck despite partition reset, check pod readiness:
# Check why pods aren't ready
kubectl describe pod <name-0>
# Look for: conditions, events, and recent restarts
kubectl logs <name-0> --previous # If pod was killed
kubectl get pod <name-0> -o yaml | grep -A 10 conditionsOrderedReady waits for pod N before updating pod N+1. If pod-0 never becomes Ready, pod-1 and pod-2 won't update. Fix the pod template (bad binary, missing config, resource limits, etc.) first.
Monitor partition update progress:
# Watch partition field and pod updates
kubectl get statefulset <name> -w
# Check individual pod templates
kubectl get pod <name-2> -o jsonpath='{.spec.containers[0].image}'
# For kubectl describe displaying incorrect partition (pre-1.27 bug)
kubectl describe statefulset <name> | grep Partition
# Ignore if it shows a large number; check with jsonpath insteadSeveral partition-related bugs were fixed in recent Kubernetes versions:
- v1.28+: Improved partition status reporting in rollout progress
- v1.27: Fixed kubectl describe showing pointer instead of partition value
- v1.26+: More reliable partition state transitions
If running older versions:
kubectl version --short # Check your version
# Consider upgrading via kubeadm or cloud provider toolsCheck your cluster's upgrade path and plan the upgrade.
Partition enables canary deployments and staged rollouts without templating tools. For complex rollout strategies, consider using tools like Flagger, Argo Rollouts, or cloud provider features (GKE Autopilot rollout policies). Note: partition works with RollingUpdate strategy only (not OnDelete). When partition equals or exceeds replicas, updates don't propagateβa common mistake. OrderedReady policy makes partition debugging harder since pod N-1 must be Ready before pod N updates. For stateless workloads or rapid iteration, consider Deployment instead of StatefulSet.
No subnets found for EKS cluster
How to fix "eks subnet not found" in Kubernetes
unable to compute replica count
How to fix "unable to compute replica count" in Kubernetes HPA
error: context not found
How to fix "error: context not found" in Kubernetes
default backend - 404
How to fix "default backend - 404" in Kubernetes Ingress
serviceaccount cannot list resource
How to fix "serviceaccount cannot list resource" in Kubernetes