kubernetes: Ephemeral storage limits error ContainerStatusUnknown

What happened?

Pods are not being cleaned up once Ephemeral storage limits are hit

k describe pods -n ephemeral-metrics grow-test-7484cd87cb-wvpgt 
Events:
  Type     Reason               Age    From               Message
  ----     ------               ----   ----               -------
  Normal   Scheduled            4m52s  default-scheduler  Successfully assigned ephemeral-metrics/grow-test-7484cd87cb-q9ngs to ephemeral-metrics-cluster-worker
  Normal   Pulled               4m53s  kubelet            Container image "local.io/local/grow-test:latest" already present on machine
  Normal   Created              4m53s  kubelet            Created container grow-test
  Normal   Started              4m53s  kubelet            Started container grow-test
  Warning  Evicted              4m51s  kubelet            Pod ephemeral local storage usage exceeds the total limit of containers 5Ki.
  Normal   Killing              4m51s  kubelet            Stopping container grow-test
  Warning  ExceededGracePeriod  4m41s  kubelet            Container runtime did not kill the pod within specified grace period.
$ kubectl get pods 
ephemeral-metrics    grow-test-7484cd87cb-7lxp4                                        0/1     ContainerStatusUnknown   1              2m31s
ephemeral-metrics    grow-test-7484cd87cb-clqxj                                        0/1     ContainerStatusUnknown   1              3m3s
ephemeral-metrics    grow-test-7484cd87cb-gpxfk                                        0/1     ContainerStatusUnknown   1              119s
ephemeral-metrics    grow-test-7484cd87cb-gxqqr                                        0/1     ContainerStatusUnknown   1              3m35s
ephemeral-metrics    grow-test-7484cd87cb-j8fb7                                        1/1     Running                  0              23s
ephemeral-metrics    grow-test-7484cd87cb-psjpf                                        0/1     ContainerStatusUnknown   1              55s
ephemeral-metrics    grow-test-7484cd87cb-wvpgt                                        0/1     Error                    0              4m13s
ephemeral-metrics    grow-test-7484cd87cb-xqnnx                                        0/1     ContainerStatusUnknown   1              87s

What did you expect to happen?

Pods to be cleaned up when an error occurs and a status that reflects the error better.

How can we reproduce it (as minimally and precisely as possible)?

Add this to a pod manifest.

          resources:
            requests:
              ephemeral-storage: "1Ki"
            limits:
              ephemeral-storage: "5Ki"

I used this containerfile. I can publish if needed. https://github.com/jmcgrath207/k8s-ephemeral-storage-metrics/blob/master/DockerfileTestGrow

Anything else we need to know?

No response

Kubernetes version

Kind Cluster

Client Version: v1.28.4
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.27.0

Cloud provider

OS version

# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here

Install tools

Container runtime (CRI) and version (if applicable)

Related plugins (CNI, CSI, …) and versions (if applicable)

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 7
  • Comments: 50 (32 by maintainers)

Commits related to this issue

Most upvoted comments

Hello, I’ve replicated this scenario using limited ephemeral storage, resulting in ContainerStatusUnknown pod status.

  • EKS version 1.31
apiVersion: v1
kind: Pod
metadata:
  name: nodejs-bigfiles
  namespace: default
spec:
  containers:
    - name: nodejs-bigfiles
      image: nodejs-createbigfiles-disk:latest
      resources:
        limits:
          ephemeral-storage: "200Mi"
        requests:
          ephemeral-storage: "100Mi"
      imagePullPolicy: Always
      ports:
        - containerPort: 3000
    - name: sidecar-container
      image: busybox
      command:
        [
          "sh",
          "-c",
          "while true; do echo Sidecar container running; sleep 10; done",
        ]
  imagePullSecrets:
    - name: regcred

Output:

nodejs-bigfiles:
    Container ID:
    Image:          nodejs-createbigfiles-disk:latest
    Image ID:
    Port:           3000/TCP
    Host Port:      0/TCP
    State:          Terminated
      Reason:       ContainerStatusUnknown
      Message:      The container could not be located when the pod was terminated
      Exit Code:    137
      Started:      Mon, 01 Jan 0001 00:00:00 +0000
      Finished:     Mon, 01 Jan 0001 00:00:00 +0000
    Last State:     Terminated
      Reason:       ContainerStatusUnknown
      Message:      The container could not be located when the pod was deleted.  The container used to be Running
      Exit Code:    137
      Started:      Mon, 01 Jan 0001 00:00:00 +0000
      Finished:     Mon, 01 Jan 0001 00:00:00 +0000
    Ready:          False

sidecar-container:
    Container ID:
    Image:         busybox
    Image ID:
    Port:          <none>
    Host Port:     <none>
    Command:
      sh
      -c
      while true; do echo Sidecar container running; sleep 10; done
    State:          Terminated
      Reason:       ContainerStatusUnknown
      Message:      The container could not be located when the pod was terminated
      Exit Code:    137
      Started:      Mon, 01 Jan 0001 00:00:00 +0000
      Finished:     Mon, 01 Jan 0001 00:00:00 +0000
    Last State:     Terminated
      Reason:       ContainerStatusUnknown
      Message:      The container could not be located when the pod was deleted.  The container used to be Running
      Exit Code:    137
      Started:      Mon, 01 Jan 0001 00:00:00 +0000
      Finished:     Mon, 01 Jan 0001 00:00:00 +0000

Events:
  Type     Reason               Age                From               Message
  ----     ------               ----               ----               -------
  Normal   Scheduled            16m                default-scheduler  Successfully assigned default/nodejs-bigfiles to i-000000.ec2.internal
  Normal   Pulling              16m                kubelet            Pulling image "nodejs-createbigfiles-disk:latest"
  Normal   Pulled               16m                kubelet            Successfully pulled image "nodejs-createbigfiles-disk:latest" in 167ms (167ms including waiting)
  Normal   Created              16m                kubelet            Created container nodejs-bigfiles
  Normal   Started              16m                kubelet            Started container nodejs-bigfiles
  Normal   Pulling              16m                kubelet            Pulling image "busybox"
  Normal   Pulled               16m                kubelet            Successfully pulled image "busybox" in 462ms (462ms including waiting)
  Normal   Created              16m                kubelet            Created container sidecar-container
  Normal   Started              16m                kubelet            Started container sidecar-container
  Normal   Killing              16m                kubelet            Stopping container nodejs-bigfiles
  Normal   Killing              16m                kubelet            Stopping container sidecar-container
  Warning  Evicted              15m (x2 over 16m)  kubelet            Pod ephemeral local storage usage exceeds the total limit of containers 200Mi.
  Warning  ExceededGracePeriod  15m (x2 over 16m)  kubelet            Container runtime did not kill the pod within specified grace period.

Thanks @skizot722 and @max0ne for a repro script. I was able to repro the issue in my cluster. I found out the root cause. I’m not familiar with the codebase, but I have a potential fix in https://github.com/AnishShah/kubernetes/commit/0663ab8f0a430312834ea3c16952d8b50a419cd6.

Root cause:

  1. This is the code where we kill pods after eviction. Here, the container runtime only stops the container (but does not remove it) - https://github.com/kubernetes/kubernetes/blob/3df07e446b8c0befab3551c3001c71340710751c/pkg/kubelet/kubelet.go#L2025

  2. After the pod is killed, we update the pod status here by fetching status from container runtime - https://github.com/kubernetes/kubernetes/blob/3df07e446b8c0befab3551c3001c71340710751c/pkg/kubelet/kubelet.go#L2043-L2088

  3. Between step 1 and 2, there’s some race condition that is removing the container completely. So at step 2, it is unable to find any ContainerStatus and hence, it sets ContainerStatusUnknown. You can see from the logs here -

time="2024-03-01T06:03:03.657059922Z" level=info msg="StopContainer for \"4de0f76ab37060832789ba601a6abaca7ce25cf536b00bdf911d1f5ce2b1864c\" returns successfully"
I0301 06:03:03.657766 253123 kuberuntime_container.go:754] "Container exited normally" pod="default/gke-128-container-status-unknown-9666496cb-g97tt" podUID="9c554036-bba1-45c5-8e0f-d8d07eb4a977" containerName="gke-128-container-status-unknown" containerID="containerd://4de0f76ab37060832789ba601a6abaca7ce25cf536b00bdf911d1f5ce2b1864c"
time="2024-03-01T06:03:03.658106572Z" level=info msg="Container to stop \"4de0f76ab37060832789ba601a6abaca7ce25cf536b00bdf911d1f5ce2b1864c\" must be in running or unknown state, current state \"CONTAINER_EXITED\""
I0301 06:03:03.711750 253123 kuberuntime_container.go:1197] "Removing container" containerID="4de0f76ab37060832789ba601a6abaca7ce25cf536b00bdf911d1f5ce2b1864c"
I0301 06:03:03.711782 253123 scope.go:117] "RemoveContainer" containerID="4de0f76ab37060832789ba601a6abaca7ce25cf536b00bdf911d1f5ce2b1864c"
time="2024-03-01T06:03:03.714454338Z" level=info msg="RemoveContainer for \"4de0f76ab37060832789ba601a6abaca7ce25cf536b00bdf911d1f5ce2b1864c\""
time="2024-03-01T06:03:03.739204946Z" level=info msg="RemoveContainer for \"4de0f76ab37060832789ba601a6abaca7ce25cf536b00bdf911d1f5ce2b1864c\" returns successfully"
I0301 06:03:03.811827 253123 kuberuntime_manager.go:1433] "getSandboxIDByPodUID got sandbox IDs for pod" podSandboxID=["87f94e529b9c309409098f500de026c0e99aed6fdb5f3a69693e35eb815f03f7"] pod="default/gke-128-container-status-unknown-9666496cb-g97tt"
I0301 06:03:03.813460 253123 kubelet.go:2046] "Post-termination container state" pod="default/gke-128-container-status-unknown-9666496cb-g97tt" podUID="9c554036-bba1-45c5-8e0f-d8d07eb4a977" containers=null
I0301 06:03:03.813611 253123 kubelet_pods.go:1668] "Got phase for pod" pod="default/gke-128-container-status-unknown-9666496cb-g97tt" oldPhase="Failed" phase="Failed"
I0301 06:03:03.813494 253123 kubelet_pods.go:1655] "Generating pod status" podIsTerminal=true pod="default/gke-128-container-status-unknown-9666496cb-g97tt"
I0301 06:03:03.813710 253123 kubelet.go:2069] "Pod termination stopped all running containers" pod="default/gke-128-container-status-unknown-9666496cb-g97tt" podUID="9c554036-bba1-45c5-8e0f-d8d07eb4a977"
I0301 06:03:03.813731 253123 kubelet.go:2071] "SyncTerminatingPod exit" pod="default/gke-128-container-status-unknown-9666496cb-g97tt" podUID="9c554036-bba1-45c5-8e0f-d8d07eb4a977"
I0301 06:03:03.813682 253123 status_manager.go:687] "updateStatusInternal" version=4 podIsFinished=false pod="default/gke-128-container-status-unknown-9666496cb-g97tt" podUID="9c554036-bba1-45c5-8e0f-d8d07eb4a977" containers="(gke-128-container-status-unknown state=waiting previous=terminated=137)"

Fix: I tried to find places in kubelet codebase where we are deleting the container and added a check to ensure that the pod is finished before deleting - https://github.com/AnishShah/kubernetes/commit/0663ab8f0a430312834ea3c16952d8b50a419cd6.

Behavior after the fix: I still saw one ContainerStatusUnknown but this is much less than the situation before the fix. But that makes me believe that this is not the correct fix.

NAME                                               READY   STATUS                   RESTARTS   AGE
gke-128-container-status-unknown-9666496cb-458fz   0/1     Error                    0          7m58s
gke-128-container-status-unknown-9666496cb-49jhn   0/1     Error                    0          4m22s
gke-128-container-status-unknown-9666496cb-4sqm4   0/1     Error                    0          8m20s
gke-128-container-status-unknown-9666496cb-5bkx7   0/1     Error                    0          7m26s
gke-128-container-status-unknown-9666496cb-5g7w9   0/1     Error                    0          11m
gke-128-container-status-unknown-9666496cb-6fxf2   0/1     Error                    0          3m20s
gke-128-container-status-unknown-9666496cb-6mjng   0/1     Error                    0          7m48s
gke-128-container-status-unknown-9666496cb-6z4mk   0/1     Error                    0          12m
gke-128-container-status-unknown-9666496cb-85w77   0/1     Error                    0          9m5s
gke-128-container-status-unknown-9666496cb-8brmk   0/1     Error                    0          11m
gke-128-container-status-unknown-9666496cb-8kskd   0/1     Error                    0          7m14s
gke-128-container-status-unknown-9666496cb-8n4ts   0/1     Error                    0          9m15s
gke-128-container-status-unknown-9666496cb-8q45n   0/1     Error                    0          6m43s
gke-128-container-status-unknown-9666496cb-97pmq   0/1     Error                    0          5m15s
gke-128-container-status-unknown-9666496cb-9846d   0/1     Error                    0          94s
gke-128-container-status-unknown-9666496cb-9jl26   0/1     Error                    0          12m
gke-128-container-status-unknown-9666496cb-b8sxm   0/1     Error                    0          8m32s
gke-128-container-status-unknown-9666496cb-bj8gj   1/1     Running                  0          20s
gke-128-container-status-unknown-9666496cb-bl9q4   0/1     Error                    0          12m
gke-128-container-status-unknown-9666496cb-btsln   0/1     Error                    0          114s
gke-128-container-status-unknown-9666496cb-ch9qt   1/1     Running                  0          41s
gke-128-container-status-unknown-9666496cb-cjw89   0/1     Error                    0          11m
gke-128-container-status-unknown-9666496cb-d7dlp   0/1     Error                    0          10m
gke-128-container-status-unknown-9666496cb-dbrkr   0/1     Error                    0          5m49s
gke-128-container-status-unknown-9666496cb-dpnxp   0/1     Error                    0          2m59s
gke-128-container-status-unknown-9666496cb-fz5kb   0/1     Error                    0          5m27s
gke-128-container-status-unknown-9666496cb-g97tt   0/1     ContainerStatusUnknown   1          9m58s
gke-128-container-status-unknown-9666496cb-gvmjk   0/1     Error                    0          11m
gke-128-container-status-unknown-9666496cb-h5524   0/1     Error                    0          5m38s
gke-128-container-status-unknown-9666496cb-hcwhv   0/1     Error                    0          6m32s
gke-128-container-status-unknown-9666496cb-hpjh4   0/1     Error                    0          8m10s
gke-128-container-status-unknown-9666496cb-j6hkc   0/1     Error                    0          6m21s
gke-128-container-status-unknown-9666496cb-j9kks   0/1     Error                    0          6m52s
gke-128-container-status-unknown-9666496cb-j9w8l   1/1     Running                  0          52s
gke-128-container-status-unknown-9666496cb-jnccb   1/1     Running                  0          10s
gke-128-container-status-unknown-9666496cb-jv72p   0/1     Error                    0          9m36s
gke-128-container-status-unknown-9666496cb-k9fmx   0/1     Error                    0          84s
gke-128-container-status-unknown-9666496cb-kfrbn   0/1     Error                    0          3m10s
gke-128-container-status-unknown-9666496cb-kgg6q   0/1     Error                    0          2m49s
gke-128-container-status-unknown-9666496cb-kk4m2   0/1     Error                    0          10m
gke-128-container-status-unknown-9666496cb-lgwmp   0/1     Error                    0          106s
gke-128-container-status-unknown-9666496cb-lmg8h   0/1     Error                    0          4m33s
gke-128-container-status-unknown-9666496cb-ltvlc   0/1     Error                    0          10m
gke-128-container-status-unknown-9666496cb-m55br   0/1     Error                    0          62s
gke-128-container-status-unknown-9666496cb-mn6f9   0/1     Error                    0          12m
gke-128-container-status-unknown-9666496cb-n9ks2   0/1     Error                    0          3m41s
gke-128-container-status-unknown-9666496cb-nn7qg   0/1     Error                    0          2m38s
gke-128-container-status-unknown-9666496cb-nt75w   0/1     Error                    0          2m7s
gke-128-container-status-unknown-9666496cb-ptp4t   0/1     Error                    0          5m5s
gke-128-container-status-unknown-9666496cb-qdfj8   1/1     Running                  0          31s
gke-128-container-status-unknown-9666496cb-qplxv   0/1     Error                    0          73s
gke-128-container-status-unknown-9666496cb-r4gkt   0/1     Error                    0          8m53s
gke-128-container-status-unknown-9666496cb-rfkdl   0/1     Error                    0          6m11s
gke-128-container-status-unknown-9666496cb-rftvw   0/1     Error                    0          11m
gke-128-container-status-unknown-9666496cb-sfn6n   0/1     Error                    0          3m30s
gke-128-container-status-unknown-9666496cb-sjgp9   0/1     Error                    0          4m53s
gke-128-container-status-unknown-9666496cb-t2lp6   0/1     Error                    0          7m5s
gke-128-container-status-unknown-9666496cb-t7llf   0/1     Error                    0          6m
gke-128-container-status-unknown-9666496cb-t8w4n   0/1     Error                    0          4m12s
gke-128-container-status-unknown-9666496cb-tmdnn   0/1     Error                    0          2m17s
gke-128-container-status-unknown-9666496cb-tsmtj   0/1     Error                    0          12m
gke-128-container-status-unknown-9666496cb-twmvd   0/1     Error                    0          7m32s
gke-128-container-status-unknown-9666496cb-v8v6t   0/1     Error                    0          4m43s
gke-128-container-status-unknown-9666496cb-vhj4c   0/1     Error                    0          9m48s
gke-128-container-status-unknown-9666496cb-wpxhb   0/1     Error                    0          9m26s
gke-128-container-status-unknown-9666496cb-x7s4h   0/1     Error                    0          8m43s
gke-128-container-status-unknown-9666496cb-x9c2j   0/1     Error                    0          10m
gke-128-container-status-unknown-9666496cb-z684h   0/1     Error                    0          4m2s
gke-128-container-status-unknown-9666496cb-zbmks   0/1     Error                    0          10m
gke-128-container-status-unknown-9666496cb-zcrtj   0/1     Error                    0          2m28s
gke-128-container-status-unknown-9666496cb-zdb6f   0/1     Error                    0          11m
gke-128-container-status-unknown-9666496cb-zzzfp   0/1     Error                    0          3m51s
  1. I was able to reproduce this in GKE 1.25, 1.26, 1.27, 1.28.
  2. I would say that this issue is important to fix, but maybe not critical since it doesn’t cause any disruption?
  3. I think this happens only when the ephemeral storage limit is exceeded. When cpu/memory is exceeded, the pod will be throttled/oomkilled.

@skizot722 thanks for the quick reply. The “status” reported in kubectl get pods can be misleading since it fuses a few fields together for better user experience. The controllers typically will decide their action based on the raw pod status from the API. That’s why I wanted to learn the actual status of the pod to help assess the impact.

@AnishShah since you’ve reproduced this successfully in GKE, could you help get the pod status?

Experiencing the same issue on v1.29.11-eks-56e63d8

❯ k version
Client Version: v1.28.12
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.11-eks-56e63d8
❯ k get po infrastructure-canary-hello-world-697b789bf-jbfsr
NAME                                                READY   STATUS                   RESTARTS   AGE
infrastructure-canary-hello-world-697b789bf-jbfsr   0/2     ContainerStatusUnknown   1          109m
status

status:
  conditions:
  - lastProbeTime: null
    lastTransitionTime: "2025-01-08T13:25:09Z"
    message: 'The node was low on resource: ephemeral-storage. Threshold quantity:
      4142969303, available: 3968056Ki. Container infrastructure-canary-hello-world
      was using 9656Ki, request is 0, has larger consumption of ephemeral-storage.
      Container istio-proxy was using 1220Ki, request is 0, has larger consumption
      of ephemeral-storage. '
    reason: TerminationByKubelet
    status: "True"
    type: DisruptionTarget
  - lastProbeTime: null
    lastTransitionTime: "2025-01-08T13:25:09Z"
    status: "False"
    type: PodReadyToStartContainers
  - lastProbeTime: null
    lastTransitionTime: "2025-01-08T12:15:49Z"
    status: "True"
    type: Initialized
  - lastProbeTime: null
    lastTransitionTime: "2025-01-08T13:25:09Z"
    reason: PodFailed
    status: "False"
    type: Ready
  - lastProbeTime: null
    lastTransitionTime: "2025-01-08T13:25:09Z"
    reason: PodFailed
    status: "False"
    type: ContainersReady
  - lastProbeTime: null
    lastTransitionTime: "2025-01-08T12:14:45Z"
    status: "True"
    type: PodScheduled
  containerStatuses:
  - image: REDACTED
    imageID: ""
    lastState:
      terminated:
        exitCode: 137
        finishedAt: null
        message: The container could not be located when the pod was deleted.  The
          container used to be Running
        reason: ContainerStatusUnknown
        startedAt: null
    name: infrastructure-canary-hello-world
    ready: false
    restartCount: 1
    started: false
    state:
      terminated:
        exitCode: 137
        finishedAt: null
        message: The container could not be located when the pod was terminated
        reason: ContainerStatusUnknown
        startedAt: null
  - containerID: containerd://58d418b2c3f1b465e5c37b2adcb6ad37d15401dd946a5dbc415e29627c8d25dc
    image: docker.io/rancher/mirrored-istio-proxyv2:1.21.1-distroless
    imageID: docker.io/rancher/mirrored-istio-proxyv2@sha256:a43216cc80fd2ee1eca907b1169f3c7befad3a3580b70b0eafccaff8061d49d8
    lastState: {}
    name: istio-proxy
    ready: false
    restartCount: 0
    started: false
    state:
      terminated:
        containerID: containerd://58d418b2c3f1b465e5c37b2adcb6ad37d15401dd946a5dbc415e29627c8d25dc
        exitCode: 0
        finishedAt: "2025-01-08T13:25:09Z"
        reason: Completed
        startedAt: "2025-01-08T12:15:49Z"
  hostIP: 172.23.7.118
  hostIPs:
  - ip: 172.23.7.118
  initContainerStatuses:
  - containerID: containerd://d8f4d653d9ed10a9cb08cbec91fa5ab3a33b991bfa9aff57b28a83d33fe94c35
    image: docker.io/rancher/mirrored-istio-proxyv2:1.21.1-distroless
    imageID: docker.io/rancher/mirrored-istio-proxyv2@sha256:a43216cc80fd2ee1eca907b1169f3c7befad3a3580b70b0eafccaff8061d49d8
    lastState: {}
    name: istio-validation
    ready: true
    restartCount: 0
    started: false
    state:
      terminated:
        containerID: containerd://d8f4d653d9ed10a9cb08cbec91fa5ab3a33b991bfa9aff57b28a83d33fe94c35
        exitCode: 0
        finishedAt: "2025-01-08T12:14:46Z"
        reason: Completed
        startedAt: "2025-01-08T12:14:45Z"
  - containerID: containerd://924c8bfdbaf6190631e80663d3c77f9dfb1c213cf6c086e1ec4caff701953efd
    image: eu.gcr.io/datadoghq/apm-inject:0
    imageID: eu.gcr.io/datadoghq/apm-inject@sha256:c480ccb83079af83bc250f2ed9cbb0d245d54ecf2dc6abbb491ad69f8a0dd3be
    lastState: {}
    name: datadog-init-apm-inject
    ready: true
    restartCount: 0
    started: false
    state:
      terminated:
        containerID: containerd://924c8bfdbaf6190631e80663d3c77f9dfb1c213cf6c086e1ec4caff701953efd
        exitCode: 0
        finishedAt: "2025-01-08T12:14:47Z"
        reason: Completed
        startedAt: "2025-01-08T12:14:46Z"
  - containerID: containerd://5fc63f302aa9b60b0a2018cce3ef0abdcf443fc0daf9f5663defeca357a6a310
    image: eu.gcr.io/datadoghq/dd-lib-dotnet-init:3
    imageID: eu.gcr.io/datadoghq/dd-lib-dotnet-init@sha256:4bba0f3d79833a0593a225661834406cf71eae47bf8e1f425cfc18c9ea6ed81c
    lastState: {}
    name: datadog-lib-dotnet-init
    ready: true
    restartCount: 0
    started: false
    state:
      terminated:
        containerID: containerd://5fc63f302aa9b60b0a2018cce3ef0abdcf443fc0daf9f5663defeca357a6a310
        exitCode: 0
        finishedAt: "2025-01-08T12:14:49Z"
        reason: Completed
        startedAt: "2025-01-08T12:14:47Z"
  - containerID: containerd://4a281ec7bb10b155cf2f472be6dfc974e67c9bc34c79bcf0690c5f9e17629ed6
    image: eu.gcr.io/datadoghq/dd-lib-java-init:1
    imageID: eu.gcr.io/datadoghq/dd-lib-java-init@sha256:024b1bcdbf1977f1545752ccc785fad010f0bf120183dd25ec95d881d1e15473
    lastState: {}
    name: datadog-lib-java-init
    ready: true
    restartCount: 0
    started: false
    state:
      terminated:
        containerID: containerd://4a281ec7bb10b155cf2f472be6dfc974e67c9bc34c79bcf0690c5f9e17629ed6
        exitCode: 0
        finishedAt: "2025-01-08T12:14:50Z"
        reason: Completed
        startedAt: "2025-01-08T12:14:49Z"
  - containerID: containerd://43224cbb4a92f4c1b660c9e3eb8bbfe888ae205a1cbd0ca5feaf26d38ef9c5fe
    image: eu.gcr.io/datadoghq/dd-lib-js-init:5
    imageID: eu.gcr.io/datadoghq/dd-lib-js-init@sha256:2fb13f543c52fd8621093c574d543326cbd0cf7d7584abe1c75369e5ba51ce8d
    lastState: {}
    name: datadog-lib-js-init
    ready: true
    restartCount: 0
    started: false
    state:
      terminated:
        containerID: containerd://43224cbb4a92f4c1b660c9e3eb8bbfe888ae205a1cbd0ca5feaf26d38ef9c5fe
        exitCode: 0
        finishedAt: "2025-01-08T12:15:00Z"
        reason: Completed
        startedAt: "2025-01-08T12:14:50Z"
  - containerID: containerd://33ba12a37c32a39133e77dfc853278b9479b276808dc57b2c2045bb3a7a04c3e
    image: eu.gcr.io/datadoghq/dd-lib-python-init:2
    imageID: eu.gcr.io/datadoghq/dd-lib-python-init@sha256:9319655923cadf6f23947912268001355afe38dd1021ef36ef9ea3315e34fe40
    lastState: {}
    name: datadog-lib-python-init
    ready: true
    restartCount: 0
    started: false
    state:
      terminated:
        containerID: containerd://33ba12a37c32a39133e77dfc853278b9479b276808dc57b2c2045bb3a7a04c3e
        exitCode: 0
        finishedAt: "2025-01-08T12:15:49Z"
        reason: Completed
        startedAt: "2025-01-08T12:15:00Z"
  message: 'The node was low on resource: ephemeral-storage. Threshold quantity: 4142969303,
    available: 3968056Ki. Container infrastructure-canary-hello-world was using 9656Ki,
    request is 0, has larger consumption of ephemeral-storage. Container istio-proxy
    was using 1220Ki, request is 0, has larger consumption of ephemeral-storage. '
  phase: Failed
  podIP: 172.23.7.107
  podIPs:
  - ip: 172.23.7.107
  qosClass: Burstable
  reason: Evicted
  startTime: "2025-01-08T12:14:45Z"

Thanks @AnishShah! In your example the pod has already failed (`phase: Failed), and it’s safe to reuse the IPs, etc.

We should still fix the confusing behavior, but the impact assessment will help us determine the urgency 😃

@skizot722 So I thought it was sad emoji, but it looks like I need to read before I click nextime lol.

Nothing to add on my end, this issue is out my wheel house but still curious!

@skizot722 I will bring this up in the next sig-node meeting.

@jmcgrath207 / @AnishShah thank you for the replies. This problem does not have to do with the underlying node being under disk pressure, from what we can tell. We have seen that in the past, and the pods are evicted w/o issue and the status message indicates that the eviction took place due to node disk pressure. In this case, the pod is evicted, every time. But the resulting pod status becomes ContainerStatusUnknown when that happens, instead of the expected status of Error.

My colleague was actually able to create a reproduction script and image. Hopefully you guys can give it a try and see the issue. His script does not produce the problem every single time, but it is able to trigger the issue. The repo for it is located here.

So if you are asking why these pods are still staying around after they are evicted, that is working as intended.

Pods are only GC if they reach the maximum limit set by the cluster (--terminated-pod-gc-threshold). So I think this is actually intended.

If the number of pods reaches that limit, then they will be dropped from the apiserver (etcd really).