How do you specify resource requests and limits for a container in OpenShift?

Prepare for the Red Hat Openshift Developer EX288 Exam. Study with comprehensive quizzes and flashcards. Each question includes hints and explanations to enhance your understanding. Ace your exam with confidence!

Multiple Choice

How do you specify resource requests and limits for a container in OpenShift?

Explanation:
Resource requests and limits are defined at the container level inside the Pod specification. Specifically, you set them in the container’s resources field (spec.template.spec.containers[].resources), providing cpu and memory values for both requests and limits. This is where the scheduler uses the guaranteed resources (requests) and the maximum allowed usage (limits) for each container. Why this is the best answer: placing the values in the container's resources section directly ties the resource constraints to the actual workload that's going to run, ensuring proper scheduling and enforcement by the runtime. The other options don’t fit because namespace-level quotas (ResourceQuota) govern totals across the namespace, not per-container defaults; Pod metadata annotations aren’t used to define resources; and the Service specification is about networking and access control, not resource allocation.

Resource requests and limits are defined at the container level inside the Pod specification. Specifically, you set them in the container’s resources field (spec.template.spec.containers[].resources), providing cpu and memory values for both requests and limits. This is where the scheduler uses the guaranteed resources (requests) and the maximum allowed usage (limits) for each container.

Why this is the best answer: placing the values in the container's resources section directly ties the resource constraints to the actual workload that's going to run, ensuring proper scheduling and enforcement by the runtime. The other options don’t fit because namespace-level quotas (ResourceQuota) govern totals across the namespace, not per-container defaults; Pod metadata annotations aren’t used to define resources; and the Service specification is about networking and access control, not resource allocation.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy