derailed/k9s · warning

desired %d replicas got %d available

Error message

desired %d replicas got %d available

What it means

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.

Source

Thrown at internal/render/sts.go:90

		sts.Namespace,
		sts.Name,
		computeVulScore(sts.Namespace, sts.Labels, &sts.Spec.Template.Spec),
		strconv.Itoa(int(sts.Status.ReadyReplicas)) + "/" + strconv.Itoa(int(desired)),
		asSelector(sts.Spec.Selector),
		na(sts.Spec.ServiceName),
		podContainerNames(&sts.Spec.Template.Spec, true),
		podImageNames(&sts.Spec.Template.Spec, true),
		mapToStr(sts.Labels),
		AsStatus(s.diagnose(desired, sts.Status.Replicas, sts.Status.ReadyReplicas)),
		ToAge(sts.GetCreationTimestamp()),
	}

	return nil
}

func (StatefulSet) diagnose(d, c, r int32) error {
	if c != r {
		return fmt.Errorf("desired %d replicas got %d available", c, r)
	}
	if d != r {
		return fmt.Errorf("want %d replicas got %d available", d, r)
	}

	return nil
}

View on GitHub (pinned to 2d3ccc6ba2)

Solutions

  1. Run kubectl rollout status sts/<name> to watch convergence
  2. Inspect unready pods (kubectl get pods -l <selector>, then describe) for the blocking reason
  3. Check PVC binding and the headless service StatefulSets depend on
  4. For OrderedReady sets one blocked pod stalls the rest — fix the lowest unready ordinal first

Example fix

# before: 3 current, 2 ready — one pod unready
kubectl rollout status sts/mysts --timeout=2m
# after: readiness converges and the diagnostic clears
kubectl get sts mysts -w
Defensive patterns

Strategy: validation

Validate before calling

# catch the condition before it renders
kubectl get sts -o json | jq '.items[] | select(.status.replicas != .status.readyReplicas) | {name:.metadata.name, current:.status.replicas, ready:.status.readyReplicas}'

Prevention

When it happens

Trigger: 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.

Common situations: StatefulSet pods waiting on PVC binding (WaitForFirstConsumer); headless service or storage issues; rolling updates blocked by podManagementPolicy OrderedReady; node pressure.

Related errors


AI-assisted analysis of derailed/k9s@2d3ccc6ba2 (2026-08-15). Data as JSON: /api/errors/ce9f55194c88dbc1. Report an issue: GitHub.