0
0
Kubernetesdevops~20 mins

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

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Memory Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Memory Requests vs Limits

In Kubernetes, what happens if a container uses more memory than its memory request but less than its memory limit?

AThe container is terminated immediately by the system.
BThe container may be evicted depending on node pressure.
CThe container is allowed to use the extra memory without any restrictions.
DThe container's CPU usage is limited but memory usage is ignored.
Attempts:
2 left
💡 Hint

Think about how Kubernetes manages resources when the node is under memory pressure.

💻 Command Output
intermediate
2:00remaining
Check Memory Limits in a Pod

You run the command kubectl describe pod mypod. Which section shows the memory requests and limits for containers?

Kubernetes
kubectl describe pod mypod
AIn the <strong>Volumes</strong> section describing storage.
BUnder the <strong>Events</strong> section at the bottom of the output.
CIn the <strong>Conditions</strong> section near the top.
DUnder the <strong>Containers</strong> section, look for <code>Limits:</code> and <code>Requests:</code> lines.
Attempts:
2 left
💡 Hint

Memory settings are part of container resource specifications.

Configuration
advanced
2:00remaining
YAML for Memory Requests and Limits

Which YAML snippet correctly sets a memory request of 256Mi and a memory limit of 512Mi for a container?

A
resources:
  requests:
    memory: 256MB
  limits:
    memory: 512MB
B
resources:
  memory:
    request: 256Mi
    limit: 512Mi
C
resources:
  requests:
    memory: "256Mi"
  limits:
    memory: "512Mi"
D
resources:
  requests:
    memory: 256
  limits:
    memory: 512
Attempts:
2 left
💡 Hint

Check the correct indentation and units for memory in Kubernetes YAML.

Troubleshoot
advanced
2:00remaining
Pod Evicted Due to Memory Limit

A pod is repeatedly evicted with the message OOMKilled. What is the most likely cause?

AThe pod's memory usage exceeded its memory limit.
BThe pod's disk space was full.
CThe pod's CPU usage exceeded its CPU request.
DThe pod's network bandwidth was exceeded.
Attempts:
2 left
💡 Hint

OOMKilled means Out Of Memory killed by the system.

Best Practice
expert
2:00remaining
Setting Memory Requests and Limits for Stability

Which practice helps ensure stable Kubernetes cluster performance regarding memory requests and limits?

ASet memory requests based on typical usage and limits slightly above peak usage to balance stability and flexibility.
BSet memory requests low and limits very high to allow containers to burst freely.
CSet memory requests equal to limits for all containers to avoid resource contention.
DDo not set memory requests or limits and let Kubernetes manage automatically.
Attempts:
2 left
💡 Hint

Think about balancing guaranteed resources and flexibility.