A Resource Quota is a limit set on the amount of compute resources (like CPU, memory) or objects (like pods, services) that can be used in a Kubernetes namespace. It helps control resource usage and prevent one team or app from using too much.
Click to reveal answer
beginner
Why use Resource Quotas per namespace?
Resource Quotas ensure fair resource sharing among teams or projects by limiting how much CPU, memory, or other resources each namespace can consume. This avoids resource exhaustion and keeps the cluster stable.
Click to reveal answer
beginner
Which Kubernetes object defines Resource Quotas?
The ResourceQuota object defines limits on resources in a namespace. It is created with a YAML file specifying limits like cpu, memory, pods, and services.
Click to reveal answer
intermediate
What happens if a namespace exceeds its Resource Quota?
Kubernetes will reject new resource creation requests (like new pods) that exceed the quota. Existing resources keep running, but no new ones can be added until usage is below the quota.
Click to reveal answer
beginner
How to check current Resource Quota usage in a namespace?
Use the command kubectl get resourcequota -n <namespace> to see quota limits and current usage in that namespace.
Click to reveal answer
What does a Resource Quota limit in Kubernetes?
AThe number of nodes in the cluster
BThe amount of resources a namespace can use
CThe version of Kubernetes running
DThe number of users accessing the cluster
✗ Incorrect
Resource Quotas limit resource usage like CPU, memory, and object counts within a namespace.
Which command shows Resource Quotas in a namespace?
Akubectl get pods
Bkubectl describe nodes
Ckubectl get resourcequota -n namespace
Dkubectl get namespaces
✗ Incorrect
The command 'kubectl get resourcequota -n namespace' lists quotas and usage in that namespace.
What happens if you try to create a pod exceeding the Resource Quota?
AThe cluster automatically adds more resources
BThe pod is created but marked as pending
CThe pod is created and quota is ignored
DThe pod creation is rejected
✗ Incorrect
Kubernetes rejects creation of resources that exceed the quota limits.
Resource Quotas are applied at which Kubernetes scope?
ANamespace
BCluster-wide
CNode level
DPod level
✗ Incorrect
Resource Quotas limit resource usage within a specific namespace.
Which resource can NOT be limited by a Resource Quota?
ANumber of nodes
BNumber of pods
CMemory usage
DCPU usage
✗ Incorrect
Resource Quotas do not limit cluster nodes; they limit resources inside namespaces.
Explain what a Resource Quota is and why it is important in Kubernetes namespaces.
Think about how to share resources fairly among teams.
You got /4 concepts.
Describe how to create and check a Resource Quota in a Kubernetes namespace.
Focus on commands and YAML structure.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of a ResourceQuota in a Kubernetes namespace?
easy
A. To limit the amount of resources like CPU and memory used in that namespace
B. To increase the CPU speed of all pods in the namespace
C. To delete unused pods automatically
D. To backup data stored in the namespace
Solution
Step 1: Understand ResourceQuota purpose
A ResourceQuota sets limits on resource usage like CPU, memory, pods, and storage within a namespace.
Step 2: Compare options with purpose
Only To limit the amount of resources like CPU and memory used in that namespace correctly describes limiting resource usage. Other options describe unrelated actions.
Final Answer:
To limit the amount of resources like CPU and memory used in that namespace -> Option A
Quick Check:
ResourceQuota limits resources = D [OK]
Hint: ResourceQuota controls resource limits per namespace [OK]
Common Mistakes:
Thinking ResourceQuota speeds up pods
Confusing quotas with backups
Assuming quotas delete pods automatically
2. Which of the following is the correct YAML snippet to define a CPU limit of 2 cores in a ResourceQuota?
easy
A. hard:
limits.cpu: "2"
B. resources:
limits:
cpu: "2"
C. hard:
cpu: "2"
D. hard:
limits.cpu: 2
Solution
Step 1: Recall ResourceQuota syntax for limits
ResourceQuota uses the hard field with resource names like limits.cpu as keys and string values.
Step 2: Check each option's syntax
hard:
limits.cpu: "2" correctly uses hard: with limits.cpu: "2". resources:
limits:
cpu: "2" uses wrong keys, C misses limits., D uses number instead of string.
Final Answer:
hard:
limits.cpu: "2" -> Option A
Quick Check:
ResourceQuota hard limits use string values with resource keys [OK]
Hint: ResourceQuota limits use 'hard' with string values [OK]
Common Mistakes:
Using numeric values instead of strings
Omitting 'limits.' prefix in resource keys
Placing limits under wrong YAML keys
3. Given this ResourceQuota YAML applied to namespace dev:
D. Resource keys 'cpu' and 'memory' are invalid; should use 'limits.cpu' and 'limits.memory'
Solution
Step 1: Check resource keys in ResourceQuota
ResourceQuota requires full resource names like limits.cpu or requests.memory, not just cpu or memory.
Step 2: Validate YAML fields
API version is present, namespace existence is unrelated to syntax error, and values must be strings (which they are).
Final Answer:
Resource keys 'cpu' and 'memory' are invalid; should use 'limits.cpu' and 'limits.memory' -> Option D
Quick Check:
Use full resource keys like limits.cpu [OK]
Hint: Use full resource keys like limits.cpu in quotas [OK]
Common Mistakes:
Using short keys like 'cpu' instead of 'limits.cpu'
Assuming missing namespace causes syntax error
Using numeric values instead of strings
5. You want to limit a namespace to 5 pods and 2Gi memory requests, but allow unlimited CPU. Which ResourceQuota YAML snippet achieves this?
hard
A. spec:
hard:
pods: "5"
requests.memory: "2Gi"
requests.cpu: "0"
B. spec:
hard:
pods: "5"
requests.memory: "2Gi"
C. spec:
hard:
pods: "5"
requests.memory: "2Gi"
limits.cpu: "unlimited"
D. spec:
hard:
pods: "5"
requests.memory: "2Gi"
requests.cpu: "-1"
Solution
Step 1: Understand ResourceQuota limits
To limit pods and memory requests, specify those keys under hard. Omitting CPU means no limit on CPU.
Step 2: Evaluate options for CPU limits
spec:
hard:
pods: "5"
requests.memory: "2Gi" omits CPU limits, allowing unlimited CPU. Options A, C, D try to set CPU limits with invalid or restrictive values.
Final Answer:
spec:
hard:
pods: "5"
requests.memory: "2Gi" -> Option B
Quick Check:
Omit CPU limit to allow unlimited CPU [OK]
Hint: Omit resource in quota to allow unlimited usage [OK]
Common Mistakes:
Setting CPU limit to 0 or negative disables pods
Using 'unlimited' as a value (not valid)
Trying to limit CPU when unlimited is desired
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.