loading...
Cover image for How to limit resources using Quotas & Limit Ranges in OpenShift?

How to limit resources using Quotas & Limit Ranges in OpenShift?

sagarjadhv23 profile image Sagar Jadhav Updated on ・1 min read

OpenShift Essentials (8 Part Series)

1) How to manage Users & Project in Openshift? 2) How to create route in OpenShift? 3 ... 6 3) How to scale an application in OpenShift? 4) How to use Persistent Storage in OpenShift? 5) How to deploy application using Source to Image (S2I) in OpenShift? 6) How to monitor application using probes in OpenShift? 7) How to limit resources using Quotas & Limit Ranges in OpenShift? 8) How to deploy an application using Templates in OpenShift?

Objective

  • Create project my-project
  • Create Quota & Limit Ranges for project my-project
  • Deploy Node JS Application using S2I
  • Verify allocated Quota & Limits

Step 1: Set up OpenShift environment

Go to Katacoda.com & click on start scenario

Step 2: Create project my-project

oc new-project my-project

Step 3: Create quota

oc create quota project-quota --hard=pods=10

Step 4: Describe quota

oc describe quota project-quota

Step 5: Create limit ranges

vi limits.yaml

Add following limit range

apiVersion: v1
kind: LimitRange
metadata:
    name: project-limits
spec:
    limits:
        -
            type: Container
            max: {cpu: '2'}
            min: {cpu: 100m}
            default: {cpu: 300m}
oc create -f limits.yaml

Step 6: Describe limit ranges

oc describe limits project-limits

Step 7: Describe node

oc describe node localhost | grep -A 4 Allocated

Step 8: Deploy nodejs application using s2i

oc new-app -i nodejs:8 https://github.com/sagar-jadhav/node-hello --name nodejs -l app=demo

Step 9: Describe quota

oc describe quota project-quota

Step 10: Describe limit

oc describe limits project-limits

Step 11: Scale up nodejs application

oc scale dc nodejs --replicas=9

Step 12: Describe quota

oc describe quota project-quota

Step 13: Describe limit

oc describe limits project-limits

Step 14: Scale up nodejs application

oc scale dc nodejs --replicas=15

Step 15: List pods

oc get pods

Step 16: List events

oc get events

OpenShift Essentials (8 Part Series)

1) How to manage Users & Project in Openshift? 2) How to create route in OpenShift? 3 ... 6 3) How to scale an application in OpenShift? 4) How to use Persistent Storage in OpenShift? 5) How to deploy application using Source to Image (S2I) in OpenShift? 6) How to monitor application using probes in OpenShift? 7) How to limit resources using Quotas & Limit Ranges in OpenShift? 8) How to deploy an application using Templates in OpenShift?

Posted on Apr 29 by:

sagarjadhv23 profile

Sagar Jadhav

@sagarjadhv23

Backend Developer (Cloud ☁️) | Cloud Technology Enthusiast (🐳 ☸) Redhat Certified OpenShift Administrator

Discussion

markdown guide