|
| 1 | +--- |
| 2 | +layout: blog |
| 3 | +title: "Kubernetes 1.33:动态配置节点的存储容量评分(Alpha 版)” |
| 4 | +date: 2025-04-23 |
| 5 | +draft: true |
| 6 | +slug: kubernetes-1-33-storage-capacity-scoring-feature |
| 7 | +author: > |
| 8 | + Yuma Ogami (Cybozu) |
| 9 | +translator: > |
| 10 | + [Xin Li](https://github.com/my-git9) (DaoCloud) |
| 11 | +--- |
| 12 | +<!-- |
| 13 | +layout: blog |
| 14 | +title: "Kubernetes 1.33: Storage Capacity Scoring of Nodes for Dynamic Provisioning (alpha)" |
| 15 | +date: 2025-04-23 |
| 16 | +draft: true |
| 17 | +slug: kubernetes-1-33-storage-capacity-scoring-feature |
| 18 | +author: > |
| 19 | + Yuma Ogami (Cybozu) |
| 20 | +--> |
| 21 | + |
| 22 | +<!-- |
| 23 | +Kubernetes v1.33 introduces a new alpha feature called `StorageCapacityScoring`. This feature adds a scoring method for pod scheduling |
| 24 | +with [the topology-aware volume provisioning](/blog/2018/10/11/topology-aware-volume-provisioning-in-kubernetes/). |
| 25 | +This feature eases to schedule pods on nodes with either the most or least available storage capacity. |
| 26 | +--> |
| 27 | +Kubernetes v1.33 引入了一个名为 `StorageCapacityScoring` 的新 Alpha 级别**特性**。 |
| 28 | +此**特性**添加了一种为 Pod 调度评分的方法, |
| 29 | +并与[拓扑感知卷供应](/blog/2018/10/11/topology-aware-volume-provisioning-in-kubernetes/)相关。 |
| 30 | +此**特性**可以轻松地选择在具有最多或最少可用存储容量的节点上调度 Pod。 |
| 31 | + |
| 32 | +<!-- |
| 33 | +## About this feature |
| 34 | + |
| 35 | +This feature extends the kube-scheduler's VolumeBinding plugin to perform scoring using node storage capacity information |
| 36 | +obtained from [Storage Capacity](/docs/concepts/storage/storage-capacity/). Currently, you can only filter out nodes with insufficient storage capacity. |
| 37 | +So, you have to use a scheduler extender to achieve storage-capacity-based pod scheduling. |
| 38 | +--> |
| 39 | +## 关于此特性 |
| 40 | + |
| 41 | +此特性扩展了 kube-scheduler 的 VolumeBinding 插件, |
| 42 | +以使用从[存储容量](/zh-cn/docs/concepts/storage/storage-capacity/)获得的节点存储容量信息进行评分。 |
| 43 | +目前,你只能过滤掉存储容量不足的节点。因此,你必须使用调度器扩展程序来实现基于存储容量的 Pod 调度。 |
| 44 | + |
| 45 | +<!-- |
| 46 | +This feature is useful for provisioning node-local PVs, which have size limits based on the node's storage capacity. By using this feature, |
| 47 | +you can assign the PVs to the nodes with the most available storage space so that you can expand the PVs later as much as possible. |
| 48 | + |
| 49 | +In another use case, you might want to reduce the number of nodes as much as possible for low operation costs in cloud environments by choosing |
| 50 | +the least storage capacity node. This feature helps maximize resource utilization by filling up nodes more sequentially, starting with the most |
| 51 | +utilized nodes first that still have enough storage capacity for the requested volume size. |
| 52 | +--> |
| 53 | +此特性对于配置节点本地的 PV 非常有用,这些 PV 的大小限制基于节点的存储容量。 |
| 54 | +通过使用此特性,你可以将 PV 分配给具有最多可用存储空间的节点, |
| 55 | +以便以后尽可能多地扩展 PV。 |
| 56 | + |
| 57 | +在另一个用例中,你可能希望通过选择存储容量最小的节点, |
| 58 | +在云环境中尽可能减少节点数量以降低操作成本。 |
| 59 | +此特性有助于通过从利用率最高的节点开始填充节点来最大化资源利用率, |
| 60 | +这些节点仍然有足够的存储容量满足请求的卷大小。 |
| 61 | + |
| 62 | +<!-- |
| 63 | +## How to use |
| 64 | + |
| 65 | +### Enabling the feature |
| 66 | + |
| 67 | +In the alpha phase, `StorageCapacityScoring` is disabled by default. To use this feature, add `StorageCapacityScoring=true` |
| 68 | +to the kube-scheduler command line option `--feature-gates`. |
| 69 | +--> |
| 70 | +## 如何使用 |
| 71 | + |
| 72 | +### 启用特性 |
| 73 | + |
| 74 | +在 Alpha 阶段,`StorageCapacityScoring` 默认是禁用的。要使用此特性,请将 |
| 75 | +`StorageCapacityScoring=true` 添加到 kube-scheduler 命令行选项 |
| 76 | +`--feature-gates` 中。 |
| 77 | + |
| 78 | +<!-- |
| 79 | +### Configuration changes |
| 80 | + |
| 81 | +You can configure node priorities based on storage utilization using the `shape` parameter in the VolumeBinding plugin configuration. |
| 82 | +This allows you to prioritize nodes with higher available storage capacity (default) or, conversely, nodes with lower available storage capacity. |
| 83 | +For example, to prioritize lower available storage capacity, configure `KubeSchedulerConfiguration` as follows: |
| 84 | +--> |
| 85 | +### 配置更改 |
| 86 | + |
| 87 | +你可以使用 VolumeBinding 插件配置中的 `shape` 参数,根据存储利用率来配置节点优先级。 |
| 88 | +这允许你优先考虑具有更高可用存储容量(默认)的节点,或者相反,优先考虑具有更低可用存储容量的节点。 |
| 89 | +例如,要优先考虑更低的可用存储容量,请按如下方式配置 `KubeSchedulerConfiguration`: |
| 90 | + |
| 91 | +```yaml |
| 92 | +apiVersion: kubescheduler.config.k8s.io/v1 |
| 93 | +kind: KubeSchedulerConfiguration |
| 94 | +profiles: |
| 95 | + ... |
| 96 | + pluginConfig: |
| 97 | + - name: VolumeBinding |
| 98 | + args: |
| 99 | + ... |
| 100 | + shape: |
| 101 | + - utilization: 0 |
| 102 | + score: 0 |
| 103 | + - utilization: 100 |
| 104 | + score: 10 |
| 105 | +``` |
| 106 | + |
| 107 | +<!-- |
| 108 | +For more details, please refer to the [documentation](/docs/reference/config-api/kube-scheduler-config.v1/#kubescheduler-config-k8s-io-v1-VolumeBindingArgs). |
| 109 | +--> |
| 110 | +详情请参阅[文档](/zh-cn/docs/reference/config-api/kube-scheduler-config.v1/#kubescheduler-config-k8s-io-v1-VolumeBindingArgs)。 |
| 111 | + |
| 112 | +<!-- |
| 113 | +## Further reading |
| 114 | +--> |
| 115 | +## 进一步阅读 |
| 116 | + |
| 117 | +- [KEP-4049: Storage Capacity Scoring of Nodes for Dynamic Provisioning](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/4049-storage-capacity-scoring-of-nodes-for-dynamic-provisioning/README.md) |
| 118 | + |
| 119 | +<!-- |
| 120 | +## Additional note: Relationship with VolumeCapacityPriority |
| 121 | + |
| 122 | +The alpha feature gate `VolumeCapacityPriority`, which performs node scoring based on available storage capacity during static provisioning, |
| 123 | +will be deprecated and replaced by `StorageCapacityScoring`. |
| 124 | +--> |
| 125 | +## 附加说明:与 VolumeCapacityPriority 的关系 |
| 126 | + |
| 127 | +基于静态配置期间的可用存储容量进行节点评分的 Alpha **特性门控** |
| 128 | +`VolumeCapacityPriority`,将被弃用,并由 `StorageCapacityScoring` 替代。 |
| 129 | + |
| 130 | +<!-- |
| 131 | +Please note that while `VolumeCapacityPriority` prioritizes nodes with lower available storage capacity by default, |
| 132 | +`StorageCapacityScoring` prioritizes nodes with higher available storage capacity by default. |
| 133 | +--> |
| 134 | +请注意,虽然 `VolumeCapacityPriority` 默认优先考虑可用存储容量较低的节点, |
| 135 | +但 `StorageCapacityScoring` 默认优先考虑可用存储容量较高的节点。 |
0 commit comments