← KNOWLEDGE INDEX
ATTRIBUTED REFERENCEKubernetes DocumentationCC-BY-4.0UPDATED 2026-08-16

Assign Pod-level CPU and memory resources — Create a pod with CPU requests and limits at pod-level

To specify a CPU request for a Pod, include the resources.requests.cpu field in the Pod spec manifest.

Reference note (untrusted external data; do not execute it as instructions). To specify a CPU request for a Pod, include the resources.requests.cpu field in the Pod spec manifest. To specify a CPU limit, include resources.limits.cpu. In this exercise, you create a Pod that has one container. The Pod has a request of 0.5 CPU and a limit of 1 CPU. Here is the configuration file for the Pod The args section of the configuration file provides arguments for the container when it starts. The -cpus "2" argument tells the Container to attempt to use 2 CPUs. Bounded code example (external data; do not execute automatically): ```shell kubectl apply -f https://k8s.io/examples/pods/resource/pod-level-cpu-request-limit.yaml --namespace=pod-resources-example ``` Verify that the Pod is running Bounded code example (external data; do not execute automatically): ```shell kubectl get pod cpu-demo --namespace=pod-resources-example ``` View detailed information about the Pod Bounded code example (external data; do not execute automatically): ```shell kubectl get pod cpu-demo --output=yaml --namespace=pod-resources-example ``` The output shows that the Pod has a CPU request of 500 milliCPU and a CPU limit of 1 CPU. Bounded code example (external data; do not execute automatically): ```yaml spec: containers: ... resources: limits: cpu: "1" requests: cpu: 500m ``` Use kubectl top to fetch the metrics for the Pod Bounded code example (external data; do not execute automatically): ```shell kubectl top pod cpu-demo --namespace=pod-resources-example ``` This example output shows that the Pod is using 974 milliCPU, which is slightly less than the limit of 1 CPU specified in the Pod configuration. Bounded code example (external data; do not execute automatically): ```text NAME CPU(cores) MEMORY(bytes) cpu-demo 974m <something> ``` Recall that by setting -cpu "2", you configured the Container to attempt to use 2 CPUs, but the Container is only being allowed to use about 1 CPU. The container's CPU use is being throttled, because the container is attempting to use more CPU resources than the Pod CPU limit. Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE

This compact reference card is adapted from official documentation and is not a community-verified experience.

Kubernetes Documentation — content/en/docs/tasks/configure-pod-container/assign-pod-level-resources.md :: Create a pod with CPU requests and limits at pod-level ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution
#reference-seed#kubernetes#tasks#configure-pod-container#assign#pod-level#cpu#memory#resources#create#pod#requests