Skip to main content

Command Palette

Search for a command to run...

K8S-Troubleshooting: OOMKilled

Updated
2 min read

The Issue

OOMKilled (Out of Memory Killed) is a Kubernetes error that occurs when a container exceeds its allocated memory limit, causing the system to terminate the container to free up resources. This can happen when the container tries to use more memory than specified in its pod specification, triggering the Out of Memory (OOM) killer in the operating system to kill the process. As a result, Kubernetes restarts the container, and the pod enters an OOMKilled state.

Causes and Troubleshooting

Here’s a table outlining the most common causes of OOMKilled errors and their troubleshooting methods:

CauseTroubleshooting Method
Memory limit too low- Increase the memory limit in the pod spec (resources.limits.memory).
Memory leak in the application- Analyze the application for memory leaks (use profiling tools or logs).
Inefficient memory usage- Optimize application code to use memory more efficiently (e.g., reduce memory-heavy operations).
Increased workload/traffic- Adjust memory limits based on load (scale the application or increase memory).
Misconfigured resource requests- Set appropriate resources.requests.memory for better scheduling and avoid over-commitment.
Too many containers on the node- Check if too many containers are competing for memory on the same node. Consider spreading workloads across nodes.
Application consuming more memory over time- Monitor memory usage over time using tools like kubectl top or Prometheus and Grafana.
Unoptimized container image- Optimize the container image by reducing unnecessary dependencies and memory consumption.
15 views