Tuesday, January 21, 2025

OpenShift - Quota - Part 3

 

Quota:

Quota is a set a limit from project level

#oc create quota --help | more

Resource Quota:

#oc create resourcequota --help | more

We can set a limit for the resource through resourcequota.

* CPU

* Memory

* Number of Deployments

* number of services

* number of service accounts

* config Map

* Service accounts

* number of Pods

It will allow the restriction of users and avoid over provision.

Example:

#oc create quota my-quota --hard=cpu=1,memory=1G,pods=2,services=3,replicationcontroller=1,secrets=5,persistentvolumeclaims=10 -n testquota

List resource under core group:

#oc api-resources --api-group="" --namespaced=true

Resource group:

#oc create resourcequota test --hard=count/pods=1

Utilization of resources in OCP cluster:

#oc adm top nodes

Create an APP for testing purpose:

#oc new-app --name myapp --image=registry.example.com:8443/helloworld-nginx

Set a resources for the app

#oc set resources deployment myapp --limits=cpu=200m,memory=300M --requests=cpu=100m,memory=200M

#oc set resources dc/myapp --limits=memory=60Mi --requests=memory=20Mi

Monitoring the process of resources:

#watch oc get all

List the events with timestamp:

#oc get events --sort-by=.metadata.creationTimestamp

Delete a pod:

#oc delete pod -l deploymentconfig=myapp1

No comments:

Post a Comment