Restrict Namespace Resources Using ResourceQuota
Scenario
A namespace team-a already exists in the cluster. The platform team wants to restrict resource consumption and the number of objects created in this namespace by configuring a ResourceQuota.
Task
- Create a ResourceQuota named
team-a-quotain the namespaceteam-awith the following limits:Resource Limit pods 3requests.cpu 1requests.memory 128Milimits.cpu 2limits.memory 1Giconfigmaps 5secrets 3 - Create a Deployment named
backend-appin the same namespace using the imagenginx. - Configure the Deployment with
2replicas. - Configure CPU and memory requests and limits to stay within the ResourceQuota and achieve Burstable QoS.
- Verify that all Pods are running successfully and assigned the Burstable QoS class.
Important Constraints
- The total Pods created by the Deployment must not exceed the Pod quota (
3). - The total CPU and memory requests/limits across both replicas must stay within the quota to achieve Burstable QoS.
Hint 1
A ResourceQuota enforces hard limits on the total resources and object counts in a namespace. When a ResourceQuota is present, every Pod must explicitly specify resource requests and limits. For Burstable QoS, set requests lower than limits. See the official docs: ResourceQuota