tencent cloud

Feedback

Node Resource Reservation Description

Last updated: 2022-09-22 11:01:21

    TKE clusters occupy node resources to run add-ons (such as kubelet, kube-proxy, and runtime). Therefore, the total number of node resources and the number of allocable resources in a cluster may differ from each other. This document describes the policies and notes in terms of node resource reservation in TKE clusters so that you can set reasonable numbers of requested resources and limited resources for Pods when deploying an application.

    Policy for Calculating Allocable Node Resources

    Calculation formula

    Allocable = Capacity - Reserved - Eviction - Threshold

    Node CPU reservation rules

    Node CPU Reservation Rule Description
    1c <= CPU <= 4c 0.1c is reserved. -
    4c < CPU <= 64c 0.1c is reserved for the 4c part, and 2.5% for the excessive part. For example, if CPU = 32c,
    reserved resources = 0.1 + (32 - 4) * 2.5% = 0.8c.
    64c < CPU <= 128c 0.1c is reserved for the 4c part, 2.5% for the 4c to 64c part, and 1.25% for the excessive part. For example, if CPU = 96c,
    reserved resources = 0.1 + (64 - 4) * 2.5% + (96 - 64) * 1.25% = 2c.
    CPU > 128c 0.1c is reserved for the 4c part, 2.5% for the 4c to 64c part, 1.25% for the 64c to 128c part, and 0.5% for the excessive part. For example, if CPU = 196c,
    reserved resources = 0.1 + (64 - 4) * 2.5% + (128 - 64) * 1.25% + (196 - 128) * 0.5% = 2.74c.

    Node memory reservation rules

    Node Memory Reservation Rule Description
    1 GB <= Memory <= 4 GB 25% is reserved. For example, if memory = 2 GB,
    reserved resources = 2 * 25% = 512 MB.
    4 GB < Memory <= 8 GB 25% is reserved for the 4 GB part, and 20% for the excessive part. For example, if memory = 8 GB,
    reserved resources = 4 * 25% + (8 - 4) * 20% = 1,843 MB.
    8 GB < Memory <= 16 GB 25% is reserved for the 4 GB part, 20% for the 4 GB to 8 GB part, and 10% for the excessive part. For example, if memory = 12 GB,
    reserved resources = 4 * 25% + (8 - 4) * 20% + (12 - 8) * 10% = 2,252 MB.
    16 GB < Memory <= 128 GB 25% is reserved for the 4 GB part, 20% for the 4 GB to 8 GB part, 10% for the 8 GB to 16 GB part, and 6% for the excessive part. For example, if memory = 32 GB,
    reserved resources = 4 * 25% + (8 - 4) * 20% + (16 - 8) * 10% + (32 - 16) * 6% = 3,645 MB.
    Memory > 128 GB 25% is reserved for the 4 GB part, 20% for the 4 GB to 8 GB part, 10% for the 8 GB to 16 GB part, 6% for the 16 GB to 128 GB part, and 2% for the excessive part. For example, if memory = 320 GB,
    reserved resources = 4 * 25% + (8 - 4) * 20% + (16 - 8) * 10% + (128 - 16) * 6% + (320 - 128) * 2% = 13,475 MB.
    Note:

    You can use custom kubelet parameters to modify kube-reserved for node resource reservation. We recommend you reserve sufficient CPU and memory resources for add-ons to ensure node stability.

    Viewing Allocable Node Resources

    Run the following command (replace NODE_NAME with the actual node name) to check the allocable node resources in a cluster. The output result contains Capacity and Allocatable fields, along with measurements of CPU, memory, and temporary storage.

    kubectl describe node NODE_NAME | grep Allocatable -B 7 -A 6
    

    Notes

    • The reservation policy automatically takes effect for K8s v1.16 or later and nodes created after June 24, 2022, without no manual configuration required.
    • To ensure your business stability, the reservation policy won't take effect for existing nodes. This is because allocable resources may become fewer based on the calculation method, which means possible node eviction for nodes requiring a large number of resources.
    • If you want to apply the reservation policy to existing nodes, remove them from the cluster without termination and then add them in the TKE console. In this case, they become newly added nodes subject to the policy by default.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support