Managing Resource Quotas

Hands-On Lab

 

Length

01:00:00

Difficulty

Intermediate

In this lab, you are tasked with creating project-level resource limits for the strickland-propane, arlen-high, and megalomart projects. Before moving to the solution, use the official OpenShift documentation to create your own resource quota templates.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Managing Resource Quotas

Instructions

Before moving to the solution, use the official OpenShift documentation to create your own resource quota templates.

Create a new resource limit named C3H8 under the strickland-propane project with the following limits:

  • Configmaps: 5
  • PersistentVolumeClaims: 2
  • Services: 5

Create a new limit-range named probot in the strickland-propane namespace with the following settings:

  • Max CPU per pod: 2
  • Max memory per pod: 1Gi
  • Min CPU per pod: 200m
  • Min memory per pod: 10Mi
  • Max CPU per container: 2
  • Max memory per container: 1Gi
  • Min CPU per container: 100m
  • Min memory per container: 5Mi
  • Default CPU per container: 300m
  • Default memory per container: 200Mi

Solution

  • Log in to the OpenShift cluster using the credentials provided on the hands-on lab page:

    ssh cloud_user@<IP_ADDRESS>
  • Become the root user:

    sudo -i
  • Check the status of your cluster:

    oc get nodes
  • Create the project strickland-propane:

    oc new-project strickland-propane --description="Arlen Tx Engineering project"
  • Switch to the strickland-propane project:

    oc project strickland-propane
  • Create a new resource limit called c3h8.yml:

    vim c3h8.yml
  • Include the following as the contents of the file:

    apiVersion: v1
    kind: ResourceQuota
    metadata:
      name: c3h8
    spec:
      hard:
        configmaps: "5"
        persistentvolumeclaims: "2"
        services: "5"
  • Save and close the file:

    :wq
  • Create the project:

    oc create -f c3h8.yml -n strickland-propane
  • Create a new limit-range called probot.yml:

    vim probot.yml
  • Include the following as the contents of the file:

    apiVersion: "v1"
    kind: "LimitRange"
    metadata:
      name: "resource-limits" 
    spec:
      limits:
        -
          type: "Pod"
          max:
            cpu: "2" 
            memory: "1Gi" 
          min:
            cpu: "200m" 
            memory: "6Mi" 
        -
          type: "Container"
          max:
            cpu: "2" 
            memory: "1Gi" 
          min:
            cpu: "100m" 
            memory: "4Mi" 
          default:
            cpu: "300m" 
            memory: "200Mi" 
          defaultRequest:
            cpu: "200m" 
            memory: "100Mi" 
          maxLimitRequestRatio:
            cpu: "10"
  • Save and close the file:

    :wq
  • Create the limit-range:

    oc create -f probot.yml

Conclusion

Congratulations, you've completed this hands-on lab!