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.
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.
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.
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.
Failed to connect to server: connection refused (HTTP/2)
How to fix "HTTP/2 connection refused" error in Kubernetes
missing request for cpu in container
How to fix "missing request for cpu in container" in Kubernetes HPA
error: invalid configuration
How to fix "error: invalid configuration" in Kubernetes
etcdserver: cluster ID mismatch
How to fix "etcdserver: cluster ID mismatch" in Kubernetes
running with swap on is not supported
How to fix "running with swap on is not supported" in kubeadm