@@ -22,7 +22,7 @@ This document describes _ephemeral volumes_ in Kubernetes. Familiarity
22
22
with [volumes](/docs/concepts/storage/volumes/) is suggested, in
23
23
particular PersistentVolumeClaim and PersistentVolume.
24
24
-->
25
- 本文档描述 Kubernetes 中的 _ 临时卷 (Ephemeral Volume)_ 。
25
+ 本文档描述 Kubernetes 中的 ** 临时卷 (Ephemeral Volume)** 。
26
26
建议先了解[ 卷] ( /zh-cn/docs/concepts/storage/volumes/ ) ,特别是 PersistentVolumeClaim 和 PersistentVolume。
27
27
28
28
<!-- body -->
@@ -33,8 +33,8 @@ services are often limited by memory size and can move infrequently
33
33
used data into storage that is slower than memory with little impact
34
34
on overall performance.
35
35
-->
36
- 有些应用程序需要额外的存储,但并不关心数据在重启后仍然可用 。
37
- 例如,缓存服务经常受限于内存大小,将不常用的数据转移到比内存慢、但对总体性能的影响很小的存储中 。
36
+ 有些应用程序需要额外的存储,但并不关心数据在重启后是否仍然可用 。
37
+ 例如,缓存服务经常受限于内存大小,而且可以将不常用的数据转移到比内存慢的存储中,对总体性能的影响并不大 。
38
38
39
39
<!--
40
40
Other applications expect some read-only input data to be present in
@@ -48,14 +48,14 @@ follow the Pod's lifetime and get created and deleted along with the
48
48
Pod, Pods can be stopped and restarted without being limited to where
49
49
some persistent volume is available.
50
50
-->
51
- _ 临时卷 _ 就是为此类用例设计的。因为卷会遵从 Pod 的生命周期,与 Pod 一起创建和删除,
51
+ ** 临时卷 ** 就是为此类用例设计的。因为卷会遵从 Pod 的生命周期,与 Pod 一起创建和删除,
52
52
所以停止和重新启动 Pod 时,不会受持久卷在何处可用的限制。
53
53
54
54
<!--
55
55
Ephemeral volumes are specified _inline_ in the Pod spec, which
56
56
simplifies application deployment and management.
57
57
-->
58
- 临时卷在 Pod 规约中以 _ 内联 _ 方式定义,这简化了应用程序的部署和管理。
58
+ 临时卷在 Pod 规约中以 ** 内联 ** 方式定义,这简化了应用程序的部署和管理。
59
59
60
60
<!--
61
61
### Types of ephemeral volumes
@@ -79,7 +79,7 @@ different purposes:
79
79
- [generic ephemeral volumes](#generic-ephemeral-volumes), which
80
80
can be provided by all storage drivers that also support persistent volumes
81
81
-->
82
- Kubernetes 为了不同的目的 ,支持几种不同类型的临时卷:
82
+ Kubernetes 为了不同的用途 ,支持几种不同类型的临时卷:
83
83
- [ emptyDir] ( /zh-cn/docs/concepts/storage/volumes/#emptydir ) :
84
84
Pod 启动时为空,存储空间来自本地的 kubelet 根目录(通常是根磁盘)或内存
85
85
- [ configMap] ( /zh-cn/docs/concepts/storage/volumes/#configmap ) 、
@@ -106,7 +106,7 @@ drivers.
106
106
[ 本地临时存储] ( /zh-cn/docs/concepts/configuration/manage-resources-containers/#local-ephemeral-storage )
107
107
提供的。它们由各个节点上的 kubelet 管理。
108
108
109
- CSI 临时卷 * 必须 * 由第三方 CSI 存储驱动程序提供。
109
+ CSI 临时卷 ** 必须 * * 由第三方 CSI 存储驱动程序提供。
110
110
111
111
<!--
112
112
Generic ephemeral volumes *can* be provided by third-party CSI storage
@@ -115,8 +115,8 @@ provisioning. Some CSI drivers are written specifically for CSI
115
115
ephemeral volumes and do not support dynamic provisioning: those then
116
116
cannot be used for generic ephemeral volumes.
117
117
-->
118
- 通用临时卷 * 可以* 由第三方 CSI 存储驱动程序提供,也可以由支持动态配置的任何其他存储驱动程序提供 。
119
- 一些专门为 CSI 临时卷编写的 CSI 驱动程序,不支持动态供应 :因此这些驱动程序不能用于通用临时卷。
118
+ 通用临时卷 ** 可以** 由第三方 CSI 存储驱动程序提供,也可以由支持动态制备的任何其他存储驱动程序提供 。
119
+ 一些专门为 CSI 临时卷编写的 CSI 驱动程序,不支持动态制备 :因此这些驱动程序不能用于通用临时卷。
120
120
121
121
<!--
122
122
The advantage of using third-party drivers is that they can offer
@@ -125,28 +125,20 @@ storage with different performance characteristics than the disk that
125
125
is managed by kubelet, or injecting different data.
126
126
-->
127
127
使用第三方驱动程序的优势在于,它们可以提供 Kubernetes 本身不支持的功能,
128
- 例如,与 kubelet 管理的磁盘具有不同运行特征的存储 ,或者用来注入不同的数据
128
+ 例如,与 kubelet 管理的磁盘具有不同性能特征的存储 ,或者用来注入不同的数据。
129
129
130
130
<!--
131
131
### CSI ephemeral volumes
132
132
-->
133
133
### CSI 临时卷 {#csi-ephemeral-volumes}
134
134
135
- {{< feature-state for_k8s_version="v1.16 " state="beta " >}}
135
+ {{< feature-state for_k8s_version="v1.25 " state="stable " >}}
136
136
137
137
<!--
138
- This feature requires the `CSIInlineVolume` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) to be enabled. It
139
- is enabled by default starting with Kubernetes 1.16.
140
-
141
138
CSI ephemeral volumes are only supported by a subset of CSI drivers.
142
139
The Kubernetes CSI [Drivers list](https://kubernetes-csi.github.io/docs/drivers.html)
143
140
shows which drivers support ephemeral volumes.
144
141
-->
145
-
146
- 该特性需要启用参数 ` CSIInlineVolume `
147
- [ 特性门控(feature gate)] ( /zh-cn/docs/reference/command-line-tools-reference/feature-gates/ ) 。
148
- 该参数从 Kubernetes 1.16 开始默认启用。
149
-
150
142
{{< note >}}
151
143
只有一部分 CSI 驱动程序支持 CSI 临时卷。Kubernetes CSI
152
144
[ 驱动程序列表] ( https://kubernetes-csi.github.io/docs/drivers.html )
@@ -169,8 +161,8 @@ that kubelet can only enforce for storage that it manages itself.
169
161
Here's an example manifest for a Pod that uses CSI ephemeral storage:
170
162
-->
171
163
从概念上讲,CSI 临时卷类似于 ` configMap ` 、` downwardAPI ` 和 ` secret ` 类型的卷:
172
- 其存储在每个节点本地管理,并在将 Pod 调度到节点后与其他本地资源一起创建。
173
- 在这个阶段,Kubernetes 没有重新调度 Pods 的概念。卷创建不太可能失败,否则 Pod 启动将会受阻。
164
+ 在各个本地节点管理卷的存储,并在 Pod 调度到节点后与其他本地资源一起创建。
165
+ 在这个阶段,Kubernetes 没有重新调度 Pod 的概念。卷创建不太可能失败,否则 Pod 启动将会受阻。
174
166
特别是,这些卷 ** 不** 支持[ 感知存储容量的 Pod 调度] ( /zh-cn/docs/concepts/storage/storage-capacity/ ) 。
175
167
它们目前也没包括在 Pod 的存储资源使用限制中,因为 kubelet 只能对它自己管理的存储强制执行。
176
168
@@ -205,7 +197,7 @@ instructions.
205
197
206
198
-->
207
199
208
- ` volumeAttributes` 决定驱动程序准备什么样的卷。这些属性特定于每个驱动程序,且没有实现标准化 。
200
+ ` volumeAttributes` 决定驱动程序准备什么样的卷。每个驱动程序的属性不尽相同,没有实现标准化 。
209
201
有关进一步的说明,请参阅每个 CSI 驱动程序的文档。
210
202
211
203
<!--
@@ -222,22 +214,20 @@ should not be exposed to users through the use of inline ephemeral volumes.
222
214
# ## CSI 驱动程序限制 {#csi-driver-restrictions}
223
215
224
216
CSI 临时卷允许用户直接向 CSI 驱动程序提供 `volumeAttributes`,它会作为 Pod 规约的一部分。
225
- 允许 `volumeAttributes` 的 CSI 驱动程序通常仅限于管理员使用,不适合在内联临时卷中使用 。
217
+ 有些 `volumeAttributes` 通常仅限于管理员使用,允许这一类 `volumeAttributes` 的 CSI 驱动程序不适合在内联临时卷中使用 。
226
218
例如,通常在 StorageClass 中定义的参数不应通过使用内联临时卷向用户公开。
227
219
228
- 作为一个集群管理员,你可以使用
229
- [PodSecurityPolicy](/zh-cn/docs/concepts/security/pod-security-policy/)
230
- 来控制在 Pod 中可以使用哪些 CSI 驱动程序,
231
- 具体则是通过 [`allowedCSIDrivers` 字段](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podsecuritypolicyspec-v1beta1-policy)
232
- 指定。
233
-
234
220
<!--
235
221
Cluster administrators who need to restrict the CSI drivers that are
236
222
allowed to be used as inline volumes within a Pod spec may do so by :
237
- - Removing `Ephemeral` from `volumeLifecycleModes` in the CSIDriver spec, which prevents the driver from being used as an inline ephemeral volume.
238
- - Using an [admission webhook](/docs/reference/access-authn-authz/extensible-admission-controllers/) to restrict how this driver is used.
223
+
224
+ - Removing `Ephemeral` from `volumeLifecycleModes` in the CSIDriver spec, which prevents the
225
+ driver from being used as an inline ephemeral volume.
226
+ - Using an [admission webhook](/docs/reference/access-authn-authz/extensible-admission-controllers/)
227
+ to restrict how this driver is used.
239
228
-->
240
- 如果集群管理员需要限制 CSI 驱动程序在 Pod 规约中被作为内联卷使用,可以这样做:
229
+ 如果集群管理员需要限制在 Pod 规约中作为内联卷使用的 CSI 驱动程序,可以这样做:
230
+
241
231
- 从 CSIDriver 规约的 `volumeLifecycleModes` 中删除 `Ephemeral`,这可以防止驱动程序被用作内联临时卷。
242
232
- 使用[准入 Webhook](/zh-cn/docs/reference/access-authn-authz/extensible-admission-controllers/)
243
233
来限制如何使用此驱动程序。
@@ -254,11 +244,21 @@ Generic ephemeral volumes are similar to `emptyDir` volumes in the
254
244
sense that they provide a per-pod directory for scratch data that is
255
245
usually empty after provisioning. But they may also have additional
256
246
features :
247
+ -->
248
+ 通用临时卷类似于 `emptyDir` 卷,因为它为每个 Pod 提供临时数据存放目录,
249
+ 在最初制备完毕时一般为空。不过通用临时卷也有一些额外的功能特性:
257
250
251
+ <!--
258
252
- Storage can be local or network-attached.
259
253
- Volumes can have a fixed size that Pods are not able to exceed.
260
254
- Volumes may have some initial data, depending on the driver and
261
255
parameters.
256
+ -->
257
+ - 存储可以是本地的,也可以是网络连接的。
258
+ - 卷可以有固定的大小,Pod 不能超量使用。
259
+ - 卷可能有一些初始数据,这取决于驱动程序和参数。
260
+
261
+ <!--
262
262
- Typical operations on volumes are supported assuming that the driver
263
263
supports them, including
264
264
[snapshotting](/docs/concepts/storage/volume-snapshots/),
@@ -268,14 +268,8 @@ features:
268
268
269
269
Example :
270
270
-->
271
- 通用临时卷类似于 `emptyDir` 卷,因为它为每个 Pod 提供临时数据存放目录,
272
- 在最初制备完毕时一般为空。不过通用临时卷也有一些额外的功能特性:
273
-
274
- - 存储可以是本地的,也可以是网络连接的。
275
- - 卷可以有固定的大小,Pod 不能超量使用。
276
- - 卷可能有一些初始数据,这取决于驱动程序和参数。
277
- - 当驱动程序支持,卷上的典型操作将被支持,包括
278
- ([快照](/zh-cn/docs/concepts/storage/volume-snapshots/)、
271
+ - 支持典型的卷操作,前提是相关的驱动程序也支持该操作,包括
272
+ [快照](/zh-cn/docs/concepts/storage/volume-snapshots/)、
279
273
[克隆](/zh-cn/docs/concepts/storage/volume-pvc-datasource/)、
280
274
[调整大小](/zh-cn/docs/concepts/storage/persistent-volumes/#expanding-persistent-volumes-claims)和
281
275
[存储容量跟踪](/zh-cn/docs/concepts/storage/storage-capacity/))。
@@ -340,15 +334,15 @@ because then the scheduler is free to choose a suitable node for
340
334
the Pod. With immediate binding, the scheduler is forced to select a node that has
341
335
access to the volume once it is available.
342
336
-->
343
- 如上设置将触发卷的绑定与/或准备操作 ,相应动作或者在
337
+ 如上设置将触发卷的绑定与/或制备 ,相应动作或者在
344
338
{{< glossary_tooltip text="StorageClass" term_id="storage-class" >}}
345
339
使用即时卷绑定时立即执行,
346
340
或者当 Pod 被暂时性调度到某节点时执行 (`WaitForFirstConsumer` 卷绑定模式)。
347
- 对于常见的临时卷 ,建议采用后者,这样调度器就可以自由地为 Pod 选择合适的节点。
341
+ 对于通用的临时卷 ,建议采用后者,这样调度器就可以自由地为 Pod 选择合适的节点。
348
342
对于即时绑定,调度器则必须选出一个节点,使得在卷可用时,能立即访问该卷。
349
343
350
344
<!--
351
- In terms of [resource ownership](/docs/concepts/workloads/controllers/ garbage-collection/#owners-and -dependents),
345
+ In terms of [resource ownership](/docs/concepts/architecture/ garbage-collection/#owners-dependents),
352
346
a Pod that has generic ephemeral storage is the owner of the PersistentVolumeClaim(s)
353
347
that provide that ephemeral storage. When the Pod is deleted,
354
348
the Kubernetes garbage collector deletes the PVC, which then usually
@@ -357,7 +351,7 @@ storage classes is to delete volumes. You can create quasi-ephemeral local stora
357
351
using a StorageClass with a reclaim policy of `retain` : the storage outlives the Pod,
358
352
and in this case you need to ensure that volume clean up happens separately.
359
353
-->
360
- 就[资源所有权](/zh-cn/docs/concepts/workloads/controllers/ garbage-collection/#owners-and -dependents)而言,
354
+ 就[资源所有权](/zh-cn/docs/concepts/architecture/ garbage-collection/#owners-dependents)而言,
361
355
拥有通用临时存储的 Pod 是提供临时存储 (ephemeral storage) 的 PersistentVolumeClaim 的所有者。
362
356
当 Pod 被删除时,Kubernetes 垃圾收集器会删除 PVC,
363
357
然后 PVC 通常会触发卷的删除,因为存储类的默认回收策略是删除卷。
@@ -372,7 +366,7 @@ volume.
372
366
-->
373
367
当这些 PVC 存在时,它们可以像其他 PVC 一样使用。
374
368
特别是,它们可以被引用作为批量克隆或快照的数据源。
375
- PVC对象还保持着卷的当前状态 。
369
+ PVC 对象还保持着卷的当前状态 。
376
370
377
371
<!--
378
372
# ## PersistentVolumeClaim naming
@@ -387,20 +381,20 @@ middle. In the example above, the PVC name will be
387
381
interact with the PVC because one does not have to search for it once
388
382
the Pod name and volume name are known.
389
383
-->
390
- 自动创建的 PVCs 的命名是确定的:此名称是 Pod 名称和卷名称的组合,中间由连字符(`-`)连接。
384
+ 自动创建的 PVC 采取确定性的命名机制:名称是 Pod 名称和卷名称的组合,中间由连字符(`-`)连接。
391
385
在上面的示例中,PVC 将命名为 `my-app-scratch-volume` 。
392
- 这种确定性命名方式使得与 PVC 交互变得更容易,因为一旦知道 Pod 名称和卷名,就不必搜索它。
386
+ 这种确定性的命名机制使得与 PVC 交互变得更容易,因为一旦知道 Pod 名称和卷名,就不必搜索它。
393
387
394
388
<!--
395
389
The deterministic naming also introduces a potential conflict between different
396
390
Pods (a Pod "pod-a" with volume "scratch" and another Pod with name
397
391
" pod" and volume "a-scratch" both end up with the same PVC name
398
392
" pod-a-scratch" ) and between Pods and manually created PVCs.
399
393
-->
400
- 这种确定性命名方式也引入了潜在的冲突 ,
401
- 比如在不同的 Pod 之间(名为 “Pod-a” 的 Pod 挂载名为 "scratch" 的卷,
394
+ 这种命名机制也引入了潜在的冲突 ,
395
+ 不同的 Pod 之间(名为 “Pod-a” 的 Pod 挂载名为 "scratch" 的卷,
402
396
和名为 "pod" 的 Pod 挂载名为 “a-scratch” 的卷,这两者均会生成名为
403
- " pod-a-scratch" 的PVC ),或者在 Pod 和手工创建的 PVC 之间 。
397
+ " pod-a-scratch" 的 PVC ),或者在 Pod 和手工创建的 PVC 之间可能出现冲突 。
404
398
405
399
<!--
406
400
Such conflicts are detected : a PVC is only used for an ephemeral
@@ -418,7 +412,7 @@ Take care when naming Pods and volumes inside the
418
412
same namespace, so that these conflicts can't occur.
419
413
-->
420
414
{{< caution >}}
421
- 当命名 Pods 和卷出现在同一个命名空间中时 ,要小心,以防止发生此类冲突。
415
+ 当同一个命名空间中命名 Pod 和卷时 ,要小心,以防止发生此类冲突。
422
416
{{< /caution >}}
423
417
424
418
<!--
@@ -431,20 +425,21 @@ Enabling the GenericEphemeralVolume feature allows users to create
431
425
PVCs indirectly if they can create Pods, even if they do not have
432
426
permission to create PVCs directly. Cluster administrators must be
433
427
aware of this. If this does not fit their security model, they should
434
- use an [admission webhook](/docs/reference/access-authn-authz/extensible-admission-controllers/) that rejects objects like Pods that have a generic ephemeral volume.
428
+ use an [admission webhook](/docs/reference/access-authn-authz/extensible-admission-controllers/)
429
+ that rejects objects like Pods that have a generic ephemeral volume.
435
430
-->
436
- 启用 GenericEphemeralVolume 特性会导致那些没有 PVCs 创建权限的用户 ,
437
- 在创建 Pods 时,被允许间接的创建 PVCs 。
431
+ 启用 GenericEphemeralVolume 特性会有一些副作用,用户能创建 Pod 就能间接地创建 PVC ,
432
+ 即使他们没有权限直接创建 PVC 。
438
433
集群管理员必须意识到这一点。
439
- 如果这不符合他们的安全模型,他们应该使用一个 [准入 Webhook](/zh-cn/docs/reference/access-authn-authz/extensible-admission-controllers/)
440
- 拒绝包含通用临时卷的 Pods 。
434
+ 如果这不符合他们的安全模型,他们应该使用 [准入 Webhook](/zh-cn/docs/reference/access-authn-authz/extensible-admission-controllers/)
435
+ 拒绝包含通用临时卷的对象,例如 Pod 。
441
436
442
437
<!--
443
- The normal [namespace quota for PVCs](/docs/concepts/policy/resource-quotas/#storage-resource-quota) still applies, so
444
- even if users are allowed to use this new mechanism, they cannot use
438
+ The normal [namespace quota for PVCs](/docs/concepts/policy/resource-quotas/#storage-resource-quota)
439
+ still applies, so even if users are allowed to use this new mechanism, they cannot use
445
440
it to circumvent other policies.
446
441
-->
447
- [为 PVC 卷所设置的逐名字空间的配额 ](/zh-cn/docs/concepts/policy/resource-quotas/#storage-resource-quota)
442
+ 正常的 [ PVC 的名字空间配额 ](/zh-cn/docs/concepts/policy/resource-quotas/#storage-resource-quota)
448
443
仍然有效,因此即使允许用户使用这种新机制,他们也不能使用它来规避其他策略。
449
444
450
445
# # {{% heading "whatsnext" %}}
@@ -461,9 +456,10 @@ See [local ephemeral storage](/docs/concepts/configuration/manage-resources-cont
461
456
<!--
462
457
# ## CSI ephemeral volumes
463
458
464
- - For more information on the design, see the [Ephemeral Inline CSI
465
- volumes KEP](https://github.com/kubernetes/enhancements/blob/ad6021b3d61a49040a3f835e12c8bb5424db2bbb/keps/sig-storage/20190122-csi-inline-volumes.md).
466
- - For more information on further development of this feature, see the [enhancement tracking issue # 596](https://github.com/kubernetes/enhancements/issues/596).
459
+ - For more information on the design, see the
460
+ [Ephemeral Inline CSI volumes KEP](https://github.com/kubernetes/enhancements/blob/ad6021b3d61a49040a3f835e12c8bb5424db2bbb/keps/sig-storage/20190122-csi-inline-volumes.md).
461
+ - For more information on further development of this feature, see the
462
+ [enhancement tracking issue # 596](https://github.com/kubernetes/enhancements/issues/596).
467
463
-->
468
464
# ## CSI 临时卷 {#csi-ephemeral-volumes}
469
465
0 commit comments