Limits and Quotas Flashcards
OpenShift Container Platform can enforce quotas that track and limit the use of two kinds of
resources. What are they?
Object counts:
The number of Kubernetes resources, such as pods, services and routes.
Compute resources:
The number of physical or virtual hardware resources, such as CPU, memory, and storage capacity.
Delete all resources associated with the hello-world app
$ oc delete all -l app=hello-world
If an oc describe on a pod shows FailedScheduling… 3 Insufficient cpu what actions can be taken?
Reduce the CPU resources being requested from a number of CPUs to a number of CPU millicores (1/1000 of a CPU) by editing the deployment yaml file:
From-
requests:
cpu: “3”
To-
requests:
cpu: “1200m:
Simple command to get CPU and memory usage of a pod?
$ oc adm top pod
Commands to create a quota named project-quota that limits the schedule-limit project to
3 CPUs, 1 GB of memory, and 2 configuration maps.
Log on as an admin user:
$ oc login -u admin -p password
Create the quota:
$ oc create quota project-quota –hard cpu=”3”,memory=”1G”,configmaps=”2” -n schedule-limit
Redirect a bootstrap project-template for customization to a file in /tmp. Use the file to create a new template resource in the openshift-config namespace
$ oc adm create-bootstrap-project-template -o yaml > /tmp/project-template.yaml
$ oc create -f /tmp/project-template.yaml -n openshift-config
Bonus points:
Know that you’ll need to edit project.config.openshift.io/cluster to update the cluster.
In what exact section of the Red Hat Openshift docs do you find arrays for setting routes and ingress?
Networking > Network policy > About Network Policy
Bonus points:
Know that you’ll likely want to use the arrays from ‘Only allow connections from the OpenShift Container Platform Ingress Controller’ section minus the last 3 lines, combined with all lines from ‘Only accept connections from pods within a project’ when building a project template
In what exact section of the Red Hat Openshift docs would you find the arrays for setting up limit ranges?
Nodes> Working with clusters> Setting limit ranges
Bonus points:
Know that you’ll likely want to use the section ‘Container LimitRange object definition’ when building a project template
In what exact section of the Red Hat Openshift docs would you find the arrays for setting resource quotas
Building Applications> Quotas> Resource Quotas per project
Bonus points:
Know that you’ll likely want to use the contents of the compute-resources.yaml when building a project template
Command to update the cluster with a newly created template for the default project-template
$ oc edit project.config.openshift.io/cluster
Make the changes to spec{} by adding the below array:
spec:
projectRequestTemplate:
name: project-request
From the command line, how do you monitor pods being recreated in the namespace openshift-apiserver?
$ watch oc get pods -n openshift-apiserver
From the command line, how can you view quotas and limits from the project myproject?
$oc describe project my project
limits and quotas are listed at the bottom
Or for bonus points:
$ oc get resourcequotas,limitranges