In this guide, you’ll learn how to create and enforce a resource quota in an OpenShift project. By following these steps, you will set up a project, define a resource quota using a YAML manifest, and deploy a pod that respects the quota limitations.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
Step 1: Creating a New Project
Begin by logging in to the OpenShift console. Navigate to Home → Projects and create a new project with the following details:- Project Name: Limit Tester
- Display Name: Same as the project name
- Description: Namespace for Resource Testing
Step 2: Defining the Resource Quota
Open your code editor (for example, VS Code) and create a YAML manifest file namedlimit.yaml. This manifest defines a resource quota that limits the total memory requests for the namespace “limittester” to 512 MiB. In this case, the resource quota is part of the core API group.
- The
metadatasection specifies the quota’s name and the namespace where it applies. - The
spec.hardsection enforces a memory request limit of 512 MiB for all pods in the project.
Step 3: Deploying a Pod with a Memory Request
Next, test the quota by deploying a pod that requests memory. Create or open a deployment manifest file nameddeployment.yaml. In this file, the namespace is explicitly set to “limittester” to ensure the deployment is part of the correct project. Combine the metadata and pod specification in one deployment configuration:
- The
metadata.namespacefield ensures that the deployment is created within the “limittester” project. - The container
carts-dbis configured to request 100 MiB of memory.
You might receive a warning regarding pod security, but the deployment will be created successfully.
With these steps, you have successfully created a project, defined a resource quota, and deployed a pod with a memory request within the specified limits. For further details and advanced configurations, consider exploring additional OpenShift and Kubernetes documentation.