@@ -391,17 +391,15 @@ to learn more.
391
391
# ## emptyDir {#emptydir}
392
392
393
393
<!--
394
- An `emptyDir` volume is first created when a Pod is assigned to a node, and
395
- exists as long as that Pod is running on that node. As the name says, the
396
- ` emptyDir` volume is initially empty. All containers in the Pod can read and write the same
394
+ For a Pod that defines an `emptyDir` volume, the volume is created when the Pod is assigned to a node.
395
+ As the name says, the `emptyDir` volume is initially empty. All containers in the Pod can read and write the same
397
396
files in the `emptyDir` volume, though that volume can be mounted at the same
398
397
or different paths in each container. When a Pod is removed from a node for
399
398
any reason, the data in the `emptyDir` is deleted permanently.
400
399
-->
401
- 当 Pod 分派到某个节点上时,`emptyDir` 卷会被创建,并且在 Pod 在该节点上运行期间,卷一直存在。
402
- 就像其名称表示的那样,卷最初是空的。
403
- 尽管 Pod 中的容器挂载 `emptyDir` 卷的路径可能相同也可能不同,这些容器都可以读写
404
- ` emptyDir` 卷中相同的文件。
400
+ 对于定义了 `emptyDir` 卷的 Pod,在 Pod 被指派到某节点时此卷会被创建。
401
+ 就像其名称所表示的那样,`emptyDir` 卷最初是空的。尽管 Pod 中的容器挂载 `emptyDir`
402
+ 卷的路径可能相同也可能不同,但这些容器都可以读写 `emptyDir` 卷中相同的文件。
405
403
当 Pod 因为某些原因被从节点上删除时,`emptyDir` 卷中的数据也会被永久删除。
406
404
407
405
{{< note >}}
@@ -632,10 +630,10 @@ Dynamic provisioning is possible using a
632
630
[StorageClass for GCE PD](/docs/concepts/storage/storage-classes/#gce-pd).
633
631
Before creating a PersistentVolume, you must create the persistent disk :
634
632
-->
635
- # ### 手动供应基于区域 PD 的 PersistentVolume {#manually-provisioning-regional-pd-pv}
633
+ # ### 手动制备基于区域 PD 的 PersistentVolume {#manually-provisioning-regional-pd-pv}
636
634
637
635
使用[为 GCE PD 定义的存储类](/zh-cn/docs/concepts/storage/storage-classes/#gce-pd)
638
- 可以实现动态供应 。在创建 PersistentVolume 之前,你首先要创建 PD。
636
+ 可以实现动态制备 。在创建 PersistentVolume 之前,你首先要创建 PD。
639
637
640
638
` ` ` shell
641
639
gcloud compute disks create --size=500GB my-data-disk
@@ -648,6 +646,9 @@ gcloud compute disks create --size=500GB my-data-disk
648
646
-->
649
647
# ### 区域持久盘配置示例
650
648
649
+ <!--
650
+ # failure-domain.beta.kubernetes.io/zone should be used prior to 1.21
651
+ -->
651
652
` ` ` yaml
652
653
apiVersion: v1
653
654
kind: PersistentVolume
@@ -770,7 +771,7 @@ and then removed entirely in the v1.26 release.
770
771
Kubernetes {{< skew currentVersion >}} 不包含 `glusterfs` 卷类型。
771
772
772
773
GlusterFS 树内存储驱动程序在 Kubernetes v1.25 版本中被弃用,然后在 v1.26 版本中被完全移除。
773
-
774
+
774
775
# ## hostPath {#hostpath}
775
776
776
777
{{< warning >}}
@@ -872,6 +873,10 @@ Watch out when using this type of volume, because:
872
873
-->
873
874
# ### hostPath 配置示例
874
875
876
+ <!--
877
+ # directory location on host
878
+ # this field is optional
879
+ -->
875
880
` ` ` yaml
876
881
apiVersion: v1
877
882
kind: Pod
@@ -887,7 +892,7 @@ spec:
887
892
volumes:
888
893
- name: test-volume
889
894
hostPath:
890
- # 宿主上目录位置
895
+ # 宿主机上目录位置
891
896
path: /data
892
897
# 此字段为可选
893
898
type: Directory
@@ -903,14 +908,17 @@ you can try to mount directories and files separately, as shown in the
903
908
` FileOrCreate` 模式不会负责创建文件的父目录。
904
909
如果欲挂载的文件的父目录不存在,Pod 启动会失败。
905
910
为了确保这种模式能够工作,可以尝试把文件和它对应的目录分开挂载,如
906
- [`FileOrCreate` 配置](#hostpath-fileorcreate-example) 所示。
911
+ [`FileOrCreate` 配置](#hostpath-fileorcreate-example)所示。
907
912
{{< /caution >}}
908
913
909
914
<!--
910
915
# ### hostPath FileOrCreate configuration example {#hostpath-fileorcreate-example}
911
916
-->
912
917
# ### hostPath FileOrCreate 配置示例 {#hostpath-fileorcreate-example}
913
918
919
+ <!--
920
+ # Ensure the file directory is created.
921
+ -->
914
922
` ` ` yaml
915
923
apiVersion: v1
916
924
kind: Pod
@@ -1191,6 +1199,9 @@ Here is an example Pod referencing a pre-provisioned Portworx volume:
1191
1199
` portworxVolume` 类型的卷可以通过 Kubernetes 动态创建,也可以预先配备并在 Pod 内引用。
1192
1200
下面是一个引用预先配备的 Portworx 卷的示例 Pod:
1193
1201
1202
+ <!--
1203
+ # This Portworx volume must already exist.
1204
+ -->
1194
1205
` ` ` yaml
1195
1206
apiVersion: v1
1196
1207
kind: Pod
@@ -1253,7 +1264,7 @@ To enable the feature, set `CSIMigrationPortworx=true` in kube-controller-manage
1253
1264
A projected volume maps several existing volume sources into the same
1254
1265
directory. For more details, see [projected volumes](/docs/concepts/storage/projected-volumes/).
1255
1266
-->
1256
- # ## projected (投射 ) {#projected}
1267
+ # ## 投射(projected ) {#projected}
1257
1268
1258
1269
投射卷能将若干现有的卷来源映射到同一目录上。更多详情请参考[投射卷](/zh-cn/docs/concepts/storage/projected-volumes/)。
1259
1270
@@ -1354,7 +1365,7 @@ RBD CSI driver:
1354
1365
* 你必须在集群中安装 v3.5.0 或更高版本的 Ceph CSI 驱动(`rbd.csi.ceph.com`)。
1355
1366
* 因为 `clusterID` 是 CSI 驱动程序必需的参数,而树内存储类又将 `monitors`
1356
1367
作为一个必需的参数,所以 Kubernetes 存储管理者需要根据 `monitors`
1357
- 的哈希值(例 :`#echo -n '<monitors_string>' | md5sum`)来创建
1368
+ 的哈希值(例如 :`#echo -n '<monitors_string>' | md5sum`)来创建
1358
1369
` clusterID` ,并保持该 `monitors` 存在于该 `clusterID` 的配置中。
1359
1370
* 同时,如果树内存储类的 `adminId` 的值不是 `admin`,那么其 `adminSecretName`
1360
1371
就需要被修改成 `adminId` 参数的 base64 编码值。
@@ -1427,7 +1438,6 @@ For more information, see the [vSphere volume](https://github.com/kubernetes/exa
1427
1438
1428
1439
{{< feature-state for_k8s_version="v1.26" state="stable" >}}
1429
1440
1430
-
1431
1441
<!--
1432
1442
In Kubernetes {{< skew currentVersion >}}, all operations for the in-tree `vsphereVolume` type
1433
1443
are redirected to the `csi.vsphere.vmware.com` {{< glossary_tooltip text="CSI" term_id="csi" >}} driver.
@@ -1568,8 +1578,11 @@ The host directory `/var/log/pods/pod1` is mounted at `/logs` in the container.
1568
1578
-->
1569
1579
在这个示例中,`Pod` 使用 `subPathExpr` 来 `hostPath` 卷 `/var/log/pods` 中创建目录 `pod1`。
1570
1580
` hostPath` 卷采用来自 `downwardAPI` 的 Pod 名称生成目录名。
1571
- 宿主目录 `/var/log/pods/pod1` 被挂载到容器的 `/logs` 中。
1581
+ 宿主机目录 `/var/log/pods/pod1` 被挂载到容器的 `/logs` 中。
1572
1582
1583
+ <!--
1584
+ # The variable expansion uses round brackets (not curly brackets).
1585
+ -->
1573
1586
` ` ` yaml
1574
1587
apiVersion: v1
1575
1588
kind: Pod
@@ -1652,8 +1665,8 @@ to the [volume plugin FAQ](https://github.com/kubernetes/community/blob/master/s
1652
1665
-->
1653
1666
CSI 和 FlexVolume 都允许独立于 Kubernetes 代码库开发卷插件,并作为扩展部署(安装)在 Kubernetes 集群上。
1654
1667
1655
- 对于希望创建树外(Out-Of-Tree)卷插件的存储供应商,请参考
1656
- [卷插件常见问题](https://github.com/kubernetes/community/blob/master/sig-storage/volume-plugin-faq.md)。
1668
+ 对于希望创建树外(Out-Of-Tree)卷插件的存储供应商,
1669
+ 请参考 [卷插件常见问题](https://github.com/kubernetes/community/blob/master/sig-storage/volume-plugin-faq.md)。
1657
1670
1658
1671
# ## CSI
1659
1672
@@ -1778,7 +1791,7 @@ persistent volume:
1778
1791
该映射必须与 CSI 驱动程序返回的 `CreateVolumeResponse` 中的 `volume.attributes`
1779
1792
字段的映射相对应;
1780
1793
[CSI 规范](https://github.com/container-storage-interface/spec/blob/master/spec.md#createvolume)中有相应的定义。
1781
- 该映射通过`ControllerPublishVolumeRequest`、`NodeStageVolumeRequest`、 和
1794
+ 该映射通过`ControllerPublishVolumeRequest`、`NodeStageVolumeRequest` 和
1782
1795
` NodePublishVolumeRequest` 中的 `volume_context` 字段传递给 CSI 驱动。
1783
1796
1784
1797
<!--
@@ -1912,7 +1925,7 @@ stand-alone binary that needs to be pre-installed on each Windows node.
1912
1925
For more details, refer to the deployment guide of the CSI plugin you wish to deploy.
1913
1926
-->
1914
1927
CSI 节点插件需要执行多种特权操作,例如扫描磁盘设备和挂载文件系统等。
1915
- 这些操作在每个宿主操作系统上都是不同的 。对于 Linux 工作节点而言,容器化的 CSI
1928
+ 这些操作在每个宿主机操作系统上都是不同的 。对于 Linux 工作节点而言,容器化的 CSI
1916
1929
节点插件通常部署为特权容器。对于 Windows 工作节点而言,容器化 CSI
1917
1930
节点插件的特权操作是通过 [csi-proxy](https://github.com/kubernetes-csi/csi-proxy)
1918
1931
来支持的。csi-proxy 是一个由社区管理的、独立的可执行二进制文件,
@@ -1986,7 +1999,7 @@ The following FlexVolume [plugins](https://github.com/Microsoft/K8s-Storage-Plug
1986
1999
deployed as PowerShell scripts on the host, support Windows nodes :
1987
2000
-->
1988
2001
下面的 FlexVolume [插件](https://github.com/Microsoft/K8s-Storage-Plugins/tree/master/flexvolume/windows)
1989
- 以 PowerShell 脚本的形式部署在宿主系统上 ,支持 Windows 节点:
2002
+ 以 PowerShell 脚本的形式部署在宿主机系统上 ,支持 Windows 节点:
1990
2003
1991
2004
* [SMB](https://github.com/microsoft/K8s-Storage-Plugins/tree/master/flexvolume/windows/plugins/microsoft.com~smb.cmd)
1992
2005
* [iSCSI](https://github.com/microsoft/K8s-Storage-Plugins/tree/master/flexvolume/windows/plugins/microsoft.com~iscsi.cmd)
@@ -2034,17 +2047,15 @@ in `Container.volumeMounts`. Its values are:
2034
2047
cri-dockerd (Docker) is known to choose `rslave` mount propagation when the
2035
2048
mount source contains the Docker daemon's root directory (`/var/lib/docker`).
2036
2049
-->
2037
-
2038
2050
* `None` - 此卷挂载将不会感知到主机后续在此卷或其任何子目录上执行的挂载变化。
2039
- 类似的,容器所创建的卷挂载在主机上是不可见的。这是默认模式。
2051
+ 类似的,容器所创建的卷挂载在主机上是不可见的。这是默认模式。
2040
2052
2041
- 该模式等同于 [`mount(8)`](https://man7.org/linux/man-pages/man8/mount.8.html)中描述的
2042
- ` rprivate` 挂载传播选项。
2053
+ 该模式等同于 [`mount(8)`](https://man7.org/linux/man-pages/man8/mount.8.html) 中描述的
2054
+ ` rprivate` 挂载传播选项。
2043
2055
2044
- 然而,当 `rprivate` 传播选项不适用时,CRI 运行时可以转为选择 `rslave` 挂载传播选项
2045
- (即 `HostToContainer`)。当挂载源包含 Docker 守护进程的根目录(`/var/lib/docker`)时,
2046
- cri-dockerd (Docker) 已知可以选择 `rslave` 挂载传播选项。
2047
- 。
2056
+ 然而,当 `rprivate` 传播选项不适用时,CRI 运行时可以转为选择 `rslave` 挂载传播选项
2057
+ (即 `HostToContainer`)。当挂载源包含 Docker 守护进程的根目录(`/var/lib/docker`)时,
2058
+ cri-dockerd (Docker) 已知可以选择 `rslave` 挂载传播选项。
2048
2059
2049
2060
<!--
2050
2061
* `HostToContainer` - This volume mount will receive all subsequent mounts
@@ -2084,7 +2095,7 @@ in `Container.volumeMounts`. Its values are:
2084
2095
* `Bidirectional` - 这种卷挂载和 `HostToContainer` 挂载表现相同。
2085
2096
另外,容器创建的卷挂载将被传播回至主机和使用同一卷的所有 Pod 的所有容器。
2086
2097
2087
- 该模式等同于 [`mount(8)`](https://man7.org/linux/man-pages/man8/mount.8.html)中描述的
2098
+ 该模式等同于 [`mount(8)`](https://man7.org/linux/man-pages/man8/mount.8.html) 中描述的
2088
2099
` rshared` 挂载传播选项。
2089
2100
2090
2101
{{< warning >}}
@@ -2101,36 +2112,6 @@ in `Container.volumeMounts`. Its values are:
2101
2112
此外,由 Pod 中的容器创建的任何卷挂载必须在终止时由容器销毁(卸载)。
2102
2113
{{< /warning >}}
2103
2114
2104
- <!--
2105
- # ## Configuration
2106
-
2107
- Before mount propagation can work properly on some deployments (CoreOS,
2108
- RedHat/Centos, Ubuntu) mount share must be configured correctly in
2109
- Docker as shown below.
2110
- -->
2111
- # ## 配置 {#configuration}
2112
-
2113
- 在某些部署环境中,挂载传播正常工作前,必须在 Docker 中正确配置挂载共享(mount share),如下所示。
2114
-
2115
- <!--
2116
- Edit your Docker's `systemd` service file. Set `MountFlags` as follows :
2117
- -->
2118
- 编辑你的 Docker `systemd` 服务文件,按下面的方法设置 `MountFlags`:
2119
-
2120
- ` ` ` shell
2121
- MountFlags=shared
2122
- ` ` `
2123
-
2124
- <!--
2125
- Or, remove `MountFlags=slave` if present. Then restart the Docker daemon :
2126
- -->
2127
- 或者,如果存在 `MountFlags=slave` 就删除掉。然后重启 Docker 守护进程:
2128
-
2129
- ` ` ` shell
2130
- sudo systemctl daemon-reload
2131
- sudo systemctl restart docker
2132
- ` ` `
2133
-
2134
2115
# # {{% heading "whatsnext" %}}
2135
2116
2136
2117
<!--
0 commit comments