limits
What is limits?
limits: The hard cap on CPU/memory a container may use. Exceeding the memory limit gets the container OOM-killed; CPU is throttled, not killed. Limits set the maximum CPU and memory a container in Kubernetes may use. A container that exceeds its memory limit is killed, shown as OOMKilled. Exceeding the CPU limit does not kill it; the container is throttled and simply runs slower.
Frequently asked questions about limits
How is limits used in practice?
Limits protect the rest of the node. Without them, one container with a memory leak can starve every other application on the same machine.
What should you keep in mind with limits?
Set the memory limit with real usage in mind, plus headroom for peaks. A limit that is too tight causes random restarts under load. For CPU, many teams set requests but leave limits off or generous, because throttling can cause latency spikes that are hard to diagnose. Watch for OOMKilled in kubectl describe pod; it is a clear sign the memory limit needs attention.
What does an example of limits look like?
resources: limits: cpu: "500m" memory: "512Mi" At a glance
| Category | Kubernetes |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |