Junior — Middle
What are the consequences in Kubernetes if CPU usage exceeds the allowed limit?
sobes.tech AI
Answer from AI
In Kubernetes, if a container exceeds its CPU limit, the system enforces a restriction on its CPU usage. Unlike memory, where exceeding the limit can lead to the container being killed (OOMKilled), CPU limiting results in:
- The container not receiving more CPU than the limit specifies.
- Kubernetes (via cgroups) limiting the process, reducing its priority and CPU time.
- This can cause the application to slow down, increase latency, and reduce performance.
Thus, exceeding the CPU limit does not stop the container but throttles it (limits its performance). This helps ensure the container does not use more resources than allocated, maintaining cluster stability.