How to fix Exit Code 137 in Kubernetes
Exit code 137 indicates your container was killed by SIGKILL (signal 9), typically due to OOMKilled when exceeding memory limits. Increase memory limits or optimize application memory usage.
Quick fix
Fixes Exit Code 137
kubectl describe pod <pod-name>- Confirm the termination reason
- Check current memory configuration and usage
- Increase memory limits
- Check for memory leaks
kubectl describe pod <pod-name>Exit Code 137
What this error means
Exit code 137 in Kubernetes means a container was forcibly terminated by the Linux kernel using SIGKILL (signal 9). The number 137 is calculated as 128 (base code for fatal signals) + 9 (SIGKILL signal number). The most common cause is OOMKilled—the kernel's out-of-memory killer terminated the container because it exceeded its memory limit. However, SIGKILL can also come from manual kills, failed health checks triggering termination, or node-level memory pressure causing pod eviction.
Typical symptoms
- Container shows OOMKilled status in kubectl describe pod output
- Pod repeatedly crashes and enters CrashLoopBackOff state
- Exit Code: 137 appears in Last State of container status
- Container terminates abruptly without graceful shutdown logs
- Memory usage steadily increases before sudden termination
- Application works initially but crashes under load
- Events show Killing container with grace period or OOM events
Common causes
- Container memory usage exceeds the configured memory limit
- Memory leak in application causing gradual consumption growth
- Memory limits set too low for actual workload requirements
- JVM or runtime heap configured larger than container limit allows
- Traffic spike causing memory usage to exceed normal levels
- Node memory pressure triggering pod eviction
- Liveness probe failures causing Kubernetes to kill the container
- Manual termination via kubectl delete with force flag
How to fix "Exit Code 137"
Check if the container was OOMKilled:
kubectl describe pod <pod-name>Look for these indicators in the output:
Last State: Terminated
Reason: OOMKilled
Exit Code: 137If Reason shows OOMKilled, it's a memory issue. If it shows Error, check for other causes like liveness probe failures.
View the pod's memory limits:
kubectl get pod <pod-name> -o jsonpath='{.spec.containers[*].resources}'Monitor actual memory consumption:
kubectl top pod <pod-name>Compare actual usage to limits. If usage approaches limits before crashes, the limits are too low.
Update your deployment with appropriate memory limits:
resources:
requests:
memory: "512Mi"
limits:
memory: "1Gi"Set requests based on typical usage and limits for peak load. Start with limits at 1.5-2x your observed normal usage. Apply and monitor:
kubectl apply -f deployment.yaml
kubectl top pod <pod-name> --watchIf memory grows continuously until OOM, investigate leaks:
# Watch memory over time
kubectl top pod <pod-name> --watchFor Java applications, enable heap dumps:
env:
- name: JAVA_OPTS
value: "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp/heapdump.hprof"Use language-specific profilers (pprof for Go, memory_profiler for Python) to identify leak sources.
Aggressive liveness probes can also cause exit code 137 if they kill the container:
kubectl describe pod <pod-name> | grep -A 10 "Liveness"If probes are too aggressive, adjust timeouts:
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 60
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3Pods with Guaranteed QoS are killed last during node memory pressure:
resources:
requests:
memory: "1Gi"
cpu: "500m"
limits:
memory: "1Gi"
cpu: "500m"When requests equal limits, the pod gets Guaranteed QoS class. BestEffort pods (no limits) are killed first.
Advanced notes
Exit code 137 differs from exit code 143 (SIGTERM). Code 137 is SIGKILL—immediate, ungraceful termination that cannot be caught or handled by the application. Code 143 is SIGTERM—a graceful shutdown request.
On EKS, use CloudWatch Container Insights to track memory trends over time. On GKE, Cloud Monitoring provides memory metrics, though console graphs may differ from kubectl top. On AKS, Azure Monitor can correlate OOM events with other cluster metrics.
Consider Vertical Pod Autoscaler (VPA) to automatically adjust memory limits based on historical usage. For predictable memory growth patterns, combine with Horizontal Pod Autoscaler (HPA) to scale out before individual pods hit their limits.
Node-level OOM can kill pods even within their limits if the node is overcommitted. Monitor node memory with kubectl describe node and look for MemoryPressure conditions.
Frequently asked questions
- What does "Exit Code 137" mean?
- Exit code 137 in Kubernetes means a container was forcibly terminated by the Linux kernel using SIGKILL (signal 9). The number 137 is calculated as 128 (base code for fatal signals) + 9 (SIGKILL signal number). The most common cause is OOMKilled—the kernel's out-of-memory killer terminated the container because it exceeded its memory limit.
- How do I fix "Exit Code 137"?
- Exit code 137 indicates your container was killed by SIGKILL (signal 9), typically due to OOMKilled when exceeding memory limits. Increase memory limits or optimize application memory usage.
- What causes "Exit Code 137"?
- Container memory usage exceeds the configured memory limit Memory leak in application causing gradual consumption growth Memory limits set too low for actual workload requirements
- Is the "Exit Code 137" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.
Official resources & further reading
- 📚Kubernetes Official Documentation
- 📝
- 📖Kubernetes Docs: assign memory resource(Official Docs)
- 💬Stack Overflow: kubernetes pods terminated exit code 137(Stack Overflow)