TKE Serverless Cluster specifies the maximum resources allocated to a pod using annotation specification or automatic Request and Limit calculation. You can select either method.
TKE Serverless Cluster can add template annotation
in the YAML file of a workload to explicitly specify the pod resource specifications. For more information, see Annotation Description.
TKE Serverless Cluster 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.
Note:
- If
template annotation
is specified for a workload, the annotation configuration prevails and the Request and Limit parameters are not calculated.- For more information about Request and Limit resource allocation, see the supported CPU and GPU specifications in Resource Specifications. If the set value varies greatly from the supported specifications, the allocation of a resource may exceed expectations, resulting in resource waste.
- Regardless of how Request and Limit are set, the final calculation result will match with that in Resource Specifications, and resources allocated to a pod will not 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 core and 2 GiB.
- Initcontainer and Container are calculated based on the following methods, and the larger value is used.
The total values are the total Request value of all containers in a pod and the maximum Limit value of containers in a pod, respectively.
Total CPU and Memory Values | Pod Resource Selection Rules |
---|---|
The total CPU and memory values are both 0. | The pod specifications are 1 core and 2 GiB. |
Either the total CPU value or 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 allowed specifications with 8 GiB memory. The selected pod specifications are 1 core and 8 GiB. |
Neither the total CPU value nor total memory value is 0. |
Match resource specifications in Resource Specifications. First, select a higher specification (specification A) with a CPU value the same as or similar to the total CPU value. Then, select a higher specification with a memory value similar to the total memory value.
|
Either the total CPU value or memory value exceeds the maximum specification. | An error occurs, and resource matching fails. |
You can better understand the CPU specification calculation methods for pods based on the following examples.
resources:
limits:
cpu: "1"
memory: 2Gi
requests:
cpu: "1"
memory: 2Gi
Note:
- 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 1/4 the computing power of a V100 GPU card is virtualized to a complete card. During resource allocation, one GPU card is applied for, that is, nvidia.com/GPU is 1.
The total GPU value is the total Request value of all containers in a pod.
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 the same as or similar to the total GPU value. Then, calculate the CPU and memory values based on the 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 based on 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"
Note:
Total GPU value: 1
Total CPU value: max(4,8) = 8 cores
Total memory value: max(16,32) = 32 GiB
Result: 8 cores and 32 GiB are less than the CPU and memory values (8 cores and 40 GiB) of the V100 GPU specification (one card) in Resource Specifications. The ultimately selected pod specification is 8 cores, 40 GiB, and 1x V100.
Was this page helpful?