login
K8S Pod CPU Throttling vs Eviction
2025/08/11·StepFun can make mistakes, check important info.
K8S里有pod的cpu很高,触发cpu限频,这个pod会被驱逐么
Reason
来源
K8S Pod状态为“被驱逐(evicted)”的解决方法
在Kubernetes中,pod是最小的调度单元。当Pod无法在所分配的节点上正常运行时,它可能会被驱逐(evicted)。这种情况可能是由多种原因引起,比如节点资源不足、Pod超出了所分配的资源限制、镜像拉取失败等。酒酿小圆子~K8S/Kubernetes
https://s2.zimgs.cn/ims?kt=url&at=smstruct&key=aHR0cHM6Ly9jZG4uc20uY24vdGVtcC8yMDIzMTEwNzE2MjUyNi1tYnF0anhlZG9hZHdlbTF1bjh2aXUyZmJqOWdiaDV4aS5qcGc=&sign=yx:yQchh3-fC9nPjUvoM67lCnyns5g=&tv=400_400
CSDN技术社区
K8S学习指南(48)-k8s的pod驱逐
Kubernetes(K8s)是一款开源的容器编排平台,具有强大的调度和管理能力。在容器化应用部署到Kubernetes集群时,由于各种原因(例如节点故障、资源不足等),可能会触发Pod的驱逐操作。本文将深入探讨Kubernetes中Pod的驱逐机制,解释驱逐的原因、策略以及如何优雅地处理Pod的驱逐,同时提供详细的示例演示实际应用场景中的驱逐操作...
https://s2.zimgs.cn/ims?kt=url&at=smstruct&key=aHR0cHM6Ly9jZG4uc20uY24vdGVtcC8yMDIzMTEwNzE2MjUyNi1tYnF0anhlZG9hZHdlbTF1bjh2aXUyZmJqOWdiaDV4aS5qcGc=&sign=yx:yQchh3-fC9nPjUvoM67lCnyns5g=&tv=400_400
CSDN技术社区
一文轻松说透 K8S Pod 各种驱逐场景
由于三个新水果有节点无法满足的内存或 CPU 要求,kubelet 驱逐所有优先级低于新水果的 Pod。Blueberry 保持运行,因为它具有更高的优先级。NAME READY STATUS RESTARTS AGE banana 0/1 ContainerCreating 0 2s blueberry 1/1 Running 0 4h42m raspberry 0/1 Terminating 0 59m strawberry 0/1 Terminat...
https://s2.zimgs.cn/ims?kt=url&at=smstruct&key=aHR0cHM6Ly9jZG4uc20uY24vdGVtcC8yMDIzMTEwNzE2MjUyNi1tYnF0anhlZG9hZHdlbTF1bjh2aXUyZmJqOWdiaDV4aS5qcGc=&sign=yx:yQchh3-fC9nPjUvoM67lCnyns5g=&tv=400_400
CSDN技术社区
7 web pages
CSDN技术社区
CSDN技术社区
CSDN技术社区
CSDN技术社区
CSDN技术社区
阿里云开发者社区
CSDN技术社区
思考过程

Okay, let's tackle this question about whether a Kubernetes pod with high CPU usage that triggers CPU throttling will be evicted.
First, I need to recall how Kubernetes handles resource constraints. CPU limits in K8s are enforced via Linux cgroups. When a pod exceeds its CPU limit, the kernel throttles the process, reducing its CPU time. This is different from memory limits, where exceeding can lead to OOMKill and pod termination.

Looking at the search results, multiple sources mention that CPU throttling doesn't directly cause eviction. For example, the article on K8s CPU限流原理 explains that throttling restricts CPU time but doesn't terminate the pod. Eviction typically happens due to memory pressure, disk pressure, or OOM situations, not CPU limits.

The eviction mechanisms discussed in other articles focus on node resource pressures like memory, disk space, or PID exhaustion. For instance, when node memory drops below 100Mi or disk space falls below certain thresholds, kubelet starts evicting pods. The QoS classes (BestEffort, Burstable, Guaranteed) determine the eviction order when resources are scarce, but this is tied to memory/disk pressure, not CPU usage.

So, the key distinction here is that CPU throttling is a runtime enforcement to prevent a pod from consuming excessive CPU, while eviction is triggered by resource shortages that affect node stability. Even if a pod is throttled, as long as it doesn't cause node-level resource pressure (like memory exhaustion), it won't be evicted. The pod might be throttled and perform poorly, but it won't be killed by kubelet for CPU limits alone.

Therefore, the answer should clarify that CPU throttling doesn't lead to eviction, and eviction is reserved for other resource pressures. The pod would only face termination if it causes node issues (like OOM) or if it exceeds its memory limits.

Based on the search results, a pod with high CPU usage triggering CPU throttling will NOT be directly evicted in Kubernetes. Here's the breakdown:

  1. CPU Throttling vs. Eviction <web_76210c59, web_1fce5e7f, 3, 4, 5, >:

    • CPU Throttling: When a pod exceeds its CPU limit, the Linux kernel (via cgroups) throttles its CPU usage. This restricts performance but does not terminate the pod.
    • Eviction: Occurs when a pod is terminated due to node-level resource pressures (e.g., insufficient memory, disk space, or PID exhaustion). Eviction is triggered by signals like memory.available < 100Mi or nodefs.available < 10%, not CPU limits.
  2. When Does Eviction Happen? <web_65dd18, web_1fce5e7f, 3, 4, 7>:

    • Memory Pressure: If a node runs out of memory, pods may be evicted based on QoS classes (BestEffort → Burstable → Guaranteed).
    • Disk Pressure: Eviction occurs if node storage (e.g., /var/lib/kubelet) or image filesystems drop below thresholds (e.g., nodefs.available < 10%).
    • PID Exhaustion: Linux nodes evict pods if available PIDs fall below a threshold.
    • Node Faults: Hardware failures or network issues can trigger eviction.
  3. Why CPU Throttling Doesn't Cause Eviction <web_76210c59, web_3f754bee>:

    • CPU limits are enforced via time-slicing (quota per period). Throttled pods remain scheduled but run slower.
    • Eviction is reserved for resource shortages that threaten node stability. A throttled pod only affects its own performance, not node-wide resources.

Conclusion: A pod hitting its CPU limit will experience throttling (reduced performance) but not eviction. Eviction is triggered exclusively by node-level resource exhaustion (memory, disk, PIDs) or node failures, not CPU constraints. To prevent throttling, adjust the pod's resources.limits.cpu or optimize its workload. For eviction prevention, focus on memory/disk requests, QoS classes, and node resource monitoring.