The ack-koordinator component provides the elastic resource limit feature. You can use this feature to limit the CPU usage of BestEffort (BE) pods on a node. This ensures the stability of the containers on the node. This topic describes how to use the elastic resource limit feature that is provided by ack-koordinator.

Prerequisites

ack-koordinator 0.4.0 or later is installed. For more information about how to install ack-koordinator, see ack-slo-manager.

Background information

In the Dynamic resource overcommitment model that is provided by ack-koordinator, the total amount of reclaimed resources dynamically changes based on the actual amount of resources used by latency-sensitive (LS) pods. Reclaimed resources can be used by BE pods. You can use the dynamic resource overcommitment feature to improve the resource utilization of a cluster by deploying both LS pods and BE pods in the cluster. To ensure sufficient CPU resources for the LS pods on a node, you can use ack-koordinator to limit the CPU usage of the BE pods on the node. The elastic resource limit feature can maintain the resource utilization of a node below a specified threshold and limit the amount of CPU resources that can be used by BE pods. This ensures the stability of the containers on the node.

CPU Threshold indicates the CPU utilization threshold of a node. Pod (LS).Usage indicates the CPU usage of LS pods. CPU Restriction for BE indicates the CPU usage of BE pods. The amount of CPU resources that can be used by BE pods is adjusted based on the increase or decrease of the CPU usage of LS pods. We recommend that you use the same value for CPU Threshold and the reserved CPU watermark in the dynamic resource overcommitment model. This ensures a consistent level of CPU resource utilization. Elastic resource limit

Procedure

  1. Create a file named configmap.yaml based on the following ConfigMap content:
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: ack-slo-config
      namespace: kube-system
    data:
      # Enable the elastic resource limit feature. 
      resource-threshold-config: |
        {
          "clusterStrategy": {
            "enable": true
          }
        }
  2. Check whether the ack-slo-config ConfigMap exists in the kube-system namespace.
    • If the ack-slo-config ConfigMap exists, we recommend that you run the kubectl patch command to update the ConfigMap. This avoids changing other settings in the ConfigMap.
      kubectl patch cm -n kube-system ack-slo-config --patch "$(cat configmap.yaml)"
    • If the ack-slo-config ConfigMap does not exist, run the kubectl patch command to create a ConfigMap named ack-slo-config:
      kubectl apply -f configmap.yaml
  3. Run the following command to query the CPU cores that are allocated to the BE pods on the node:
    cat /sys/fs/cgroup/cpuset/kubepods.slice/kubepods-besteffort.slice/cpuset.cpus

    Expected output:

    10-25,35-51,62-77,87-103

    The output shows that the following CPU cores are allocated to the BE pods on the node: 10-25, 35-51, 62-77, and 87-103.

  4. Optional:Configure advanced parameters based on the following ConfigMap content.

    The elastic resource limit feature allows you to configure the CPU utilization threshold in a fine-grained manner.

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: ack-slo-config
      namespace: kube-system
    data:
      resource-threshold-config: |
        {
          "clusterStrategy": {
            "enable": true,
            "cpuSuppressThresholdPercent": 65
          }
        }
    The following table describes the parameters.
    Parameter Type Valid value Description
    enable Boolean
    • true
    • false
    • true: enables the elastic resource limit feature.
    • false: disables the elastic resource limit feature.
    cpuSuppressThresholdPercent Int 0~100 The CPU utilization threshold of the node. Unit: %. Default value: 65.