mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 20:00:07 +00:00
When a pod has a sidecar (initContainer with restartPolicy: Always) with a startupProbe, and one or more regular containers crash after a kubelet restart, the kubelet fails to restart the regular containers. RestartCount stays at 0 indefinitely. When ChangeContainerStatusOnKubeletRestart is disabled (default in v1.35), the prober worker skips seeding probe results for containers that predate the kubelet restart. For a sidecar with a startupProbe this means startupManager.Get() returns found=false permanently. In computeInitContainerActions, the sidecar Running case breaks out early at the !found check, leaving podHasInitialized=false. computePodActions then returns early at the !hasInitialized guard without restarting the crashed regular containers. Fix: when the gate is off and a restartable init container's startup probe is being seeded for the first time after a kubelet restart, check the container's Started field in the pod status. If Started=true, the sidecar had already passed startup before the restart, so seed the startup manager with Success. This allows computeInitContainerActions to detect pod initialization via the sidecar Running path without altering readiness or liveness probe seeding behaviour. Add and update tests to cover the fix: - worker unit tests for sidecar startup/readiness/liveness restart behaviour - e2e node regression test for sidecar with startupProbe across kubelet restart Fixes: https://github.com/kubernetes/kubernetes/issues/136910