All Products
Search
Document Center

Container Service for Kubernetes:Enable CPU QoS for containers

Last Updated:Oct 21, 2026

In a Kubernetes cluster, you may deploy latency-sensitive LS (Latency Sensitive) and best-effort BE (Best Effort) applications on the same node. Although CPU requests and limits constrain container resources, applications with different priorities can still compete for CPU and degrade QoS—especially for high-priority workloads. Enable container CPU QoS to prioritize CPU resources for LS applications.group identity to reduce workload interference in colocation.

Background: Pod quality of service classes and Assign memory resources to containers and Pods (Kubernetes).

How CPU QoS works

ack-koordinator assigns a group identity to each CPU cgroup. The kernel uses these identities to schedule tasks with differentiated priorities:

  • Faster scheduling for LS tasks: LS tasks receive higher OS scheduling priority, improving response speed and throughput.

  • No preemption by BE tasks: When a BE task wakes up, it cannot preempt a running LS process.

  • SMT isolation: In SMT (Simultaneous MultiThreading) environments, BE and LS tasks do not share the same physical core, preventing hardware-level contention.

Choose a QoS class

QoS class CPU scheduling priority
LS (latency-sensitive) High (group identity: 2)
BE (best-effort) Low (group identity: -1)

Pods labeled koordinator.sh/qosClass: LS get high priority; those labeled koordinator.sh/qosClass: BE get low priority. Without this label, ack-koordinator uses the native Kubernetes QoS class: BestEffort Pods map to BE, all others to LS.

Prerequisites

Ensure the following:

If your nodes do not run Alibaba Cloud Linux, use CPU Suppress to limit BE Pod CPU usage instead.

Billing

ack-koordinator is free to install and use. Additional costs may apply in the following cases:

  • Worker node resources: ack-koordinator runs on worker nodes and consumes CPU and memory. Configure resource requests per module during installation.

  • Prometheus monitoring: If you enable Enable Prometheus Monitoring for ACK-Koordinator and use Alibaba Cloud Prometheus, exposed metrics are billed as custom metrics. Costs depend on cluster size and application count. Review billing of Prometheus instances before enabling, and query usage data to monitor consumption.

Enable CPU QoS

Enable CPU QoS at the cluster level using a ConfigMap, then label your Pods with the appropriate QoS class.

Step 1: Apply the ConfigMap

  1. Create a file named configmap.yaml with the following content:

    To apply CPU QoS to a workload such as a Deployment, add the koordinator.sh/qosClass label to the Pod template under template.metadata.
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: ack-slo-config
      namespace: kube-system
    data:
      # Enable the CPU QoS feature for containers.
      resource-qos-config: |
        {
          "clusterStrategy": {
            "lsClass": {
              "cpuQOS": {
                "enable": true,
                "groupIdentity": 2
              }
            },
            "beClass": {
              "cpuQOS": {
                "enable": true,
                "groupIdentity": -1
              }
            }
          }
        }

    lsClass configures LS Pods; beClass configures BE Pods. Key cpuQOS parameters:

    Parameter Type Valid values Description
    enable Boolean true / false true: enables CPU QoS cluster-wide. false: disables it.
    groupIdentity Integer -1 to 2 The kernel scheduling priority for the cgroup. Higher values mean higher priority. Default: 2 for LS Pods, -1 for BE Pods. Set to 0 to disable group identity for that class.
  2. Check if the ack-slo-config ConfigMap exists in the kube-system namespace:

    • If it exists, patch it to preserve other configuration fields:

      kubectl patch cm -n kube-system ack-slo-config --patch "$(cat configmap.yaml)"
    • If it does not exist, create it:

      kubectl apply -f configmap.yaml

Step 2: Deploy an LS Pod and verify

  1. Create a file named ls-pod-demo.yaml with the following content:

    apiVersion: v1
    kind: Pod
    metadata:
      name: ls-pod-demo
      labels:
        koordinator.sh/qosClass: 'LS' # Specify the QoS class of the Pod as LS.
    spec:
      containers:
      - command:
        - httpd
        - -D
        - FOREGROUND
        image: registry.cn-zhangjiakou.aliyuncs.com/acs/apache-2-4-51-for-slo-test:v0.1
        imagePullPolicy: Always
        name: apache
        resources:
          limits:
            cpu: "4"
            memory: 10Gi
          requests:
            cpu: "4"
            memory: 10Gi
      restartPolicy: Never
      schedulerName: default-scheduler
  2. Deploy the Pod:

    kubectl apply -f ls-pod-demo.yaml
  3. On the node, check the group identity assigned to the LS Pod's cgroup:

    cat /sys/fs/cgroup/cpu/kubepods.slice/kubepods-pod1c20f2ad****.slice/cpu.bvt_warp_ns

    Expected output:

    # The group identity of the LS Pod is 2, which indicates high priority.
    2

Step 3: Deploy a BE Pod and verify

  1. Create a file named be-pod-demo.yaml with the following content:

    apiVersion: v1
    kind: Pod
    metadata:
      name: be-pod-demo
      labels:
        koordinator.sh/qosClass: 'BE' # Specify the QoS class of the Pod as BE.
    spec:
      containers:
        - args:
            - '-c'
            - '1'
            - '--vm'
            - '1'
          command:
            - stress
          image: registry-cn-beijing.ack.aliyuncs.com/acs/stress:v1.0.4
          imagePullPolicy: Always
          name: stress
      restartPolicy: Always
      schedulerName: default-scheduler
  2. Deploy the Pod:

    kubectl apply -f be-pod-demo.yaml
  3. On the node, check the group identity assigned to the BE Pod's cgroup:

    cat /sys/fs/cgroup/cpu/kubepods.slice/kubepods-besteffort.slice/kubepods-besteffort-pod4b6e96c8****.slice/cpu.bvt_warp_ns

    Expected output:

    # The group identity of the BE Pod is -1, which indicates low priority.
    -1

The LS Pod's group identity is 2 and the BE Pod's is -1, confirming CPU QoS is active and the kernel prioritizes LS over BE workloads.

FAQ

Protocol compatibility when upgrading to ack-koordinator

ack-slo-manager v0.8.0 and earlier used the alibabacloud.com/qosClass annotation for CPU QoS. ack-koordinator supports both protocols for incremental migration to koordinator.sh. Support for alibabacloud.com ended July 30, 2023—migrate to the new protocol.

Component version alibabacloud.com protocol koordinator.sh protocol
>= 0.5.2 and < 0.8.0 Supported Not supported
>= 0.8.0 Supported Supported

Next steps