A CPU request is the amount of CPU guaranteed to a container. Kubernetes uses this to decide which node can run the container.
Click to reveal answer
beginner
What happens if a container exceeds its CPU limit in Kubernetes?
If a container uses more CPU than its limit, Kubernetes throttles it to prevent it from using more CPU than allowed.
Click to reveal answer
intermediate
Why should you set both CPU requests and limits?
Setting both ensures your container gets enough CPU to run well (requests) and prevents it from using too much CPU (limits), helping cluster stability.
Click to reveal answer
intermediate
How does Kubernetes use CPU requests during scheduling?
Kubernetes sums CPU requests of all containers on a node and only schedules new containers if the node has enough free CPU to meet the request.
Click to reveal answer
beginner
What unit is used to specify CPU requests and limits in Kubernetes?
CPU is specified in cores or millicores (m). For example, 500m means half a CPU core.
Click to reveal answer
What does a CPU limit do in Kubernetes?
APrevents a container from using more CPU than the limit by throttling it
BGuarantees the container will always get this CPU amount
CSets the maximum memory a container can use
DSchedules the container on the node with the most CPU
✗ Incorrect
CPU limits stop containers from using more CPU than allowed by throttling their CPU usage.
What unit is used to specify CPU requests in Kubernetes?
ABytes
BCores or millicores (m)
CMilliseconds
DPercentage
✗ Incorrect
CPU is specified in cores or millicores (m), where 1000m equals 1 full CPU core.
If a container has a CPU request of 200m and a limit of 500m, what does this mean?
AIt is guaranteed 200m CPU and can use up to 500m CPU
BIt can only use 200m CPU and no more
CIt must use exactly 500m CPU
DIt has no CPU guarantees
✗ Incorrect
The container is guaranteed 200m CPU but can burst up to 500m CPU if available.
What happens if you set a CPU limit but no CPU request?
AThe container is guaranteed CPU equal to the limit
BThe container can use unlimited CPU
CThe container has no guaranteed CPU but cannot exceed the limit
DThe container will not start
✗ Incorrect
Kubernetes automatically assigns a request that matches the limit, guaranteeing the container CPU equal to the limit.
Why is it important to set CPU requests in Kubernetes?
ATo speed up container startup
BTo limit the container's CPU usage
CTo increase container memory
DTo help Kubernetes schedule containers on nodes with enough CPU
✗ Incorrect
CPU requests tell Kubernetes how much CPU a container needs, helping it schedule containers properly.
Explain the difference between CPU requests and CPU limits in Kubernetes.
Think about what Kubernetes guarantees versus what it restricts.
You got /4 concepts.
Describe why setting CPU requests and limits helps maintain cluster stability.
Consider how resources are shared in a busy kitchen.
You got /4 concepts.
Practice
(1/5)
1. What does setting a cpu request in a Kubernetes pod specification do?
easy
A. It guarantees a minimum amount of CPU for the container.
B. It limits the maximum CPU the container can use.
C. It sets the CPU priority for the container.
D. It reserves memory for the container.
Solution
Step 1: Understand CPU request meaning
CPU request is the minimum CPU resource Kubernetes guarantees to a container.
Step 2: Differentiate from CPU limit
CPU limit sets the maximum CPU usage, not the minimum guaranteed.
Final Answer:
It guarantees a minimum amount of CPU for the container. -> Option A
Quick Check:
CPU request = minimum CPU guaranteed [OK]
Hint: Requests guarantee minimum CPU, limits cap maximum CPU [OK]
Common Mistakes:
Confusing CPU request with CPU limit
Thinking requests set maximum CPU
Mixing CPU with memory resource
2. Which of the following is the correct way to specify CPU requests and limits in a pod YAML?
easy
A. resources:
cpu:
request: 500m
limit: 1
B. resources:
requests:
cpu: 500
limits:
cpu: 1000
C. resources:
requests:
cpu: "500m"
limits:
cpu: "1"
D. resources:
requests:
cpu: "1.0"
limits:
cpu: "0.5"
Solution
Step 1: Check correct YAML structure for resources
The correct keys are requests and limits under resources, with CPU values as strings with units like "500m" or "1".
A. CPU requests and limits cannot be set together.
B. CPU request is less than CPU limit, which is invalid.
C. CPU values must be integers, not strings.
D. CPU limit is less than CPU request, which is invalid.
Solution
Step 1: Compare CPU request and limit values
CPU request is 100m (0.1 CPU), CPU limit is 50m (0.05 CPU).
Step 2: Validate Kubernetes rules for requests and limits
CPU limit must be equal or greater than CPU request. Here limit < request, which is invalid.
Final Answer:
CPU limit is less than CPU request, which is invalid. -> Option D
Quick Check:
Limit >= Request rule violated = CPU limit is less than CPU request, which is invalid. [OK]
Hint: Limit must be >= request, else config is invalid [OK]
Common Mistakes:
Setting limit less than request
Thinking CPU values must be integers
Believing requests and limits can't coexist
5. You want to ensure a container always gets at least 250m CPU but never uses more than 750m CPU. Which YAML snippet correctly sets this with CPU requests and limits?
hard
A. resources:
requests:
cpu: "250m"
limits:
cpu: "750m"
B. resources:
requests:
cpu: "750m"
limits:
cpu: "250m"
C. resources:
requests:
cpu: 0.25
limits:
cpu: 0.75
D. resources:
requests:
cpu: "0.75"
limits:
cpu: "0.25"
Solution
Step 1: Identify correct CPU units and values
CPU values can be specified as millicores with 'm' suffix, e.g., "250m" for 0.25 CPU.
Step 2: Check request and limit order
Request must be less than or equal to limit. resources:
requests:
cpu: "250m"
limits:
cpu: "750m" sets request to 250m and limit to 750m correctly.
Final Answer:
resources:
requests:
cpu: "250m"
limits:
cpu: "750m" -> Option A
Quick Check:
Request 250m ≤ Limit 750m with correct units = resources:
requests:
cpu: "250m"
limits:
cpu: "750m" [OK]
Hint: Use millicores with 'm' and keep request ≤ limit [OK]
Common Mistakes:
Swapping request and limit values
Using decimal numbers without quotes
Not using millicores for fractional CPU
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.