From b638bd8b0394048a3f2de0a7cab77c4ac1893d2a Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Fri, 28 Jan 2022 17:07:37 -0500 Subject: [PATCH] kubelet: If the container status is created, we are waiting If CRI returns a container that has been created but is not running, it is not safe to assume it is terminal, as our connection to CRI may have failed. Instead, created is treated as waiting, as in "waiting for this container to start". Either syncPod or syncTerminatingPod is responsible for handling this state. --- pkg/kubelet/kubelet_pods.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pkg/kubelet/kubelet_pods.go b/pkg/kubelet/kubelet_pods.go index a6ec21bcc05..8c6af4851ee 100644 --- a/pkg/kubelet/kubelet_pods.go +++ b/pkg/kubelet/kubelet_pods.go @@ -1632,12 +1632,8 @@ func (kl *Kubelet) convertToAPIContainerStatuses(pod *v1.Pod, podStatus *kubecon case cs.State == kubecontainer.ContainerStateRunning: status.State.Running = &v1.ContainerStateRunning{StartedAt: metav1.NewTime(cs.StartedAt)} case cs.State == kubecontainer.ContainerStateCreated: - // Treat containers in the "created" state as if they are exited. - // The pod workers are supposed start all containers it creates in - // one sync (syncPod) iteration. There should not be any normal - // "created" containers when the pod worker generates the status at - // the beginning of a sync iteration. - fallthrough + // containers that are created but not running are "waiting to be running" + status.State.Waiting = &v1.ContainerStateWaiting{} case cs.State == kubecontainer.ContainerStateExited: status.State.Terminated = &v1.ContainerStateTerminated{ ExitCode: int32(cs.ExitCode),