Cloud and Container Basics
In Kubernetes, which of the following correctly describes the resource requests and limits set for a container?
- ANodes are chosen using requests, a container whose memory exceeds its limit may be killed, and CPU is held to the limit
- BThe scheduler places Pods so that the sum of limits fits within a node's resources, and a container whose CPU usage exceeds its request is killed
- CRequests are the maximum a container can use, and when usage exceeds the request, the container is killed at once, whether for memory or CPU
Show answer and explanation
Answer: A. Nodes are chosen using requests, a container whose memory exceeds its limit may be killed, and CPU is held to the limit
Requests are the amount of resources a container wants reserved, and the scheduler chooses the node for a Pod so that the sum of the requests of the Pods on a node does not exceed the node's allocatable resources. Limits are the upper bound on usage. CPU can be shared over time, so when a container tries to exceed its CPU limit its use is held back (throttling), and processing slows down. Memory is hard to take back, so a container that tries to use more than its memory limit may be killed as out of memory (OOMKilled).
- A. Correct. Placement uses requests, the cap is the limit, and exceeding it is handled differently for CPU and memory.
- B. Placement decisions use requests, not limits. Also, heavy CPU use does not get a container killed; its use is held back.
- C. Using more than the request is allowed; the cap is the limit. Exceeding the CPU limit leads to throttling, not to the container being killed.