A resource request is the amount of CPU or memory that a container is guaranteed to have. Kubernetes uses this to decide which node can run the container.
Click to reveal answer
beginner
What happens if a container exceeds its resource limit in Kubernetes?
If a container uses more CPU than its limit, Kubernetes throttles it. If it uses more memory than its limit, the container may be terminated (killed).
Click to reveal answer
intermediate
Why should you set both resource requests and limits?
Setting requests ensures your container gets enough resources to run well. Limits prevent it from using too much and affecting other containers.
Click to reveal answer
intermediate
How does Kubernetes use resource requests during scheduling?
Kubernetes checks the resource requests of a pod and finds a node with enough free resources to meet those requests before placing the pod there.
Click to reveal answer
beginner
Give an example of setting CPU and memory requests and limits in a pod spec.
Requests set minimum guaranteed CPU, limits set maximum allowed CPU usage.
Step 2: Identify maximum CPU from limits
The limit is "500m", meaning 500 millicores is the max CPU the container can use.
Final Answer:
500 millicores -> Option A
Quick Check:
CPU limit = max CPU usage [OK]
Hint: Limits define max usage, requests define minimum [OK]
Common Mistakes:
Confusing requests with limits
Adding requests and limits incorrectly
Assuming no max limit if requests set
4. You set a memory limit of 256Mi but forgot to set a memory request. What is the likely effect on your Pod scheduling?
medium
A. The Pod will use unlimited memory since request is missing.
B. The Pod may be scheduled with no guaranteed memory, risking eviction under pressure.
C. The Pod will be scheduled with 256Mi guaranteed memory automatically.
D. The Pod will fail to start due to missing memory request.
Solution
Step 1: Understand default behavior when requests are missing
If memory request is not set, Kubernetes treats it as zero, meaning no guaranteed memory.
Step 2: Effect on scheduling and eviction
Pod may be scheduled but can be evicted if node memory is low because it has no guaranteed reservation.
Final Answer:
The Pod may be scheduled with no guaranteed memory, risking eviction under pressure. -> Option B
Quick Check:
Missing request means no guaranteed resources [OK]
Hint: Always set requests to guarantee resources and avoid eviction [OK]
Common Mistakes:
Assuming limits imply requests
Thinking Pod fails without requests
Believing missing requests mean unlimited resources
5. You want to ensure a container always has at least 100m CPU and 128Mi memory but never uses more than 300m CPU and 256Mi memory. Which is the correct resource configuration snippet?