Bird
Raised Fist0
Kubernetesdevops~20 mins

Why resource management matters in Kubernetes - Challenge Your Understanding

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Resource Management Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why set resource limits in Kubernetes?

What is the main reason to set CPU and memory limits on containers in Kubernetes?

ATo automatically scale the number of pods based on resource usage
BTo speed up container startup time by reserving resources in advance
CTo allow containers to use unlimited resources when needed
DTo prevent a container from using more resources than allocated, avoiding node instability
Attempts:
2 left
💡 Hint

Think about what happens if one container uses too much CPU or memory.

💻 Command Output
intermediate
1:30remaining
Check resource usage of pods

What is the output of the command kubectl top pod in a Kubernetes cluster?

Kubernetes
kubectl top pod
ALists pods with their current CPU and memory usage
BShows the status of nodes in the cluster
CDisplays the logs of all pods
DShows the YAML configuration of all pods
Attempts:
2 left
💡 Hint

Think about what 'top' means in Linux commands.

🔀 Workflow
advanced
2:30remaining
Order the steps to prevent resource starvation in Kubernetes

Put the steps in the correct order to prevent resource starvation by managing pod resources properly.

A1,2,3,4
B2,1,4,3
C1,3,2,4
D2,3,1,4
Attempts:
2 left
💡 Hint

Think about defining limits first, then checking usage, then adjusting and redeploying.

❓ Troubleshoot
advanced
2:00remaining
Identify the cause of pod eviction

A pod in your Kubernetes cluster was evicted with the message 'The node was low on resource: memory'. What is the most likely cause?

AThe pod image failed to download
BThe pod exceeded its memory limit causing the node to run out of memory
CThe pod's CPU usage was too high causing eviction
DThe pod was deleted manually by an admin
Attempts:
2 left
💡 Hint

Eviction due to low resource usually relates to memory or CPU pressure on the node.

✅ Best Practice
expert
3:00remaining
Choose the best practice for resource requests and limits

Which practice helps ensure efficient resource use and cluster stability in Kubernetes?

ADo not set any resource requests or limits to let Kubernetes manage automatically
BSet very high limits and low requests to allow pods to burst resources freely
CSet resource requests equal to limits for predictable scheduling and avoid overcommitment
DSet requests higher than limits to reserve more resources than allowed
Attempts:
2 left
💡 Hint

Think about how Kubernetes schedules pods and manages resources.

Practice

(1/5)
1. Why is resource management important in Kubernetes?
easy
A. It helps keep applications stable and fair in using CPU and memory.
B. It allows unlimited resource usage for all applications.
C. It disables resource limits to improve speed.
D. It automatically deletes unused pods.

Solution

  1. Step 1: Understand resource management purpose

    Resource management controls how much CPU and memory each app can use to avoid crashes and slowdowns.
  2. Step 2: Identify correct effect of resource management

    It ensures apps run smoothly and share resources fairly, preventing one app from using too much.
  3. Final Answer:

    It helps keep applications stable and fair in using CPU and memory. -> Option A
  4. Quick Check:

    Resource management = stability and fairness [OK]
Hint: Resource management = stable apps + fair CPU/memory use [OK]
Common Mistakes:
  • Thinking resource management allows unlimited usage
  • Confusing resource limits with deleting pods
  • Believing resource management disables limits
2. Which of the following is the correct way to specify resource requests in a pod YAML?
easy
A. resources: requests: cpu: "500m" memory: "128Mi"
B. resources: limits: cpu: "500m" memory: "128Mi"
C. resources: requests: cpu: 500 memory: 128
D. resources: requests: cpu: "500" memory: "128"

Solution

  1. Step 1: Check YAML syntax for resource requests

    Resource requests must be under 'resources.requests' with units like "500m" for CPU and "128Mi" for memory.
  2. Step 2: Identify correct units and structure

    resources: requests: cpu: "500m" memory: "128Mi" uses correct keys and units. resources: limits: cpu: "500m" memory: "128Mi" uses limits, not requests. Options A and D miss units or use wrong formats.
  3. Final Answer:

    resources: requests: cpu: "500m" memory: "128Mi" -> Option A
  4. Quick Check:

    Requests need units and correct YAML keys [OK]
Hint: Requests need units like 'm' for CPU and 'Mi' for memory [OK]
Common Mistakes:
  • Using limits instead of requests
  • Omitting units for CPU or memory
  • Using numeric values without quotes or units
3. Given this pod spec snippet, what happens if the container tries to use 1 CPU but the limit is 500m?
resources:
  requests:
    cpu: "250m"
  limits:
    cpu: "500m"
medium
A. The container can use up to 1 CPU without restrictions.
B. The container ignores limits and uses requested CPU only.
C. The container is limited to 500m CPU and cannot exceed it.
D. The container will be killed immediately for exceeding requests.

Solution

  1. Step 1: Understand CPU requests vs limits

    Requests are guaranteed CPU; limits are the max CPU allowed. Here, request is 250m, limit is 500m.
  2. Step 2: Analyze container CPU usage behavior

    If container tries to use 1 CPU, it exceeds the 500m limit, so Kubernetes restricts it to 500m CPU max.
  3. Final Answer:

    The container is limited to 500m CPU and cannot exceed it. -> Option C
  4. Quick Check:

    CPU limit caps usage at 500m [OK]
Hint: Limits cap max usage; requests guarantee minimum [OK]
Common Mistakes:
  • Confusing requests with limits
  • Thinking container can exceed CPU limit
  • Believing container is killed for exceeding requests
4. You set a pod's memory limit to 256Mi but the container crashes with an OOMKilled error. What is the likely cause?
medium
A. The memory limit was too high, causing a crash.
B. The container tried to use more than 256Mi memory and was killed.
C. The pod did not have any resource requests set.
D. The CPU limit was exceeded, causing the crash.

Solution

  1. Step 1: Understand OOMKilled meaning

    OOMKilled means the container used more memory than its limit and was terminated by Kubernetes.
  2. Step 2: Connect memory limit to crash cause

    Since the limit was 256Mi, using more causes the container to be killed to protect the node.
  3. Final Answer:

    The container tried to use more than 256Mi memory and was killed. -> Option B
  4. Quick Check:

    OOMKilled = memory limit exceeded [OK]
Hint: OOMKilled means memory limit exceeded and container killed [OK]
Common Mistakes:
  • Confusing CPU limit with memory limit
  • Assuming high memory limit causes crash
  • Ignoring resource requests impact
5. You have multiple pods competing for CPU on a node. Pod A requests 200m CPU and limits 400m, Pod B requests 300m and limits 600m. If the node has 1 CPU available, how should Kubernetes allocate CPU to keep apps stable?
hard
A. Kubernetes ignores requests and only enforces limits strictly.
B. Kubernetes allows pods to use unlimited CPU regardless of requests or limits.
C. Kubernetes kills Pod A because it has lower requests than Pod B.
D. Kubernetes guarantees each pod its requested CPU and throttles usage above limits if needed.

Solution

  1. Step 1: Understand CPU requests and limits in multi-pod scenario

    Requests are guaranteed CPU shares; limits are max allowed. Kubernetes schedules pods so requests fit node capacity.
  2. Step 2: Analyze CPU allocation with 1 CPU available

    Pod A gets at least 200m CPU, Pod B gets 300m CPU guaranteed. If usage exceeds limits, Kubernetes throttles CPU to keep node stable.
  3. Final Answer:

    Kubernetes guarantees each pod its requested CPU and throttles usage above limits if needed. -> Option D
  4. Quick Check:

    Requests guarantee CPU; limits cap usage [OK]
Hint: Requests guarantee CPU; limits cap max usage [OK]
Common Mistakes:
  • Thinking pods get unlimited CPU
  • Assuming pods with lower requests get killed
  • Believing limits are ignored
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard