Summary
A BatchSandbox can remain permanently in Failed even when the same Pod later recovers to Running and Ready after a transient container-creation failure.
This leaves the control-plane state inconsistent with the actual Pod and causes clients that observed Failed to abandon an otherwise running sandbox.
Observed timeline
The following sequence was observed on a single-Pod BatchSandbox:
-
The Pod was scheduled successfully; its sandbox, init container, image pull, and sidecar startup all succeeded.
-
Creating the main container took longer than the runtime deadline and kubelet emitted:
Create container agent error: context deadline exceeded
-
A retry shortly afterward reported:
container name ... already existed
-
The BatchSandbox phase changed from Pending to Failed.
-
About 85 seconds later, kubelet successfully created and started the same main container.
-
The Pod became Running and Ready, but the BatchSandbox remained Failed indefinitely.
There was no rescheduling or replacement Pod involved.
Current behavior
applySteadyRuntimePhase returns immediately when the existing BatchSandbox phase is Failed:
if status.Phase == sandboxv1alpha1.BatchSandboxPhaseFailed {
return
}
Therefore a later reconciliation cannot restore Succeed, even when all observed Pods are Running and Ready and no current failure remains.
Expected behavior
Transient container-creation failures should not leave a BatchSandbox permanently inconsistent with a recovered Pod.
Possible approaches:
- avoid making the BatchSandbox terminal while the same Pod can still complete container creation; or
- allow a narrowly scoped
Failed -> Succeed reconciliation when the same Pod subsequently becomes Running and Ready and the recorded failure is no longer present.
The recovery rule should not hide genuine terminal failures or treat a replacement Pod as recovery without an explicit policy.
Suggested regression test
- Start with a
Pending BatchSandbox and a Pod reporting a transient container creation failure.
- Reconcile it to
Failed.
- Update the same Pod to
Running, Ready, with the main container running and no active waiting/terminated failure.
- Reconcile again.
- Verify the BatchSandbox no longer remains stale in
Failed (according to the chosen recovery semantics).
This is related to status convergence, but distinct from detecting a main-container restart after a sandbox was already Ready.
Summary
A
BatchSandboxcan remain permanently inFailedeven when the same Pod later recovers toRunningand Ready after a transient container-creation failure.This leaves the control-plane state inconsistent with the actual Pod and causes clients that observed
Failedto abandon an otherwise running sandbox.Observed timeline
The following sequence was observed on a single-Pod BatchSandbox:
The Pod was scheduled successfully; its sandbox, init container, image pull, and sidecar startup all succeeded.
Creating the main container took longer than the runtime deadline and kubelet emitted:
A retry shortly afterward reported:
The BatchSandbox phase changed from
PendingtoFailed.About 85 seconds later, kubelet successfully created and started the same main container.
The Pod became
Runningand Ready, but the BatchSandbox remainedFailedindefinitely.There was no rescheduling or replacement Pod involved.
Current behavior
applySteadyRuntimePhasereturns immediately when the existing BatchSandbox phase isFailed:Therefore a later reconciliation cannot restore
Succeed, even when all observed Pods are Running and Ready and no current failure remains.Expected behavior
Transient container-creation failures should not leave a BatchSandbox permanently inconsistent with a recovered Pod.
Possible approaches:
Failed -> Succeedreconciliation when the same Pod subsequently becomes Running and Ready and the recorded failure is no longer present.The recovery rule should not hide genuine terminal failures or treat a replacement Pod as recovery without an explicit policy.
Suggested regression test
PendingBatchSandbox and a Pod reporting a transient container creation failure.Failed.Running, Ready, with the main container running and no active waiting/terminated failure.Failed(according to the chosen recovery semantics).This is related to status convergence, but distinct from detecting a main-container restart after a sandbox was already Ready.