Skip to content

EKS Upgrade Issue

0

When updating the EKS node group to use the Bottlerocket AMI, I encountered the following issue:

Pods that were previously running fine on Amazon Linux 2 (AL2) started failing with the error: terminated - Reason: OOMKilled - exit code: 137

However, when switching to Amazon Linux 2022, the same pods started successfully with around 800 MB of memory usage for the same container image. Additionally, when using Amazon Linux 2023, the pods failed again with the error: terminated - Reason: Error - exit code: 1

Also in bottlerocket ami if i am using the t3a.large or t3.large instance type allmost all the pods exit with OOM but if i choose the t3.medium or t3a.medium

all the pods will running without memory issue that is OOM error with137 Error code

  • Also in bottlerocket ami if i am using the t3a.large or t3.large instance type allmost all the pods exit with OOM but if i choose the t3.medium or t3a.medium
    all the pods will running without memory issue that is OOM error with137 Error code

2 Answers
1

It's look like a runtime / cgroups change side-effect rather than a flaw in your image.

Changes:

  • AL2 nodes typically run cgroup v1.
  • Bottlerocket and AL2023 use cgroup v2 by default (and containerd), which changes how memory is accounted and enforced (AWS Doc).

That single switch often surfaces hidden issues (apps not honoring limits, older JVM/Node versions mis-detecting limits, different page cache accounting), which commonly appear as OOMKilled (exit 137) when a container crosses its limit, or a generic exit 1 if the app aborts early for another reason.

  • Possible root causes and how you can make sure:

1. Your pod is hitting a hard memory limit under cgroup v2

AL2 (v1) vs Bottlerocket/AL2023 (v2) can report/limit memory slightly differently. If your pod has resources.limits.memory, crossing that value triggers OOMKilled. Confirm inside the container (on a failing node):

# Is this cgroup v2?
stat -fc %T /sys/fs/cgroup 
# What limit does the kernel enforce for this container?
cat /sys/fs/cgroup/memory.max     
cat /sys/fs/cgroup/memory.current

If memory.current climbs to memory.max before the kill, that’s your smoking gun (About cgroup v2).

2. Runtime inside the container isn’t cgroup-aware (older Java/Node/Python)

Old JVMs / Node versions can misread limits and grab too much heap on cgroup v2, which didn’t hurt on AL2 but OOMs on v2.

Quick checks / mitigations:

  • Java 8/11: add -XX:MaxRAMPercentage=75 -XX:InitialRAMPercentage=50 (tune to your limit).
  • Node.js: NODE_OPTIONS=--max-old-space-size=<MiB> (~70–75% of limit).
  • Python scientific stacks: set MALLOC_ARENA_MAX=2 to tame glibc arenas. If that stops the OOMs, you’ve found it. (General OOM behavior ref.)

3. Kubelet / containerd + cgroup v2 edge cases

On v2, Kubernetes can additionally use MemoryQoS (throttling via memory.high) if enabled; EKS doesn’t enable it by default, but many folks exploring v2 hit differences in enforcement/observability. If metrics show < limit but still OOMs, it’s usually accounting gaps or page cache pressure—not uncommon. Check node dmesg/journal around the kill, (#114142)

4. The AL2023 “exit code 1”

That’s your app exiting—not OOM. Typical triggers after moving to AL2023:

  • Different kernel / seccomp defaults leading to early failures if your app needs specific syscalls (you’d usually see “operation not permitted” in logs).

  • Metadata/IAM access patterns changed—AL2023 hardens IMDS access; pods that relied on the node role without IRSA often fail at startup. Check logs for AWS SDK credential/IMDS errors. (Fix with IRSA.)

I hope this helps.

answered a year ago

0

When upgrading EKS node groups to different operating systems like Bottlerocket, Amazon Linux 2023 (AL2023), or Amazon Linux 2022, you may encounter various compatibility issues that affect pod behavior.

The error code 137 (OOMKilled) you experienced with Bottlerocket indicates that your pods were terminated due to exceeding memory limits. Bottlerocket has a different memory management approach compared to Amazon Linux 2, which could explain why pods that ran fine on AL2 are now being killed for memory consumption.

For Amazon Linux 2023, the exit code 1 suggests a general application failure rather than a memory issue. AL2023 introduces several significant changes compared to AL2:

  1. AL2023 uses a new node initialization process called nodeadm with a YAML configuration schema
  2. It requires Instance Metadata Service Version 2 (IMDSv2)
  3. It sets the default hop count for managed node groups to 1, which restricts containers from accessing node metadata
  4. It requires Amazon VPC CNI add-on version 1.16.2 or later
  5. It features a next-generation unified control group hierarchy (cgroupv2)

These differences could be affecting your application's behavior. If your application relies on accessing node metadata or credentials, the hop count limitation might be causing issues. You might need to increase the HttpPutResponseHopLimit to 2 in your EC2 launch template or use Amazon EKS Pod Identity for credential access.

For the Bottlerocket OOMKilled issue, you may need to:

  1. Increase the memory limits for your pods
  2. Optimize your application's memory usage
  3. Consider using a larger instance type with more memory

When migrating between different operating systems for EKS nodes, it's important to test thoroughly and account for these differences in system behavior and resource management.
Sources
Amazon Linux 2023: kernel kill my Java app in EKS - "task blocked for more than 122 seconds" (segmentation fault) (Exit code 139) | AWS re:Post
Upgrade from Amazon Linux 2 to Amazon Linux 2023 - Amazon EKS
Amazon Linux 2023: task blocked for more than 122 seconds | AWS re:Post

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.