0
0
Kubernetesdevops~20 mins

Resource requests and limits in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Resource Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Pod resource requests and limits effect on scheduling
Given the following Pod YAML, what will be the status of the Pod after applying it to a cluster with only 500m CPU available on any node?

apiVersion: v1
kind: Pod
metadata:
  name: test-pod
spec:
  containers:
  - name: app
    image: nginx
    resources:
      requests:
        cpu: "600m"
      limits:
        cpu: "1"
Kubernetes
kubectl apply -f pod.yaml
kubectl get pod test-pod -o jsonpath='{.status.phase}'
APending
BRunning
CCrashLoopBackOff
DSucceeded
Attempts:
2 left
💡 Hint
Think about how Kubernetes schedules Pods based on resource requests.
🧠 Conceptual
intermediate
1:30remaining
Understanding resource limits impact on container behavior
What happens if a container tries to use more CPU than its limit in Kubernetes?
AThe container is throttled and CPU usage is limited to the set limit
BThe container is immediately terminated
CThe container ignores the limit and uses more CPU
DThe Pod is evicted from the node
Attempts:
2 left
💡 Hint
Think about how CPU limits control usage but do not kill the container.
Troubleshoot
advanced
2:30remaining
Diagnosing OOMKilled due to memory limits
A Pod is repeatedly restarting with status 'OOMKilled'. The Pod spec includes:

resources:
  limits:
    memory: "256Mi"
  requests:
    memory: "128Mi"

What is the most likely cause?
AThe container image is corrupted causing crashes
BThe container did not request enough CPU and was throttled
CThe container tried to use more than 256Mi memory and was killed by the system
DThe Pod was evicted due to node disk pressure
Attempts:
2 left
💡 Hint
OOMKilled means out of memory kill by the kernel.
🔀 Workflow
advanced
2:00remaining
Setting resource requests and limits in a Deployment YAML
Which snippet correctly sets CPU requests to 200m and limits to 500m for a container in a Deployment?
A
resources:
  requests:
    memory: "200m"
  limits:
    memory: "500m"
B
resources:
  limits:
    cpu: "200m"
  requests:
    cpu: "500m"
C
resources:
  cpu:
    requests: "200m"
    limits: "500m"
D
resources:
  requests:
    cpu: "200m"
  limits:
    cpu: "500m"
Attempts:
2 left
💡 Hint
Remember the correct keys under resources are requests and limits.
Best Practice
expert
3:00remaining
Choosing resource requests and limits for production workloads
Which approach is best when setting resource requests and limits for a production Kubernetes workload?
ASet requests low and limits very high to allow burst usage without scheduling issues
BSet requests based on average usage and limits slightly above to allow bursts, monitoring and adjusting over time
CSet requests and limits equal to the maximum expected usage to avoid throttling and evictions
DDo not set requests or limits to let Kubernetes manage resources automatically
Attempts:
2 left
💡 Hint
Think about balancing resource guarantees and flexibility.