Challenge - 5 Problems
LimitRange Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
Default CPU limit from LimitRange
Given this LimitRange YAML applied in a namespace, what is the default CPU limit for a pod container without explicit limits?
Kubernetes
apiVersion: v1
kind: LimitRange
metadata:
name: cpu-limit-range
spec:
limits:
- default:
cpu: 500m
defaultRequest:
cpu: 250m
type: ContainerAttempts:
2 left
💡 Hint
Look at the 'default' field under 'limits' for CPU.
✗ Incorrect
The 'default' field under 'limits' sets the default CPU limit applied to containers without explicit limits. Here it is 500m (0.5 CPU).
❓ Configuration
intermediate2:00remaining
Set default memory request and limit
Which YAML snippet correctly sets a default memory request of 128Mi and a default memory limit of 256Mi for containers in a namespace?
Attempts:
2 left
💡 Hint
Remember defaultRequest is the minimum guaranteed, default is the max limit.
✗ Incorrect
Option D correctly sets defaultRequest to 128Mi and default to 256Mi for containers. The type must be 'Container' to apply to container resources.
❓ Troubleshoot
advanced2:30remaining
Pod creation fails due to LimitRange defaults
A pod without resource limits fails to create in a namespace with this LimitRange:
apiVersion: v1
kind: LimitRange
metadata:
name: limit-range
spec:
limits:
- default:
cpu: 200m
memory: 256Mi
max:
cpu: 100m
memory: 128Mi
type: Container
What is the reason for the failure?
Attempts:
2 left
💡 Hint
Check if default values are within max limits.
✗ Incorrect
The default CPU (200m) and memory (256Mi) exceed the max CPU (100m) and max memory (128Mi), causing the pod creation to fail due to invalid resource limits.
🔀 Workflow
advanced2:00remaining
Applying LimitRange to enforce defaults
You want to enforce default CPU and memory limits on all containers in a namespace without requiring users to specify them. Which workflow step is correct?
Attempts:
2 left
💡 Hint
LimitRange is designed to set default resource limits.
✗ Incorrect
LimitRange objects define default resource requests and limits for containers in a namespace. Applying a LimitRange with default values enforces these defaults automatically.
✅ Best Practice
expert3:00remaining
Best practice for setting LimitRange defaults
Which is the best practice when setting default resource limits in a LimitRange to avoid pod failures and resource starvation?
Attempts:
2 left
💡 Hint
Think about balancing resource guarantees and flexibility.
✗ Incorrect
Setting default requests lower than expected usage ensures pods get guaranteed resources without overcommitting, while default limits slightly above typical usage allow pods to burst when needed without causing failures.