Skip to content

Commit 0a589ab

Browse files
authored
Merge pull request #33590 from mengjiao-liu/sync-1.24-concepts-2
[zh] Sync concepts-2: storage-capacity.md and volume-snapshots.md
2 parents f4abcab + 6ed70a8 commit 0a589ab

File tree

2 files changed

+94
-40
lines changed

2 files changed

+94
-40
lines changed

content/zh/docs/concepts/storage/storage-capacity.md

Lines changed: 25 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,58 +10,66 @@ Storage capacity is limited and may vary depending on the node on
1010
which a pod runs: network-attached storage might not be accessible by
1111
all nodes, or storage is local to a node to begin with.
1212
13-
{{< feature-state for_k8s_version="v1.21" state="beta" >}}
13+
{{< feature-state for_k8s_version="v1.24" state="stable" >}}
1414
1515
This page describes how Kubernetes keeps track of storage capacity and
16-
how the scheduler uses that information to schedule Pods onto nodes
16+
how the scheduler uses that information to [schedule Pods](/docs/concepts/scheduling-eviction/) onto nodes
1717
that have access to enough storage capacity for the remaining missing
1818
volumes. Without storage capacity tracking, the scheduler may choose a
1919
node that doesn't have enough capacity to provision a volume and
2020
multiple scheduling retries will be needed.
21-
22-
Tracking storage capacity is supported for {{< glossary_tooltip
23-
text="Container Storage Interface" term_id="csi" >}} (CSI) drivers and
24-
[needs to be enabled](#enabling-storage-capacity-tracking) when installing a CSI driver.
2521
-->
2622
存储容量是有限的,并且会因为运行 Pod 的节点不同而变化:
2723
网络存储可能并非所有节点都能够访问,或者对于某个节点存储是本地的。
2824

29-
{{< feature-state for_k8s_version="v1.21" state="beta" >}}
25+
{{< feature-state for_k8s_version="v1.24" state="stable" >}}
3026

3127
本页面描述了 Kubernetes 如何跟踪存储容量以及调度程序如何为了余下的尚未挂载的卷使用该信息将
32-
Pod 调度到能够访问到足够存储容量的节点上
28+
[Pod 调度](/zh/docs/concepts/scheduling-eviction/)到能够访问到足够存储容量的节点上
3329
如果没有跟踪存储容量,调度程序可能会选择一个没有足够容量来提供卷的节点,并且需要多次调度重试。
3430

35-
{{< glossary_tooltip text="容器存储接口" term_id="csi" >}}(CSI)驱动程序支持跟踪存储容量,
36-
并且在安装 CSI 驱动程序时[需要启用](#enabling-storage-capacity-tracking)该功能。
31+
## {{% heading "prerequisites" %}}
32+
33+
<!--
34+
Kubernetes v{{< skew currentVersion >}} includes cluster-level API support for
35+
storage capacity tracking. To use this you must also be using a CSI driver that
36+
supports capacity tracking. Consult the documentation for the CSI drivers that
37+
you use to find out whether this support is available and, if so, how to use
38+
it. If you are not running Kubernetes v{{< skew currentVersion >}}, check the
39+
documentation for that version of Kubernetes.
40+
-->
41+
Kubernetes v{{< skew currentVersion >}} 包含了对存储容量跟踪的集群级 API 支持。
42+
要使用它,你还必须使用支持容量跟踪的 CSI 驱动程序。请查阅你使用的 CSI 驱动程序的文档,
43+
以了解此支持是否可用,如果可用,该如何使用它。如果你运行的不是
44+
Kubernetes v{{< skew currentVersion >}},请查看对应版本的 Kubernetes 文档。
3745

3846
<!-- body -->
3947
<!--
4048
## API
4149
4250
There are two API extensions for this feature:
43-
- CSIStorageCapacity objects:
51+
- [CSIStorageCapacity](/docs/reference/kubernetes-api/config-and-storage-resources/csi-storage-capacity-v1/) objects:
4452
these get produced by a CSI driver in the namespace
4553
where the driver is installed. Each object contains capacity
4654
information for one storage class and defines which nodes have
4755
access to that storage.
48-
- [The `CSIDriverSpec.StorageCapacity` field](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#csidriverspec-v1-storage-k8s-io):
56+
- [The `CSIDriverSpec.StorageCapacity` field](/docs/reference/kubernetes-api/config-and-storage-resources/csi-driver-v1/#CSIDriverSpec):
4957
when set to `true`, the Kubernetes scheduler will consider storage
5058
capacity for volumes that use the CSI driver.
5159
-->
5260
## API
5361

5462
这个特性有两个 API 扩展接口:
55-
- CSIStorageCapacity 对象:这些对象由 CSI 驱动程序在安装驱动程序的命名空间中产生。
63+
- [CSIStorageCapacity](/docs/reference/kubernetes-api/config-and-storage-resources/csi-storage-capacity-v1/) 对象:这些对象由
64+
CSI 驱动程序在安装驱动程序的命名空间中产生。
5665
每个对象都包含一个存储类的容量信息,并定义哪些节点可以访问该存储。
57-
- [`CSIDriverSpec.StorageCapacity` 字段](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#csidriverspec-v1-storage-k8s-io):
66+
- [`CSIDriverSpec.StorageCapacity` 字段](/docs/reference/kubernetes-api/config-and-storage-resources/csi-driver-v1/#CSIDriverSpec)
5867
设置为 true 时,Kubernetes 调度程序将考虑使用 CSI 驱动程序的卷的存储容量。
5968

6069
<!--
6170
## Scheduling
6271
6372
Storage capacity information is used by the Kubernetes scheduler if:
64-
- the `CSIStorageCapacity` feature gate is true,
6573
- a Pod uses a volume that has not been created yet,
6674
- that volume uses a {{< glossary_tooltip text="StorageClass" term_id="storage-class" >}} which references a CSI driver and
6775
uses `WaitForFirstConsumer` [volume binding
@@ -90,7 +98,6 @@ significant resources there.
9098
## 调度
9199

92100
如果有以下情况,存储容量信息将会被 Kubernetes 调度程序使用:
93-
- `CSIStorageCapacity` 特性门控被设置为 true,
94101
- Pod 使用的卷还没有被创建,
95102
- 卷使用引用了 CSI 驱动的 {{< glossary_tooltip text="StorageClass" term_id="storage-class" >}},
96103
并且使用了 `WaitForFirstConsumer` [卷绑定模式](/zh/docs/concepts/storage/storage-classes/#volume-binding-mode)
@@ -140,9 +147,7 @@ multiple volumes: one volume might have been created already in a
140147
topology segment which then does not have enough capacity left for
141148
another volume. Manual intervention is necessary to recover from this,
142149
for example by increasing capacity or deleting the volume that was
143-
already created. [Further
144-
work](https://github.com/kubernetes/enhancements/pull/1703) is needed
145-
to handle this automatically.
150+
already created.
146151
-->
147152
## 限制
148153

@@ -151,32 +156,12 @@ to handle this automatically.
151156

152157
当 Pod 使用多个卷时,调度可能会永久失败:一个卷可能已经在拓扑段中创建,而该卷又没有足够的容量来创建另一个卷,
153158
要想从中恢复,必须要进行手动干预,比如通过增加存储容量或者删除已经创建的卷。
154-
需要[进一步工作](https://github.com/kubernetes/enhancements/pull/1703)来自动处理此问题。
155-
156-
<!--
157-
## Enabling storage capacity tracking
158-
159-
Storage capacity tracking is a beta feature and enabled by default in
160-
a Kubernetes cluster since Kubernetes 1.21. In addition to having the
161-
feature enabled in the cluster, a CSI driver also has to support
162-
it. Please refer to the driver's documentation for details.
163-
-->
164-
## 开启存储容量跟踪
165-
166-
存储容量跟踪是一个 Beta 特性,从 Kubernetes 1.21 版本起在 Kubernetes 集群
167-
中默认被启用。除了在集群中启用此功能特性之外,还要求 CSI 驱动支持此特性。
168-
请参阅驱动的文档了解详细信息。
169159

170160
## {{% heading "whatsnext" %}}
171161

172162
<!--
173-
- For more information on the design, see the
163+
- For more information on the design, see the
174164
[Storage Capacity Constraints for Pod Scheduling KEP](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/1472-storage-capacity-tracking/README.md).
175-
- For more information on further development of this feature, see the [enhancement tracking issue #1472](https://github.com/kubernetes/enhancements/issues/1472).
176-
- Learn about [Kubernetes Scheduler](/docs/concepts/scheduling-eviction/kube-scheduler/)
177165
-->
178166
- 想要获得更多该设计的信息,查看
179167
[Storage Capacity Constraints for Pod Scheduling KEP](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/1472-storage-capacity-tracking/README.md)
180-
- 有关此功能的下一步开发信息,查看
181-
[enhancement tracking issue #1472](https://github.com/kubernetes/enhancements/issues/1472)
182-
- 学习 [Kubernetes 调度器](/zh/docs/concepts/scheduling-eviction/kube-scheduler/)

content/zh/docs/concepts/storage/volume-snapshots.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ spec:
233233
driver: hostpath.csi.k8s.io
234234
source:
235235
volumeHandle: ee0cfb94-f8d4-11e9-b2d8-0242ac110002
236+
sourceVolumeMode: Filesystem
236237
volumeSnapshotClassName: csi-hostpath-snapclass
237238
volumeSnapshotRef:
238239
name: new-snapshot-test
@@ -259,6 +260,7 @@ spec:
259260
driver: hostpath.csi.k8s.io
260261
source:
261262
snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002
263+
sourceVolumeMode: Filesystem
262264
volumeSnapshotRef:
263265
name: new-snapshot-test
264266
namespace: default
@@ -268,6 +270,73 @@ spec:
268270
-->
269271
`snapshotHandle` 是存储后端创建卷的唯一标识符。对于预设置快照,这个字段是必须的。它指定此 `VolumeSnapshotContent` 表示的存储系统上的 CSI 快照 id。
270272

273+
<!--
274+
`sourceVolumeMode` is the mode of the volume whose snapshot is taken. The value
275+
of the `sourceVolumeMode` field can be either `Filesystem` or `Block`. If the
276+
source volume mode is not specified, Kubernetes treats the snapshot as if the
277+
source volume's mode is unknown.
278+
-->
279+
`sourceVolumeMode` 是创建快照的卷的模式。`sourceVolumeMode` 字段的值可以是
280+
`Filesystem` 或 `Block`。如果没有指定源卷模式,Kubernetes 会将快照视为未知的源卷模式。
281+
282+
<!--
283+
## Converting the volume mode of a Snapshot {#convert-volume-mode}
284+
285+
If the `VolumeSnapshots` API installed on your cluster supports the `sourceVolumeMode`
286+
field, then the API has the capability to prevent unauthorized users from converting
287+
the mode of a volume.
288+
289+
To check if your cluster has capability for this feature, run the following command:
290+
-->
291+
## 转换快照的卷模式 {#convert-volume-mode}
292+
293+
如果在你的集群上安装的 `VolumeSnapshots` API 支持 `sourceVolumeMode`
294+
字段,则该 API 可以防止未经授权的用户转换卷的模式。
295+
296+
要检查你的集群是否具有此特性的能力,可以运行如下命令:
297+
298+
```yaml
299+
$ kubectl get crd volumesnapshotcontent -o yaml
300+
```
301+
302+
<!--
303+
If you want to allow users to create a `PersistentVolumeClaim` from an existing
304+
`VolumeSnapshot`, but with a different volume mode than the source, the annotation
305+
`snapshot.storage.kubernetes.io/allowVolumeModeChange: "true"`needs to be added to
306+
the `VolumeSnapshotContent` that corresponds to the `VolumeSnapshot`.
307+
-->
308+
如果你希望允许用户从现有的 `VolumeSnapshot` 创建 `PersistentVolumeClaim`,
309+
但是使用与源卷不同的卷模式,则需要添加注解
310+
`snapshot.storage.kubernetes.io/allowVolumeModeChange: "true"`
311+
到对应 `VolumeSnapshot` 的 `VolumeSnapshotContent` 中。
312+
<!--
313+
For pre-provisioned snapshots, `Spec.SourceVolumeMode` needs to be populated
314+
by the cluster administrator.
315+
316+
An example `VolumeSnapshotContent` resource with this feature enabled would look like:
317+
-->
318+
对于预配置的快照,`Spec.SourceVolumeMode` 需要由集群管理员填充。
319+
320+
启用此特性的 `VolumeSnapshotContent` 资源示例如下所示:
321+
322+
```yaml
323+
apiVersion: snapshot.storage.k8s.io/v1
324+
kind: VolumeSnapshotContent
325+
metadata:
326+
name: new-snapshot-content-test
327+
annotations:
328+
- snapshot.storage.kubernetes.io/allowVolumeModeChange: "true"
329+
spec:
330+
deletionPolicy: Delete
331+
driver: hostpath.csi.k8s.io
332+
source:
333+
snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002
334+
sourceVolumeMode: Filesystem
335+
volumeSnapshotRef:
336+
name: new-snapshot-test
337+
namespace: default
338+
```
339+
271340
<!--
272341
## Provisioning Volumes from Snapshots
273342
-->

0 commit comments

Comments
 (0)