OOMKill in Kubernetes and Linux (Exit Code 137)

When a container(process) is terminated due to an Out Of Memory (OOM) manager condition, Kubernetes marks it as OOMKilled. In this case , the Linux kernel’s OOM Killer terminates the process and the container exits with exit code 137. This exit code is…


This content originally appeared on DEV Community and was authored by Ali Mehraji

When a container(process) is terminated due to an Out Of Memory (OOM) manager condition, Kubernetes marks it as OOMKilled. In this case , the Linux kernel’s OOM Killer terminates the process and the container exits with exit code 137. This exit code is an important troubleshooting signal in Kubernetes.

Why OOMKill Happens

Linux uses an over-commitment policy for memory management. Applications can request more memory than is physically available. When the actual demand exceeds system capacity, the kernel must decide which process to kill in order to reclaim memory. How OOM Kill works ?

  • The OOM Killer selects and terminates processes based on their OOM score.
  • In Kubernetes, this usually happens when a container exceeds its memory limit.
  • Kubernetes then records the container’s state as OOMKilled, and logs exit code 137. OOM Killer Sends What Signal to the Process ?

Exit codes 1 - 2, 126 - 165, and 255 have special meanings, and should therefore be avoided for user-specified exit parameters. Ending a script with exit 127 would certainly cause confusion when troubleshooting (is the error code a "command not found" or a user-defined one?).

Resources


This content originally appeared on DEV Community and was authored by Ali Mehraji


Print Share Comment Cite Upload Translate Updates
APA

Ali Mehraji | Sciencx (2025-09-22T13:23:25+00:00) OOMKill in Kubernetes and Linux (Exit Code 137). Retrieved from https://www.scien.cx/2025/09/22/oomkill-in-kubernetes-and-linux-exit-code-137-2/

MLA
" » OOMKill in Kubernetes and Linux (Exit Code 137)." Ali Mehraji | Sciencx - Monday September 22, 2025, https://www.scien.cx/2025/09/22/oomkill-in-kubernetes-and-linux-exit-code-137-2/
HARVARD
Ali Mehraji | Sciencx Monday September 22, 2025 » OOMKill in Kubernetes and Linux (Exit Code 137)., viewed ,<https://www.scien.cx/2025/09/22/oomkill-in-kubernetes-and-linux-exit-code-137-2/>
VANCOUVER
Ali Mehraji | Sciencx - » OOMKill in Kubernetes and Linux (Exit Code 137). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/09/22/oomkill-in-kubernetes-and-linux-exit-code-137-2/
CHICAGO
" » OOMKill in Kubernetes and Linux (Exit Code 137)." Ali Mehraji | Sciencx - Accessed . https://www.scien.cx/2025/09/22/oomkill-in-kubernetes-and-linux-exit-code-137-2/
IEEE
" » OOMKill in Kubernetes and Linux (Exit Code 137)." Ali Mehraji | Sciencx [Online]. Available: https://www.scien.cx/2025/09/22/oomkill-in-kubernetes-and-linux-exit-code-137-2/. [Accessed: ]
rf:citation
» OOMKill in Kubernetes and Linux (Exit Code 137) | Ali Mehraji | Sciencx | https://www.scien.cx/2025/09/22/oomkill-in-kubernetes-and-linux-exit-code-137-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.