Skip to main content
This lesson shows how to create and validate a namespace-wide ResourceQuota in OpenShift that limits the total memory requested by pods. You’ll:
  1. Create a namespace (project).
  2. Apply a ResourceQuota manifest that restricts requests.memory.
  3. Deploy a sample application that requests memory and observe quota usage.

1) Create a project (namespace)

In the OpenShift web console:
  • Click Home → Projects → Create Project
  • Name: limittester (Display name can be the same)
  • Description: namespace for resource testing
Screenshot of the Red Hat OpenShift web console with a "Create Project" modal open showing the Name and Display name set to "limittester" and a description field being edited. The left sidebar shows the Administrator menu with Projects selected.

2) Create a ResourceQuota manifest

ResourceQuota is in the core API group (apiVersion: v1). The example below enforces a namespace-wide cap on the sum of all pod/container memory requests in the limittester namespace.
This manifest ensures the total requests.memory across the namespace cannot exceed 512Mi. Apply the manifest:
Verify the quota exists:
Example output:
The requests.memory column shows current usage (0 of 512Mi in this example).
ResourceQuota tracks resource requests and/or limits depending on which keys you set. In this example, we restrict requests.memory, so only memory requests are counted toward the quota.

Quick reference: ResourceQuota keys

For full available keys, see the official Kubernetes ResourceQuota documentation (link below).

3) Test the quota with a Deployment

Create a Deployment that sets a resources.requests.memory value. ResourceQuota counts the requests field, not limits (unless you also set a quota for limits.memory).
Apply the Deployment:
If you see PodSecurity warnings when applying the deployment, the resource may still be created. However, a strict PodSecurity admission policy or other admission controllers could block pod creation—verify pods are running with oc get pods -n limittester.
Check the Deployment and pods:
Re-check the ResourceQuota usage after the Deployment is running:
Example output showing quota consumption:
Now requests.memory shows 100Mi/512Mi because the Deployment requests 100Mi. If you create additional pods or increase requests, the quota usage will update. The API will refuse creation of resources that would cause the namespace to exceed the configured hard limits.

Watch Video