|
| 1 | +--- |
| 2 | +layout: blog |
| 3 | +title: "Kubernetes 1.29: 解耦污点管理器与节点生命周期控制器" |
| 4 | +date: 2023-12-19 |
| 5 | +slug: kubernetes-1-29-taint-eviction-controller |
| 6 | +--- |
| 7 | +<!-- |
| 8 | +layout: blog |
| 9 | +title: "Kubernetes 1.29: Decoupling taint-manager from node-lifecycle-controller" |
| 10 | +date: 2023-12-19 |
| 11 | +slug: kubernetes-1-29-taint-eviction-controller |
| 12 | +--> |
| 13 | + |
| 14 | +<!-- |
| 15 | +**Authors:** Yuan Chen (Apple), Andrea Tosatto (Apple) |
| 16 | +--> |
| 17 | +**作者:** Yuan Chen (Apple), Andrea Tosatto (Apple) |
| 18 | + |
| 19 | +**译者:** Allen Zhang |
| 20 | + |
| 21 | +<!-- |
| 22 | +This blog discusses a new feature in Kubernetes 1.29 to improve the handling of taint-based pod eviction. |
| 23 | +--> |
| 24 | +这篇博客讨论在 Kubernetes 1.29 中基于污点的 Pod 驱逐处理的新特性。 |
| 25 | + |
| 26 | +<!-- |
| 27 | +## Background |
| 28 | +--> |
| 29 | +## 背景 |
| 30 | + |
| 31 | +<!-- |
| 32 | +In Kubernetes 1.29, an improvement has been introduced to enhance the taint-based pod eviction handling on nodes. |
| 33 | +This blog discusses the changes made to node-lifecycle-controller |
| 34 | +to separate its responsibilities and improve overall code maintainability. |
| 35 | +--> |
| 36 | +在 Kubernetes 1.29 中引入了一项改进,以加强节点上基于污点的 Pod 驱逐处理。 |
| 37 | +本文将讨论对节点生命周期控制器(node-lifecycle-controller)所做的更改,以分离职责并提高代码的整体可维护性。 |
| 38 | + |
| 39 | +<!-- |
| 40 | +## Summary of changes |
| 41 | +--> |
| 42 | +## 变动摘要 |
| 43 | + |
| 44 | +<!-- |
| 45 | +node-lifecycle-controller previously combined two independent functions: |
| 46 | +--> |
| 47 | +节点生命周期控制器之前组合了两个独立的功能: |
| 48 | + |
| 49 | +<!-- |
| 50 | +- Adding a pre-defined set of `NoExecute` taints to Node based on Node's condition. |
| 51 | +- Performing pod eviction on `NoExecute` taint. |
| 52 | +--> |
| 53 | +- 基于节点的条件为节点新增了一组预定义的污点 `NoExecute`。 |
| 54 | +- 对有 `NoExecute` 污点的 Pod 执行驱逐操作。 |
| 55 | + |
| 56 | +<!-- |
| 57 | +With the Kubernetes 1.29 release, the taint-based eviction implementation has been |
| 58 | +moved out of node-lifecycle-controller into a separate and independent component called taint-eviction-controller. |
| 59 | +This separation aims to disentangle code, enhance code maintainability, |
| 60 | +and facilitate future extensions to either component. |
| 61 | +--> |
| 62 | +在 Kubernetes 1.29 版本中,基于污点的驱逐实现已经从节点生命周期控制器中移出, |
| 63 | +成为一个名为污点驱逐控制器(taint-eviction-controller)的独立组件。 |
| 64 | +旨在拆分代码,提高代码的可维护性,并方便未来对这两个组件进行扩展。 |
| 65 | + |
| 66 | +<!-- |
| 67 | +As part of the change, additional metrics were introduced to help you monitor taint-based pod evictions: |
| 68 | +--> |
| 69 | +以下新指标可以帮助你监控基于污点的 Pod 驱逐: |
| 70 | + |
| 71 | +<!-- |
| 72 | +- `pod_deletion_duration_seconds` measures the latency between the time when a taint effect |
| 73 | +has been activated for the Pod and its deletion via taint-eviction-controller. |
| 74 | +- `pod_deletions_total` reports the total number of Pods deleted by taint-eviction-controller since its start. |
| 75 | +--> |
| 76 | +- `pod_deletion_duration_seconds` 表示当 Pod 的污点被激活直到这个 Pod 被污点驱逐控制器删除的延迟时间。 |
| 77 | +- `pod_deletions_total` 表示自从污点驱逐控制器启动以来驱逐的 Pod 总数。 |
| 78 | + |
| 79 | +<!-- |
| 80 | +## How to use the new feature? |
| 81 | +--> |
| 82 | +## 如何使用这个新特性? |
| 83 | + |
| 84 | +<!-- |
| 85 | +A new feature gate, `SeparateTaintEvictionController`, has been added. The feature is enabled by default as Beta in Kubernetes 1.29. |
| 86 | +Please refer to the [feature gate document](/docs/reference/command-line-tools-reference/feature-gates/). |
| 87 | +--> |
| 88 | +名为 `SeparateTaintEvictionController` 的特性门控已被添加。该特性在 Kubernetes 1.29 Beta 版本中默认开启。 |
| 89 | +详情请参阅[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)。 |
| 90 | + |
| 91 | + |
| 92 | +<!-- |
| 93 | +When this feature is enabled, users can optionally disable taint-based eviction by setting `--controllers=-taint-eviction-controller` |
| 94 | +in kube-controller-manager. |
| 95 | +--> |
| 96 | +当这项特性启用时,用户可以通过在 `kube-controller-manager` 通过手动设置 |
| 97 | +`--controllers=-taint-eviction-controller` 的方式来禁用基于污点的驱逐功能。 |
| 98 | + |
| 99 | +<!-- |
| 100 | +To disable the new feature and use the old taint-manager within node-lifecylecycle-controller , users can set the feature gate `SeparateTaintEvictionController=false`. |
| 101 | +--> |
| 102 | +如果想禁用该特性并在节点生命周期中使用旧版本污点管理器,用户可以通过设置 `SeparateTaintEvictionController=false` 来禁用。 |
| 103 | + |
| 104 | +<!-- |
| 105 | +## Use cases |
| 106 | +--> |
| 107 | +## 使用案例 |
| 108 | + |
| 109 | +<!-- |
| 110 | +This new feature will allow cluster administrators to extend and enhance the default |
| 111 | +taint-eviction-controller and even replace the default taint-eviction-controller with a |
| 112 | +custom implementation to meet different needs. An example is to better support |
| 113 | +stateful workloads that use PersistentVolume on local disks. |
| 114 | +--> |
| 115 | +该特性将允许集群管理员扩展、增强默认的污点驱逐控制器,并且可以使用自定义的实现方式替换默认的污点驱逐控制器以满足不同的需要。 |
| 116 | +例如:更好地支持在本地磁盘的持久卷中的有状态工作负载。 |
| 117 | + |
| 118 | +<!-- |
| 119 | +## FAQ |
| 120 | +--> |
| 121 | +## FAQ |
| 122 | + |
| 123 | +<!-- |
| 124 | +**Does this feature change the existing behavior of taint-based pod evictions?** |
| 125 | +--> |
| 126 | +**该特性是否会改变现有的基于污点的 Pod 驱逐行为?** |
| 127 | + |
| 128 | +<!-- |
| 129 | +No, the taint-based pod eviction behavior remains unchanged. If the feature gate |
| 130 | +`SeparateTaintEvictionController` is turned off, the legacy node-lifecycle-controller with taint-manager will continue to be used. |
| 131 | +--> |
| 132 | +不会,基于污点的 Pod 驱逐行为保持不变。如果特性门控 `SeparateTaintEvictionController` 被关闭, |
| 133 | +将继续使用之前的节点生命周期管理器中的污点管理器。 |
| 134 | + |
| 135 | +<!-- |
| 136 | +**Will enabling/using this feature result in an increase in the time taken by any operations covered by existing SLIs/SLOs?** |
| 137 | +--> |
| 138 | +**启用/使用此特性是否会导致现有 SLI/SLO 中任何操作的用时增加?** |
| 139 | + |
| 140 | +<!-- |
| 141 | +No. |
| 142 | +--> |
| 143 | +不会。 |
| 144 | + |
| 145 | +<!-- |
| 146 | +**Will enabling/using this feature result in an increase in resource usage (CPU, RAM, disk, IO, ...)?** |
| 147 | +--> |
| 148 | +**启用/使用此特性是否会导致资源利用量(如 CPU、内存、磁盘、IO 等)的增加?** |
| 149 | + |
| 150 | +<!-- |
| 151 | +The increase in resource usage by running a separate `taint-eviction-controller` will be negligible. |
| 152 | +--> |
| 153 | +运行单独的 `taint-eviction-controller` 所增加的资源利用量可以忽略不计。 |
| 154 | + |
| 155 | +<!-- |
| 156 | +## Learn more |
| 157 | +--> |
| 158 | +## 了解更多 |
| 159 | + |
| 160 | +<!-- |
| 161 | +For more details, refer to the [KEP](http://kep.k8s.io/3902). |
| 162 | +--> |
| 163 | +更多细节请参考 [KEP](http://kep.k8s.io/3902)。 |
| 164 | + |
| 165 | +<!-- |
| 166 | +## Acknowledgments |
| 167 | +--> |
| 168 | +## 特别鸣谢 |
| 169 | + |
| 170 | +<!-- |
| 171 | +As with any Kubernetes feature, multiple community members have contributed, from |
| 172 | +writing the KEP to implementing the new controller and reviewing the KEP and code. Special thanks to: |
| 173 | +--> |
| 174 | +与任何 Kubernetes 特性一样,从撰写 KEP 到实现新控制器再到审核 KEP 和代码,多名社区成员都做出了贡献,特别感谢: |
| 175 | + |
| 176 | +- Aldo Culquicondor (@alculquicondor) |
| 177 | +- Maciej Szulik (@soltysh) |
| 178 | +- Filip Křepinský (@atiratree) |
| 179 | +- Han Kang (@logicalhan) |
| 180 | +- Wei Huang (@Huang-Wei) |
| 181 | +- Sergey Kanzhelevi (@SergeyKanzhelev) |
| 182 | +- Ravi Gudimetla (@ravisantoshgudimetla) |
| 183 | +- Deep Debroy (@ddebroy) |
0 commit comments