EKS specifies the maximum resources allocated to a pod by annotation specification or automatic Request and Limit calculation. You can select either method.
EKS can add template annotation
in the YAML file of a workload to explicitly specify pod resource specifications. For more information, see Annotation Description.
EKS can calculate the Request and Limit parameters set for a workload to determine the resources required for running pods. The calculation method varies depending on the pod resource type. For more information on how to automatically calculate specified resource specifications based on the Request and Limit parameters, see CPU specification calculation methods for pods and GPU specification calculation methods for pods.
- If
template annotation
is specified for a workload, the annotation configuration prevails and the Request and Limit parameters are not calculated.- For more information on Request and Limit resource allocation, see the supported CPU and GPU specifications in Resource Specifications. If the set values vary greatly from the supported specifications, the allocated resources may exceed expectations, resulting in resource waste.
- Regardless of the set Request and Limit values, the final calculation result will be matched against Resource Specifications, and resources allocated to a pod will never exceed the allowed specifications.
- If Request and Limit are not set for a container in a pod, the Request and Limit values of the container are regarded as 0.
- If Request and Limit are not set for all containers in a pod, the default pod specifications are 1 CPU core and 2-GiB memory.
- Initcontainer and Container are calculated based on the following methods, and the larger value will be used.
Total CPU and Memory Values | Pod Resource Selection Rules |
---|---|
The total CPU and memory values are both 0. | The pod specifications are 1 CPU core and 2-GiB memory. |
Either the total CPU value or the total memory value is 0. | Match the minimum value based on the non-0 total value. For example, if the total CPU value is 0 cores, and the total memory value is 8 GiB, match the minimum CPU value in the allowed specifications with 8-GiB memory. The selected pod specifications are 1 CPU core and 8-GiB memory. |
Neither the total CPU value nor the total memory value is 0. |
Match resource specifications in Resource Specifications. First, select a higher specification (specification A) with a CPU value that is equal to or similar to the total CPU value. Then, select a higher specification with a memory value that is similar to the total memory value.
|
Either the total CPU value or the memory value exceeds the maximum specification. | An error occurs, and resource matching fails. |
You can better understand the CPU specification calculation methods for pods from the following examples.
resources:
limits:
cpu: "1"
memory: 2Gi
requests:
cpu: "1"
memory: 2Gi
## container1
resources:
limits:
cpu: "4"
memory: 4Gi
requests:
cpu: "2"
memory: 4Gi
## container2
resources:
limits:
cpu: "1"
memory: 2Gi
requests:
cpu: "1"
memory: 2Gi
- Typically, GPUs have the same
nvidia.com/gpu
parameter value as vGPUs, and the value must be an integer.- vGPU can be regarded as an independent GPU type. For example, 1/4*V100 indicates that one fourth of the computing power of a V100 GPU card is virtualized to a complete card. During resource allocation, one GPU card is requested, that is, the nvidia.com/GPU value is 1.
Total CPU, Memory, and GPU Values | Pod Resource Matching Rules |
---|---|
The total values must comply with specification requirements, for example, 1, 2, 4, and 8. | First, select a higher specification (specification A) with a GPU value that is equal to or similar to the total GPU value. Then, calculate the CPU and memory values based on CPU specification calculation methods for pods to obtain the CPU specification (specification B).
|
Any total value exceeds the maximum specifications. | An error occurs, and resource matching fails. |
You can better understand the GPU specification calculation methods for pods from the following examples.
## eks.tke.cloud.tencent.com/gpu-type: V100
resources:
limits:
cpu: "8"
memory: 32Gi
nvidia.com/gpu: "1"
requests:
cpu: "4"
memory: 16Gi
nvidia.com/gpu: "1"
## eks.tke.cloud.tencent.com/gpu-type: V100
## container1
resources:
limits:
cpu: "8"
memory: 32Gi
nvidia.com/gpu: "1"
requests:
cpu: "4"
memory: 16Gi
nvidia.com/gpu: "1"
## container2
resources:
limits:
cpu: "32"
memory: 128Gi
nvidia.com/gpu: "1"
requests:
cpu: "16"
memory: 64Gi
nvidia.com/gpu: "1"
Was this page helpful?