0% found this document useful (0 votes)
437 views

Do280 Limiting Resource Usage

This document contains instructions for creating resource limits and quotas in an OpenShift project. It demonstrates creating a deployment with CPU and memory requests, scaling the deployment, and creating load tests that exceed resources and trigger events. Quotas are then applied to limit resources in the project and tested by creating multiple configmaps.

Uploaded by

Srinivasan
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
437 views

Do280 Limiting Resource Usage

This document contains instructions for creating resource limits and quotas in an OpenShift project. It demonstrates creating a deployment with CPU and memory requests, scaling the deployment, and creating load tests that exceed resources and trigger events. Quotas are then applied to limit resources in the project and tested by creating multiple configmaps.

Uploaded by

Srinivasan
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

lab schedule-limit start

source /usr/local/etc/ocp4.config

oc login -u developer -p ${RHT_OCP4_USER_PASSWD} ${RHT_OCP4_MASTER_API}

oc new-project schedule-limit

oc create deployment hello-limit --image quay.io/redhattraining/hello-world-


nginx:v1.0 --dry-run -o yaml > ~/DO280/labs/schedule-limit/hello-limit.yaml

vim ~/DO280/labs/schedule-limit/hello-limit.yaml

spec:
containers:
- image: quay.io/redhattraining/hello-world-nginx:v1.0
name: hello-world-nginx
resources:
requests:
cpu: "3"
memory: 20Mi

oc create --save-config -f ~/DO280/labs/schedule-limit/hello-limit.yaml

oc get pods

oc get events --field-selector type=Warning

vim ~/DO280/labs/schedule-limit/hello-limit.yaml

cpu: "2"

oc apply -f ~/DO280/labs/schedule-limit/hello-limit.yaml

oc get pods

oc scale --replicas 3 deployment/hello-limit

oc get pods

oc get events --field-selector type=Warning

oc delete all -l app=hello-limit

oc create --save-config -f ~/DO280/labs/schedule-limit/loadtest.yaml

oc get routes

curl -X GET http://loadtest-schedule-limit.apps.cluster.domain.example.com


/api/loadtest/v1/mem/150/60

oc get pods

oc adm top pod

curl -X GET http://loadtest-schedule-limit.apps.cluster.domain.example.com


/api/loadtest/v1/mem/200/60

oc get pods
oc adm top pod

oc delete all -l app=loadtest

oc login -u admin -p ${RHT_OCP4_USER_PASSWD}

oc create quota project-quota --hard cpu="3",memory="1G",configmaps="3" -n


schedule-limit

oc login -u developer -p ${RHT_OCP4_USER_PASSWD}

for X in {1..4}
do
oc create configmap my-config${X} --from-literal key${X}=value${X}
done

oc login -u admin -p ${RHT_OCP4_USER_PASSWD}

oc delete resourcequota project-quota

oc delete project schedule-limit

lab schedule-limit finish

You might also like