In Kubernetes StatefulSets with OrderedReady pod management policy, pods are created sequentially and each pod must reach Ready state before the next one is scheduled. The "waiting for ordinal not yet ready" condition occurs when a pod cannot achieve Ready state, blocking subsequent pods from starting.
StatefulSets with the default OrderedReady pod management policy enforce strict ordering: pods are created in ordinal order (pod-0, pod-1, pod-2, etc.), and each pod must pass all readiness checks before the next one begins initializing. When a pod gets stuck (not becoming Ready), the entire StatefulSet deployment stalls. A pod is considered "Ready" when: (1) all containers are running, (2) any readiness probes defined in the container spec return success, and (3) the pod's status condition transitions to Ready. If any of these conditions fail to materialize, subsequent pods wait indefinitely and the StatefulSet cannot scale up.
List all pods in the StatefulSet:
kubectl get pods -n <namespace> -l app=<statefulset-name>Look for the pod with the highest ordinal that is not Ready. Check its status in detail:
kubectl describe pod <statefulset-name>-<ordinal> -n <namespace>Note the conditions section and recent events. The "Waiting for ordinal" message comes from a later pod; find the actual pod that cannot transition to Ready by looking at earlier ordinals.
Examine the logs of the pod preventing others from starting:
kubectl logs <statefulset-name>-0 -n <namespace> # Check pod-0 if it's blocking
kubectl logs <statefulset-name>-0 -n <namespace> --all-containers=true # Include init containers
kubectl logs <statefulset-name>-0 -n <namespace> --previous # If pod crashed and restartedLook for error messages, exceptions, or timeouts. Common patterns:
- "Connection refused" (service not ready)
- "Timeout" (waiting for dependency)
- Application startup errors
- "OOMKilled" or "Evicted" (resource issues)
Check the StatefulSet definition for readiness probes:
kubectl get statefulset <statefulset-name> -n <namespace> -o yaml | grep -A 10 "readinessProbe"Common issues:
- initialDelaySeconds too short for app startup time
- Wrong path, port, or scheme for the probe endpoint
- timeoutSeconds too aggressive (default 1s)
- Readiness endpoint returning error due to missing dependencies
Example fix in StatefulSet manifest:
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 30 # Give app time to start
periodSeconds: 5
timeoutSeconds: 2Apply changes:
kubectl apply -f statefulset.yamlGet the full pod status:
kubectl get pod <statefulset-name>-0 -n <namespace> -o wide
kubectl get pod <statefulset-name>-0 -n <namespace> -o jsonpath="{.status}"Look for:
- Container ready: "ContainerReady=True" vs "False"
- Ready condition: "Ready=True" vs "False"
- Actual error in containerStatuses section
Test the readiness endpoint manually if pod is running:
kubectl exec -it <statefulset-name>-0 -n <namespace> -- curl -v http://localhost:8080/healthIf this fails, the application isn't responding correctly to readiness checks.
If the StatefulSet uses init containers, check their status:
kubectl describe pod <statefulset-name>-0 -n <namespace>Look for "Init Containers" section. Each must show "State: Terminated" with "Exit Code: 0". If stuck:
kubectl logs <statefulset-name>-0 -n <namespace> -c <init-container-name>Common init container issues:
- Downloading configuration files that don't exist
- Waiting for DNS names that haven't resolved
- Network calls timing out
Increase timeouts or fix the network issue, then delete the pod to restart:
kubectl delete pod <statefulset-name>-0 -n <namespace>Verify the pod can be scheduled:
kubectl describe pod <statefulset-name>-0 -n <namespace> | grep -A 5 "Events"If you see "Pending" with event "insufficient cpu" or "insufficient memory", check resource requests:
kubectl describe statefulset <statefulset-name> -n <namespace> | grep -A 20 "Limits\|Requests"Check node capacity:
kubectl describe nodes
kubectl top nodes # Requires metrics-serverIf resource-constrained, either add more nodes or reduce pod requests:
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"If pods need to communicate (e.g., database cluster setup), verify connectivity:
kubectl exec -it <statefulset-name>-1 -n <namespace> -- /bin/bash
# Inside pod, test connection to earlier pod:
nslookup <statefulset-name>-0.<headless-service-name>.<namespace>.svc.cluster.local
telnet <statefulset-name>-0.<headless-service-name>.<namespace>.svc.cluster.local 5432 # For databaseVerify headless Service exists and targets the StatefulSet:
kubectl get svc <headless-service-name> -n <namespace> -o yaml
kubectl get endpoints <headless-service-name> -n <namespace>If DNS or connectivity fails, check CNI plugin and network policies:
kubectl get pods -n kube-system -l tier=cni # Check CNI pods
kubectl get networkpolicies -n <namespace>If the blocking pod is slow but eventually becomes healthy, temporarily relax readiness requirements:
kubectl patch statefulset <statefulset-name> -n <namespace> -p '{"spec": {"template": {"spec": {"containers": [{"name": "<container-name>", "readinessProbe": {"initialDelaySeconds": 60, "timeoutSeconds": 5, "periodSeconds": 10}}]}}}}'Or edit directly:
kubectl edit statefulset <statefulset-name> -n <namespace>Increase initialDelaySeconds and timeoutSeconds. This is temporary; investigate root cause in parallel.
If strict pod ordering isn't necessary for your application, change to Parallel policy:
kubectl patch statefulset <statefulset-name> -n <namespace> -p '{"spec": {"podManagementPolicy": "Parallel"}}'With Parallel, all pods start simultaneously regardless of Ready state. Useful for stateless workloads or when pod dependencies are handled by the application, not Kubernetes.
Modify manifest:
spec:
podManagementPolicy: Parallel
# ... rest of specWarning: Use only if your application doesn't require strict initialization ordering. Most stateful databases (MySQL, PostgreSQL, Cassandra, etc.) require OrderedReady.
In production StatefulSets, the initialization order is critical for stateful applications. Databases like MySQL (with Percona XtraDB) expect ordinal-0 to be the primary and ordinal-1+ to join as replicas. If you have a custom readiness endpoint, ensure it correctly reports readinessβa common pitfall is reporting "ready" before dependencies (like initialization scripts or cluster bootstrapping) complete. For distributed systems, use initialDelaySeconds that accounts for your slowest startup scenario plus 10-20% buffer. In CI/CD pipelines, Helm or ArgoCD may timeout waiting for StatefulSets; adjust helm install --timeout and ArgoCD syncPolicy.syncOptions to increase wait times. Pod disruption budgets (PDB) can also interact with this: if a PDB is too restrictive, pod eviction during maintenance may fail, blocking the entire StatefulSet. Finally, consider using StatefulSet lifecycle hooks (postStart, preStop) for coordination between pods rather than relying solely on readiness probes.
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