diff --git a/content/zh-cn/docs/concepts/scheduling-eviction/node-pressure-eviction.md b/content/zh-cn/docs/concepts/scheduling-eviction/node-pressure-eviction.md index 1ff97d3b0a..401ca43d54 100644 --- a/content/zh-cn/docs/concepts/scheduling-eviction/node-pressure-eviction.md +++ b/content/zh-cn/docs/concepts/scheduling-eviction/node-pressure-eviction.md @@ -11,17 +11,17 @@ weight: 100 {{}}
- {{}} @@ -33,7 +33,7 @@ kubelet 可以主动地使节点上一个或者多个 Pod 失效,以回收资 节点压力驱逐不同于 [API 发起的驱逐](/zh-cn/docs/concepts/scheduling-eviction/api-eviction/)。 - kubelet 并不理会你配置的 `PodDisruptionBudget` 或者是 Pod 的 `terminationGracePeriodSeconds`。 @@ -65,26 +65,26 @@ kubelet 在终止最终用户 Pod 之前会尝试[回收节点级资源](#reclai 例如,它会在磁盘资源不足时删除未使用的容器镜像。 {{}} - kubelet 使用各种参数来做出驱逐决定,如下所示: - * 驱逐信号 - * 驱逐条件 - * 监控间隔 +- 驱逐信号 +- 驱逐条件 +- 监控间隔 - @@ -105,11 +105,11 @@ kubelet 使用以下驱逐信号: | `imagefs.inodesFree` | `imagefs.inodesFree` := `node.stats.runtime.imagefs.inodesFree` | | `pid.available` | `pid.available` := `node.stats.rlimit.maxpid` - `node.stats.rlimit.curproc` | - 在上表中,`描述`列显示了 kubelet 如何获取信号的值。每个信号支持百分比值或者是字面值。 kubelet 计算相对于与信号有关的总量的百分比值。 @@ -117,14 +117,14 @@ kubelet 计算相对于与信号有关的总量的百分比值。 `memory.available` 的值来自 cgroupfs,而不是像 `free -m` 这样的工具。 这很重要,因为 `free -m` 在容器中不起作用,如果用户使用 @@ -139,12 +139,12 @@ kubelet 在其计算中排除了 inactive_file(即非活动 LRU 列表上基 The kubelet supports the following filesystem partitions: 1. `nodefs`: The node's main filesystem, used for local disk volumes, emptyDir, - log storage, and more. For example, `nodefs` contains `/var/lib/kubelet/`. + log storage, and more. For example, `nodefs` contains `/var/lib/kubelet/`. 1. `imagefs`: An optional filesystem that container runtimes use to store container images and container writable layers. Kubelet auto-discovers these filesystems and ignores other filesystems. Kubelet -does not support other configurations. +does not support other configurations. --> kubelet 支持以下文件系统分区: @@ -175,7 +175,7 @@ Some kubelet garbage collection features are deprecated in favor of eviction: | `--maximum-dead-containers-per-container` | - | 一旦旧的日志存储在容器的上下文之外就会被弃用 | | `--minimum-container-ttl-duration` | - | 一旦旧的日志存储在容器的上下文之外就会被弃用 | - @@ -208,7 +208,7 @@ For example, if a node has `10Gi` of total memory and you want trigger eviction the available memory falls below `1Gi`, you can define the eviction threshold as either `memory.available<10%` or `memory.available<1Gi`. You cannot use both. -You can configure soft and hard eviction thresholds. +You can configure soft and hard eviction thresholds. --> 例如,如果一个节点的总内存为 10Gi 并且你希望在可用内存低于 1Gi 时触发驱逐, 则可以将驱逐条件定义为 `memory.available<10%` 或 `memory.available< 1G`。 @@ -216,13 +216,13 @@ You can configure soft and hard eviction thresholds. 你可以配置软和硬驱逐条件。 - #### 软驱逐条件 {#soft-eviction-thresholds} @@ -230,10 +230,10 @@ specified grace period. 在超过宽限期之前,kubelet 不会驱逐 Pod。 如果没有指定的宽限期,kubelet 会在启动时返回错误。 - 你可以使用以下标志来配置软驱逐条件: @@ -260,15 +260,15 @@ You can use the following flags to configure soft eviction thresholds: 如 `memory.available=1m30s`,定义软驱逐条件在触发 Pod 驱逐之前必须保持多长时间。 * `eviction-max-pod-grace-period`:在满足软驱逐条件而终止 Pod 时使用的最大允许宽限期(以秒为单位)。 - #### 硬驱逐条件 {#hard-eviction-thresholds} @@ -278,13 +278,13 @@ kubelet 会立即杀死 pod,而不会正常终止以回收紧缺的资源。 你可以使用 `eviction-hard` 标志来配置一组硬驱逐条件, 例如 `memory.available<1Gi`。 - kubelet 具有以下默认硬驱逐条件: @@ -294,17 +294,17 @@ kubelet 具有以下默认硬驱逐条件: * `nodefs.inodesFree<5%`(Linux 节点) 只有在没有更改任何参数的情况下,硬驱逐阈值才会被设置成这些默认值。 如果你更改了任何参数的值,则其他参数的取值不会继承其默认值设置,而将被设置为零。 为了提供自定义值,你应该分别设置所有阈值。 - ### 节点条件 {#node-conditions} kubelet 报告节点状况以反映节点处于压力之下,因为满足硬或软驱逐条件,与配置的宽限期无关。 - kubelet 根据下表将驱逐信号映射为节点状况: @@ -347,7 +347,7 @@ kubelet 根据下表将驱逐信号映射为节点状况: kubelet 根据配置的 `--node-status-update-frequency` 更新节点条件,默认为 `10s`。 - ### 回收节点级资源 {#reclaim-node-resources} @@ -387,19 +387,19 @@ kubelet 在驱逐最终用户 Pod 之前会先尝试回收节点级资源。 If the node has a dedicated `imagefs` filesystem for container runtimes to use, the kubelet does the following: - * If the `nodefs` filesystem meets the eviction thresholds, the kubelet garbage collects - dead pods and containers. - * If the `imagefs` filesystem meets the eviction thresholds, the kubelet - deletes all unused images. +- If the `nodefs` filesystem meets the eviction thresholds, the kubelet garbage collects + dead pods and containers. +- If the `imagefs` filesystem meets the eviction thresholds, the kubelet + deletes all unused images. --> #### 有 `imagefs` 如果节点有一个专用的 `imagefs` 文件系统供容器运行时使用,kubelet 会执行以下操作: - * 如果 `nodefs` 文件系统满足驱逐条件,kubelet 垃圾收集死亡 Pod 和容器。 - * 如果 `imagefs` 文件系统满足驱逐条件,kubelet 将删除所有未使用的镜像。 +- 如果 `nodefs` 文件系统满足驱逐条件,kubelet 垃圾收集死亡 Pod 和容器。 +- 如果 `imagefs` 文件系统满足驱逐条件,kubelet 将删除所有未使用的镜像。 - @@ -467,11 +467,11 @@ QoS 不适用于临时存储(EphemeralStorage)请求, 因此如果节点在 `DiskPressure` 下,则上述场景将不适用。 {{}} - + #### 有 `imagefs` 如果 `nodefs` 触发驱逐, @@ -525,25 +526,26 @@ kubelet 会根据 `nodefs` 使用情况(`本地卷 + 所有容器的日志`) 如果 `nodefs` 触发驱逐, kubelet 会根据磁盘总用量(`本地卷 + 日志和所有容器的可写层`)对 Pod 进行排序。 - -### 最小驱逐回收 {#minimum-eviction-reclaim} + +### 最小驱逐回收 {#minimum-eviction-reclaim} 在某些情况下,驱逐 Pod 只会回收少量的紧俏资源。 这可能导致 kubelet 反复达到配置的驱逐条件并触发多次驱逐。 - 你可以使用 `--eviction-minimum-reclaim` 标志或 [kubelet 配置文件](/zh-cn/docs/tasks/administer-cluster/kubelet-config-file/) @@ -565,14 +567,14 @@ evictionMinimumReclaim: imagefs.available: "2Gi" ``` - @@ -584,7 +586,7 @@ kubelet 会回收资源,直到信号达到 `1Gi` 的条件, 对于所有资源,默认的 `eviction-minimum-reclaim` 为 `0`。 - 如果 kubelet 在节点遇到 OOM 之前无法回收内存, @@ -638,7 +640,7 @@ based on its `RestartPolicy`. 与 Pod 驱逐不同,如果容器被 OOM 杀死, `kubelet` 可以根据其 `RestartPolicy` 重新启动它。 - 考虑以下场景: @@ -672,7 +674,7 @@ Consider the following scenario: * 操作员希望为系统守护进程(内核、`kubelet` 等)保留 10% 的内存容量 * 操作员希望在节点内存利用率达到 95% 以上时驱逐 Pod,以减少系统 OOM 的概率。 - 为此,kubelet 启动设置如下: @@ -682,13 +684,13 @@ For this to work, the kubelet is launched as follows: --system-reserved=memory=1.5Gi ``` - 在此配置中,`--system-reserved` 标志为系统预留了 `1.5Gi` 的内存, 即 `总内存的 10% + 驱逐条件量`。 @@ -696,13 +698,13 @@ signal fall below `500Mi` and triggers the threshold. 如果 Pod 使用的内存超过其请求值或者系统使用的内存超过 `1Gi`, 则节点可以达到驱逐条件,这使得 `memory.available` 信号低于 `500Mi` 并触发条件。 - ### DaemonSet @@ -713,7 +715,7 @@ Pod 优先级是做出驱逐决定的主要因素。 你还可以使用优先级较低的 `priorityClass` 或默认配置, 仅在有足够资源时才运行 `DaemonSet` Pod。 - #### kubelet 可能不会立即观察到内存压力 @@ -736,14 +738,14 @@ will still be invoked. 如果该轮询时间窗口内内存使用量迅速增加,kubelet 可能无法足够快地观察到 `MemoryPressure`, 但是 `OOMKiller` 仍将被调用。 - 你可以使用 `--kernel-memcg-notification` 标志在 kubelet 上启用 `memcg` 通知 API,以便在超过条件时立即收到通知。 @@ -751,16 +753,16 @@ and `--system-reserved` flags to allocate memory for the system. 如果你不是追求极端利用率,而是要采取合理的过量使用措施, 则解决此问题的可行方法是使用 `--kube-reserved` 和 `--system-reserved` 标志为系统分配内存。 - #### active_file 内存未被视为可用内存 @@ -772,11 +774,11 @@ kubelet 将 `active_file` 内存区域视为不可回收。 如果这些内核块缓冲区中在活动 LRU 列表上有足够多, kubelet 很容易将其视为资源用量过量并为节点设置内存压力污点,从而触发 Pod 驱逐。 - 更多细节请参见 [https://github.com/kubernetes/kubernetes/issues/43916](https://github.com/kubernetes/kubernetes/issues/43916)。 @@ -786,12 +788,12 @@ to estimate or measure an optimal memory limit value for that container. ## {{% heading "whatsnext" %}} - * 了解 [API 发起的驱逐](/zh-cn/docs/concepts/scheduling-eviction/api-eviction/) * 了解 [Pod 优先级和抢占](/zh-cn/docs/concepts/scheduling-eviction/pod-priority-preemption/)