Enforcing team resource limits with ResourceQuota and LimitRange

PCD By islever Editorial Last updated

Short answer

BC Create a namespace per team with a ResourceQuota and add a LimitRange so every pod in that namespace gets enforced default compute requests and limits.

Question

You are designing a resource-sharing policy for applications used by different teams in a Google Kubernetes Engine cluster. You need to ensure that all applications can access the resources needed to run. What should you do? (Choose two.)
  1. Specify the resource limits and requests in the object specifications.
  2. Create a namespace for each team, and attach resource quotas to each namespace. Correct Answer
  3. Create a LimitRange to specify the default compute resource requirements for each namespace. Correct Answer
  4. Create a Kubernetes service account (KSA) for each application, and assign each KSA to the namespace.

Key Takeaways

Multi-tenant GKE resource control is won by pairing namespace-level ResourceQuotas with per-namespace LimitRanges. Option B isolates each team's aggregate CPU and memory consumption, while option C fills in default requests and limits for pods that declare none, so the quota is actually enforceable. Options A and D fail because per-object specs are not guaranteed and service accounts govern identity, not capacity.

Expert Analysis

Resource quotas at the namespace level (B) limit resource consumption per team. NetworkPolicy with namespace selectors (C) controls inter-team traffic. IAM alone (A) doesn't control resource consumption. Node selectors (D) schedule pods but don't limit resources.

The shipped explanation's own option labels do not survive contact with this question: its C is a NetworkPolicy for inter-team traffic, while this question's C is a LimitRange, and its D is node selectors, while this question's D is a Kubernetes service account assigned to a namespace. Judged against the letters this question actually defines, B and C are the pair that fits.

B (namespace per team plus a ResourceQuota) is the direct answer to a resource-sharing policy across teams. A ResourceQuota is namespaced: it caps the aggregate requests.cpu, requests.memory, limits.cpu, limits.memory, and object counts inside one namespace, and the API server rejects a pod in that namespace whose request would push the namespace over the quota. Giving each team its own namespace with its own quota means one team's workload cannot starve the others, which is exactly the isolation the scenario asks for.

C (a LimitRange per namespace) is the enforcement half of the same mechanism. A LimitRange sets per-pod minima, maxima, and — critically — default requests and limits for any container that omits them. In a cluster where teams deploy manifests written by different authors, a LimitRange is what makes option A's per-object specification reliable rather than optional: a pod with no resources block inherits the namespace defaults, so no team can accidentally schedule an unbounded container. A LimitRange alone does not cap the namespace total, and a ResourceQuota alone is unenforceable for containers that specify nothing, because the quota only counts declared requests. Together they are the standard GKE pattern for multi-tenant resource control, and both are namespace-scoped, matching the question's "each team" framing.

A (specifying limits and requests in object specifications) is the right practice but the wrong answer to "choose two." Nothing in the question guarantees that every team's manifest declares resources, and a pod-level declaration constrains only that pod — it neither bounds a team's aggregate consumption nor supplies defaults to pods that specify nothing. It is the behavior that options B and C are designed to make enforceable.

D (a Kubernetes service account per application, assigned to a namespace) addresses identity and authentication, not capacity. A KSA determines how a pod authenticates to Google Cloud APIs and to in-cluster components; it has no field for CPU or memory, and creating one per application neither bounds a team's consumption nor guarantees that applications can run. It fails both halves of the requirement.

One mechanism this question leans on without stating it: GKE admission-time enforcement. When a ResourceQuota with a scopes/scopeSelector or a plain resource quota is active, the API server evaluates every pod creation request against the namespace's current totals before the pod is admitted, so over-quota pods never reach a node; the LimitRange is checked in the same admission chain, filling in defaults before the quota comparison. That ordering is why B and C compose rather than overlap.

Official Reference

Exam Strategy

On GKE multi-tenancy items, look for the pair that separates per-pod enforcement from per-namespace aggregation: LimitRange supplies defaults and bounds, ResourceQuota caps the total. If an option is good practice but only affects individual pods or individual manifests (like declaring requests directly), it is usually a distractor for a question asking what to do for whole teams. Reserve identity-oriented objects such as service accounts for questions about authentication, not capacity.

Practice All PCD Questions

Access 84 questions with complete answers and detailed explanations.

View Full PCD Practice Test →

← Back to PCD Study Guide