戴尔自动化平台:基于 Java 的容器“OOMKilled”,从内核 6.12 开始
Summary: 在 Linux 内核 6.12 或更高版本上运行时,基于 Java 的容器化应用程序(如 Keycloak)可能会因内存不足 (OOM) 错误而遇到意外终止。此问题源于内核公开“cgroup”内存限制的方式更改。 这些更改会影响 Java 虚拟机 (JVM) 正确检测和遵守容器内存约束的能力。
This article applies to
This article does not apply to
This article is not tied to any specific product.
Not all product versions are identified in this article.
Symptoms
对于 NativeEdge 戴尔自动化平台, keycloak 正在获得 OOMKilled 初始化期间。例如,在 helm 安装期间,当 keycloak Pod 即将启动。
里面的日志 keycloak 结尾为:
Appending additional Java properties to JAVA_OPTS Changes detected in configuration. Updating the server image. Updating the configuration and installing your custom providers, if any. Please wait.
容器的描述显示:
State: Waiting Reason: CrashLoopBackOff Last State: Terminated Reason: OOMKilled
对于其他环境,它可能是:
- 系统会终止 Java 容器(例如,
keycloak、Kafka、Elasticsearch)OOMKilled地位。 - JVM 报告出乎意料的高堆大小估计值,通常与主机内存而不是容器限制匹配。
- 内存调整标记,如
-XX:MaxRAMPercentage似乎无效。 - 日志可能会显示消息,例如:
[debug][os,container] controller memory is not enabled[debug][os,container] One or more required controllers disabled at kernel level
Cause
从 Linux 内核 6.12 开始,内核不再公开
cgroup 控制器信息依据 /proc/cgroups,JVM 以前依赖它来检测容器内存限制。此更改中断了受影响 JVM 版本中的容器感知,导致它们假定它们可以访问完整的主机内存。因此,JVM 分配的内存多于容器允许的内存,从而触发内核的 OOMkiller。
在开源项目中,这存在几个问题:
默认情况下,Ubuntu 24.04.3 不使用 6.12 内核。但某些映像已更新为 6.12、6.13、6.14 版本(例如,在 AWS 映像库中)。
Resolution
有两种可能的快速解决方法。
- 临时增加容器的内存限制。例如,以下是继续安装 Dell Automation Platform 的步骤,将内存限制加倍
keycloak容器。
为此,必须运行以下命令(检查业务流程协调程序命名空间,例如,如下所示)
dapo 是默认的业务流程协调程序命名空间:
kubectl edit sts keycloak -n dapo
找到内存限制和请求,并将其加倍。
keycloak 在准备步骤中消耗大量内存。这一增加使我们能够通过此初始化步骤。
- 显式设置 JVM 内存限制
使用启动标记手动限制内存使用:
extraEnvVars:
- name: JAVA_OPTS_KC_HEAP
value: "-XX:MaxRAMPercentage=70 -XX:MinRAMPercentage=70 -XX:InitialRAMPercentage=50 -XX:MaxRAM=1G"Affected Products
Dell Automation Platform, NativeEdge Solutions, Dell Automation Platform Components, NativeEdgeArticle Properties
Article Number: 000369678
Article Type: Solution
Last Modified: 16 Oct 2025
Version: 2
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.