- Create a namespace (project).
- Apply a
ResourceQuotamanifest that restrictsrequests.memory. - 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

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.
requests.memory across the namespace cannot exceed 512Mi.
Apply the manifest:
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 aresources.requests.memory value. ResourceQuota counts the requests field, not limits (unless you also set a quota for limits.memory).
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.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.
Links and references
- OpenShift Documentation: https://docs.openshift.com/
- Kubernetes ResourceQuota: https://kubernetes.io/docs/concepts/policy/resource-quotas/
- oc CLI reference: https://docs.openshift.com/container-platform/latest/cli_reference/openshift_cli/getting-started-cli.html