大网数据广告活动
服务器运维问答

Pod is stuck in PodInitializing status when an initContainer is OOMKilled

· 52CE 我爱测

I have the following on-prem Kubernetes environment: OS: Red Hat Enterprise Linux release 8.6 (Ootpa) Kubernetes: 1.23.7 (single-node, build with kubeadm) NVIDIA driver: 515.65.01 nvidia-container-toolkit: 1.10.0-1.x86_64 (rpm) c…

问题原文

原帖链接 · Daigo · CC BY-SA 4.0

I have the following on-prem Kubernetes environment:

  • OS: Red Hat Enterprise Linux release 8.6 (Ootpa)
  • Kubernetes: 1.23.7 (single-node, build with kubeadm)
  • NVIDIA driver: 515.65.01
  • nvidia-container-toolkit: 1.10.0-1.x86_64 (rpm)
  • containerd: v1.6.2
  • vcr.io/nvidia/k8s-device-plugin:v0.12.2

And I run the following Pod on my server. Only app2 (initContainer2) uses GPU.

initContainer1: app1
↓
initContainer2: app2 (Uses GPU)
↓
container1: app3

When the app2 uses too much RAM and is OOM killed, the Pod should be in the OOMKilled status, but it's stuck in the PodInitializing status on my environment.

NAMESPACE     NAME       READY   STATUS            RESTARTS       AGE     IP               NODE      NOMINATED NODE   READINESS GATES
default       gpu-pod    0/1     PodInitializing   0              83m     xxx.xxx.xxx.xxx   xxxxx   <none>           <none>

The results of kubectl describe pod is as follows:

Init Containers:
  app1:
    ...
    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Tue, 30 Aug 2022 10:50:38 +0900
      Finished:     Tue, 30 Aug 2022 10:50:44 +0900
      ...
app2:
    ...
    State:          Terminated
      Reason:       OOMKilled
      Exit Code:    0
      Started:      Tue, 30 Aug 2022 10:50:45 +0900
      Finished:     Tue, 30 Aug 2022 10:50:48 +0900
      ...
app3:
    ...
    State:          Waiting
      Reason:       PodInitializing
      ...
    ...

This problem will never happen when I replace app2 with another container that doesn't use GPU, or when I launch app2 as a single container (not an init Container) of the Pod. In both cases, the status will be properly OOMKilled.

Is this a bug? If so, are there any workarounds?

已采纳解答

原帖链接 · asktyagi · CC BY-SA 4.0

So workflow is like below from documentation.

Init containers are exactly like regular containers, except:

  • Init containers always run to completion.
  • Each init container must complete successfully before the next one starts.

If a Pod's init container fails, the kubelet repeatedly restarts that init container until it succeeds. However, if the Pod has a restartPolicy of Never, and an init container fails during startup of that Pod, Kubernetes treats the overall Pod as failed.

So it's in correct state AFAIK.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-08-30)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。