kubernetes

OOMKilled Fix for Memory-Constrained Containers

Reduce container restarts caused by memory limits and inefficient process usage.

April 23, 20261 min read
#kubernetes#oomkilled#memory

Problem

Containers restart with OOMKilled after handling traffic spikes.

Root Cause

The container exceeds the configured memory limit or leaks memory under load.

Fix

Code
kubectl top pod checkout-67b6db599c-x4fh2 -n commerce
kubectl describe pod checkout-67b6db599c-x4fh2 -n commerce
kubectl patch deployment checkout -n commerce --type merge -p '{"spec":{"template":{"spec":{"containers":[{"name":"checkout","resources":{"requests":{"memory":"512Mi"},"limits":{"memory":"1Gi"}}}]}}}}'
kubectl rollout restart deployment/checkout -n commerce

Result

The container receives enough memory headroom and restarts stop during normal load.

Ad Slot

Replace with Google AdSense or partner placement when monetization is enabled.

Premium Slot

Reserve this space for premium runbooks, downloadable templates, or paid incident checklists.