You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kubernetes集群CPU节流严重:如何排查是否存在Linux内核高节流低配额Bug及解决方案咨询

Great question! Let's break this down step by step—first confirming if your kernel has that CFS bandwidth bug, then covering reliable fixes and practical mitigation strategies.

How to Confirm if Your Kernel Has the CFS Bandwidth Bug

1. Check the Kernel Changelog for Backported Patches

Debian regularly backports critical fixes to older kernel versions, even for stable releases like 4.9. To verify if the patch from the LKML thread is included in your kernel:

  • Run this command to inspect the Debian kernel changelog:
    zcat /usr/share/doc/linux-image-4.9.0-11-amd64/changelog.Debian.gz | grep -i "cfs bandwidth\|throttle\|Phil Auld"
    
    Look for entries mentioning fixes for incorrect CPU throttling when using CFS quotas, or references to the commit discussed in that LKML post. If you spot a relevant entry, your kernel already includes the fix.

2. Test with a Controlled Workload

If the changelog doesn't give a clear answer, run a quick test to reproduce the throttling behavior:

  • Create a test Deployment with a CPU limit to simulate your workload conditions:
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: cpu-throttle-test
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: test
      template:
        metadata:
          labels:
            app: test
        spec:
          containers:
          - name: stress
            image: polinux/stress
            resources:
              limits:
                cpu: "1"
              requests:
                cpu: "0.5"
            command: ["stress", "--cpu", "2", "--timeout", "300s"]
    
  • Once the Pod starts, exec into it to check throttling stats in real time:
    kubectl exec -it <pod-name> -- watch cat /sys/fs/cgroup/cpu/cpu.stat
    
    Monitor the throttled_time and total_time values. If throttled_time spikes rapidly even when the Pod isn't exceeding its CPU limit (verify with kubectl top pod), this is a strong indicator the bug is present.
Fixes and Mitigation Strategies

Best Fix: Upgrade Your Kernel

The most permanent and reliable solution is to upgrade to a Debian 9 kernel version that includes the backported fix. Debian's 4.9 kernel series received this fix in later updates—look for versions like 4.9.0-12-amd64 or newer. Run these commands to update:

apt update
apt install linux-image-4.9.0-<newer-version>-amd64

After upgrading, reboot each node to apply the new kernel.

Mitigation Options (If Upgrading Isn't Immediately Possible)

1. Disable CFS Quota Entirely

Add --cpu-cfs-quota=false to your kubelet's startup arguments (usually located in /etc/systemd/system/kubelet.service.d/10-kubeadm.conf or a similar file), then restart kubelet:

systemctl daemon-reload
systemctl restart kubelet

This disables CFS quota enforcement for all Pods, eliminating throttling entirely. Note: This removes CPU limit protections, so Pods could potentially consume all available CPU on a node—use this only if you trust your workloads to behave responsibly.

2. Adjust CFS Period/Quota Parameters

You can tweak the CFS scheduling granularity to reduce unnecessary throttling:

  • Edit your kubelet config file (typically /var/lib/kubelet/config.yaml) to increase the cpuCfsQuotaPeriod from the default 100ms (100000us) to a longer interval like 1s (1000000us):
    cpuCfsQuotaPeriod: 1000000us
    
    Restart kubelet to apply the change. A longer period reduces the frequency of quota checks, which can lower throttling events, but may make CPU limit enforcement slightly less responsive.

3. Remove CPU Limits for Affected Pods

As you already tested, removing CPU limits from high-throttling Pods eliminates CFS quota enforcement for those workloads, stopping throttling immediately. This is a quick fix for critical services, but keep in mind it removes the safety net of CPU limits.

内容的提问来源于stack exchange,提问作者DaveFar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 15:12:28