derailed/k9s · warning

container ready check failed: %d of %d

Error message

container ready check failed: %d of %d

What it means

Pod.diagnose first gate: if the count of ready containers differs from total containers (cr != ct), or the pod declares zero containers (ct == 0), it reports 'container ready check failed: X of Y'. Completed pods short-circuit before this check.

Source

Thrown at internal/render/pod.go:247

	cr, _, _, _ := p.ContainerStats(st.ContainerStatuses)
	ct := len(st.ContainerStatuses)

	icr, ict, _ := p.initContainerStats(spec.InitContainers, st.InitContainerStatuses)
	cr += icr
	ct += ict

	ready := hasPodReadyCondition(st.Conditions)
	rgr, rgt := p.readinessGateStats(spec, &st)

	return p.diagnose(phase, cr, ct, ready, rgr, rgt)
}

func (*Pod) diagnose(phase string, cr, ct int, ready bool, rgr, rgt int) error {
	if phase == Completed {
		return nil
	}
	if cr != ct || ct == 0 {
		return fmt.Errorf("container ready check failed: %d of %d", cr, ct)
	}
	if rgt > 0 && rgr != rgt {
		return fmt.Errorf("readiness gate check failed: %d of %d", rgr, rgt)
	}
	if !ready {
		return fmt.Errorf("pod condition ready is false")
	}
	if phase == Terminating {
		return fmt.Errorf("pod is terminating")
	}

	return nil
}

// ----------------------------------------------------------------------------
// Helpers...

func asNominated(n string) string {

View on GitHub (pinned to 2d3ccc6ba2)

Solutions

  1. kubectl describe pod <name> to see container states and probe results
  2. kubectl logs <pod> -c <container> for the not-ready container
  3. Fix the container (image, command, probe, resources) so it reaches Ready
  4. Give it a moment if the pod was just created — pull and probe delays are normal

Example fix

# before: probe hits wrong port, container never ready
readinessProbe:
  httpGet: {path: /ready, port: 80}
# after
readinessProbe:
  httpGet: {path: /ready, port: 8080}
Defensive patterns

Strategy: fallback

Validate before calling

ready, total := 0, len(pod.Spec.Containers)
for _, cs := range pod.Status.ContainerStatuses {
	if cs.Ready {
		ready++
	}
}
if ready == total && total > 0 {
	// container-level check will pass
}

Prevention

When it happens

Trigger: Multi-container pod where sidecar/main containers are still starting or crashing; init containers finished but app container not ready; ct == 0 for degenerate pod specs.

Common situations: Slow image pulls; crashlooping sidecars (envoy, log shippers); readiness probes not yet passing; pods viewed seconds after creation.

Related errors


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