{"record":{"id":"ce9f55194c88dbc1","repo":"derailed/k9s","slug":"desired-d-replicas-got-d-available","errorCode":null,"errorMessage":"desired %d replicas got %d available","messagePattern":"desired (.+?) replicas got (.+?) available","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/render/sts.go","lineNumber":90,"sourceCode":"\t\tsts.Namespace,\n\t\tsts.Name,\n\t\tcomputeVulScore(sts.Namespace, sts.Labels, &sts.Spec.Template.Spec),\n\t\tstrconv.Itoa(int(sts.Status.ReadyReplicas)) + \"/\" + strconv.Itoa(int(desired)),\n\t\tasSelector(sts.Spec.Selector),\n\t\tna(sts.Spec.ServiceName),\n\t\tpodContainerNames(&sts.Spec.Template.Spec, true),\n\t\tpodImageNames(&sts.Spec.Template.Spec, true),\n\t\tmapToStr(sts.Labels),\n\t\tAsStatus(s.diagnose(desired, sts.Status.Replicas, sts.Status.ReadyReplicas)),\n\t\tToAge(sts.GetCreationTimestamp()),\n\t}\n\n\treturn nil\n}\n\nfunc (StatefulSet) diagnose(d, c, r int32) error {\n\tif c != r {\n\t\treturn fmt.Errorf(\"desired %d replicas got %d available\", c, r)\n\t}\n\tif d != r {\n\t\treturn fmt.Errorf(\"want %d replicas got %d available\", d, r)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":72,"sourceCodeEnd":98,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/render/sts.go#L72-L98","documentation":"StatefulSet.diagnose receives (desired=spec.replicas, current=status.replicas, ready=status.readyReplicas). When current != ready it returns 'desired C replicas got R available' — note the 'desired' figure is actually status.replicas, the current count — and AsStatus shows it in the VALID column. Meaning: not all current StatefulSet pods are ready. Like all diagnose output it is status text and never an error returned to the caller.","triggerScenarios":"A StatefulSet where status.replicas > status.readyReplicas: unready pods from failed probes, CrashLoop, or Pending on storage/node constraints; viewing the STS view during startup, scale-up, or rollout.","commonSituations":"StatefulSet pods waiting on PVC binding (WaitForFirstConsumer); headless service or storage issues; rolling updates blocked by podManagementPolicy OrderedReady; node pressure.","solutions":["Run kubectl rollout status sts/<name> to watch convergence","Inspect unready pods (kubectl get pods -l <selector>, then describe) for the blocking reason","Check PVC binding and the headless service StatefulSets depend on","For OrderedReady sets one blocked pod stalls the rest — fix the lowest unready ordinal first"],"exampleFix":"# before: 3 current, 2 ready — one pod unready\nkubectl rollout status sts/mysts --timeout=2m\n# after: readiness converges and the diagnostic clears\nkubectl get sts mysts -w","handlingStrategy":"validation","validationCode":"# catch the condition before it renders\nkubectl get sts -o json | jq '.items[] | select(.status.replicas != .status.readyReplicas) | {name:.metadata.name, current:.status.replicas, ready:.status.readyReplicas}'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use kubectl rollout status sts/<name> to wait for readiness convergence","Ensure PVCs and the headless service exist before scaling StatefulSets","With OrderedReady, fix the lowest unready ordinal first — it gates the rest","Treat the VALID column as workload health, not an error to catch"],"tags":["kubernetes","workloads","statefulset","cluster-state","health","k9s"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}