|
| 1 | +--- |
| 2 | +layout: blog |
| 3 | +title: "Kubernetes 1.31: 节点 Cgroup 驱动程序的自动配置 (beta)" |
| 4 | +date: 2024-08-21 |
| 5 | +slug: cri-cgroup-driver-lookup-now-beta |
| 6 | +author: > |
| 7 | + Peter Hunt (Red Hat) |
| 8 | +translator: > |
| 9 | + XiaoYang Zhang (Huawei) |
| 10 | +--- |
| 11 | +<!-- |
| 12 | +layout: blog |
| 13 | +title: "Kubernetes 1.31: Autoconfiguration For Node Cgroup Driver (beta)" |
| 14 | +date: 2024-08-21 |
| 15 | +slug: cri-cgroup-driver-lookup-now-beta |
| 16 | +author: > |
| 17 | +Peter Hunt (Red Hat) |
| 18 | +--> |
| 19 | + |
| 20 | +<!-- |
| 21 | +Historically, configuring the correct cgroup driver has been a pain point for users running new |
| 22 | +Kubernetes clusters. On Linux systems, there are two different cgroup drivers: |
| 23 | +`cgroupfs` and `systemd`. In the past, both the [kubelet](/docs/reference/command-line-tools-reference/kubelet/) |
| 24 | +and CRI implementation (like CRI-O or containerd) needed to be configured to use |
| 25 | +the same cgroup driver, or else the kubelet would exit with an error. This was a |
| 26 | +source of headaches for many cluster admins. However, there is light at the end of the tunnel! |
| 27 | +--> |
| 28 | +一直以来,为新运行的 Kubernetes 集群配置正确的 cgroup 驱动程序是用户的一个痛点。 |
| 29 | +在 Linux 系统中,存在两种不同的 cgroup 驱动程序:`cgroupfs` 和 `systemd`。 |
| 30 | +过去,[kubelet](/zh-cn/docs/reference/command-line-tools-reference/kubelet/) 和 CRI |
| 31 | +实现(如 CRI-O 或 containerd)需要配置为使用相同的 cgroup 驱动程序, 否则 kubelet 会报错并退出。 |
| 32 | +这让许多集群管理员头疼不已。不过,现在曙光乍现! |
| 33 | + |
| 34 | +<!-- |
| 35 | +## Automated cgroup driver detection |
| 36 | +
|
| 37 | +In v1.28.0, the SIG Node community introduced the feature gate |
| 38 | +`KubeletCgroupDriverFromCRI`, which instructs the kubelet to ask the CRI |
| 39 | +implementation which cgroup driver to use. A few minor releases of Kubernetes |
| 40 | +happened whilst we waited for support to land in the major two CRI implementations |
| 41 | +(containerd and CRI-O), but as of v1.31.0, this feature is now beta! |
| 42 | +--> |
| 43 | +## 自动检测 cgroup 驱动程序 |
| 44 | + |
| 45 | +在 v1.28.0 版本中,SIG Node 社区引入了 `KubeletCgroupDriverFromCRI` 特性门控, |
| 46 | +它指示 kubelet 向 CRI 实现询问使用哪个 cgroup 驱动程序。在两个主要的 CRI 实现(containerd |
| 47 | +和 CRI-O)增加对该功能的支持这段期间,Kubernetes 经历了几次小版本发布,但从 v1.31.0 版本开始,此功能现已进入 beta 阶段! |
| 48 | + |
| 49 | +<!-- |
| 50 | +In addition to setting the feature gate, a cluster admin needs to ensure their |
| 51 | +CRI implementation is new enough: |
| 52 | +
|
| 53 | +- containerd: Support was added in v2.0.0 |
| 54 | +- CRI-O: Support was added in v1.28.0 |
| 55 | +--> |
| 56 | +除了设置特性门控之外,集群管理员还需要确保 CRI 实现版本足够新: |
| 57 | + |
| 58 | +- containerd:v2.0.0 版本开始支持 |
| 59 | +- CRI-O:v1.28.0 版本开始支持 |
| 60 | + |
| 61 | +<!-- |
| 62 | +Then, they should ensure their CRI implementation is configured to the |
| 63 | +cgroup_driver they would like to use. |
| 64 | +--> |
| 65 | +然后,他们应该确保配置其 CRI 实现使用他们想要的 cgroup 驱动程序。 |
| 66 | + |
| 67 | +<!-- |
| 68 | +## Future work |
| 69 | +
|
| 70 | +Eventually, support for the kubelet's `cgroupDriver` configuration field will be |
| 71 | +dropped, and the kubelet will fail to start if the CRI implementation isn't new |
| 72 | +enough to have support for this feature. |
| 73 | +--> |
| 74 | +## 未来工作 |
| 75 | + |
| 76 | +最终,kubelet 对 `cgroupDriver` 配置字段的支持将会被移除,如果 CRI 实现的版本不够新,无法支持此功能,kubelet 将无法启动。 |
0 commit comments