How can you restrict a pod from using more than a specified amount of CPU or memory?

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 can you restrict a pod from using more than a specified amount of CPU or memory?

Explanation:
The key idea is to enforce limits directly on the pod’s containers. To restrict a pod from using more CPU or memory than you want, you specify resource limits in the container spec (and often also a request for scheduling). For example, in the container you would set limits such as cpu: "500m" and memory: "256Mi" (and optionally provide matching requests). The system then enforces these caps, throttling CPU usage when needed and terminating or sandboxing the container if memory exceeds the limit. If you want defaults or namespace-wide controls, you can add a LimitRange in the namespace or a ResourceQuota to cap total usage, but the per-pod cap comes from the container’s resource limits. Options that talk about increasing limits, kernel parameters, or readiness probes don’t impose per-pod resource caps.

The key idea is to enforce limits directly on the pod’s containers. To restrict a pod from using more CPU or memory than you want, you specify resource limits in the container spec (and often also a request for scheduling). For example, in the container you would set limits such as cpu: "500m" and memory: "256Mi" (and optionally provide matching requests). The system then enforces these caps, throttling CPU usage when needed and terminating or sandboxing the container if memory exceeds the limit. If you want defaults or namespace-wide controls, you can add a LimitRange in the namespace or a ResourceQuota to cap total usage, but the per-pod cap comes from the container’s resource limits. Options that talk about increasing limits, kernel parameters, or readiness probes don’t impose per-pod resource caps.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy