Skip to content

Commit fd754c8

Browse files
authored
Merge pull request #43826 from windsonsea/volumey
[zh] Sync /storage/volumes.md
2 parents b3ad78b + 511662c commit fd754c8

File tree

1 file changed

+41
-60
lines changed

1 file changed

+41
-60
lines changed

content/zh-cn/docs/concepts/storage/volumes.md

Lines changed: 41 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -391,17 +391,15 @@ to learn more.
391391
### emptyDir {#emptydir}
392392

393393
<!--
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
397396
files in the `emptyDir` volume, though that volume can be mounted at the same
398397
or different paths in each container. When a Pod is removed from a node for
399398
any reason, the data in the `emptyDir` is deleted permanently.
400399
-->
401-
当 Pod 分派到某个节点上时,`emptyDir` 卷会被创建,并且在 Pod 在该节点上运行期间,卷一直存在。
402-
就像其名称表示的那样,卷最初是空的。
403-
尽管 Pod 中的容器挂载 `emptyDir` 卷的路径可能相同也可能不同,这些容器都可以读写
404-
`emptyDir` 卷中相同的文件。
400+
对于定义了 `emptyDir` 卷的 Pod,在 Pod 被指派到某节点时此卷会被创建。
401+
就像其名称所表示的那样,`emptyDir` 卷最初是空的。尽管 Pod 中的容器挂载 `emptyDir`
402+
卷的路径可能相同也可能不同,但这些容器都可以读写 `emptyDir` 卷中相同的文件。
405403
当 Pod 因为某些原因被从节点上删除时,`emptyDir` 卷中的数据也会被永久删除。
406404

407405
{{< note >}}
@@ -632,10 +630,10 @@ Dynamic provisioning is possible using a
632630
[StorageClass for GCE PD](/docs/concepts/storage/storage-classes/#gce-pd).
633631
Before creating a PersistentVolume, you must create the persistent disk:
634632
-->
635-
#### 手动供应基于区域 PD 的 PersistentVolume {#manually-provisioning-regional-pd-pv}
633+
#### 手动制备基于区域 PD 的 PersistentVolume {#manually-provisioning-regional-pd-pv}
636634

637635
使用[为 GCE PD 定义的存储类](/zh-cn/docs/concepts/storage/storage-classes/#gce-pd)
638-
可以实现动态供应。在创建 PersistentVolume 之前,你首先要创建 PD。
636+
可以实现动态制备。在创建 PersistentVolume 之前,你首先要创建 PD。
639637

640638
```shell
641639
gcloud compute disks create --size=500GB my-data-disk
@@ -648,6 +646,9 @@ gcloud compute disks create --size=500GB my-data-disk
648646
-->
649647
#### 区域持久盘配置示例
650648

649+
<!--
650+
# failure-domain.beta.kubernetes.io/zone should be used prior to 1.21
651+
-->
651652
```yaml
652653
apiVersion: v1
653654
kind: PersistentVolume
@@ -770,7 +771,7 @@ and then removed entirely in the v1.26 release.
770771
Kubernetes {{< skew currentVersion >}} 不包含 `glusterfs` 卷类型。
771772

772773
GlusterFS 树内存储驱动程序在 Kubernetes v1.25 版本中被弃用,然后在 v1.26 版本中被完全移除。
773-
774+
774775
### hostPath {#hostpath}
775776

776777
{{< warning >}}
@@ -872,6 +873,10 @@ Watch out when using this type of volume, because:
872873
-->
873874
#### hostPath 配置示例
874875

876+
<!--
877+
# directory location on host
878+
# this field is optional
879+
-->
875880
```yaml
876881
apiVersion: v1
877882
kind: Pod
@@ -887,7 +892,7 @@ spec:
887892
volumes:
888893
- name: test-volume
889894
hostPath:
890-
# 宿主上目录位置
895+
# 宿主机上目录位置
891896
path: /data
892897
# 此字段为可选
893898
type: Directory
@@ -903,14 +908,17 @@ you can try to mount directories and files separately, as shown in the
903908
`FileOrCreate` 模式不会负责创建文件的父目录。
904909
如果欲挂载的文件的父目录不存在,Pod 启动会失败。
905910
为了确保这种模式能够工作,可以尝试把文件和它对应的目录分开挂载,如
906-
[`FileOrCreate` 配置](#hostpath-fileorcreate-example) 所示。
911+
[`FileOrCreate` 配置](#hostpath-fileorcreate-example)所示。
907912
{{< /caution >}}
908913

909914
<!--
910915
#### hostPath FileOrCreate configuration example {#hostpath-fileorcreate-example}
911916
-->
912917
#### hostPath FileOrCreate 配置示例 {#hostpath-fileorcreate-example}
913918

919+
<!--
920+
# Ensure the file directory is created.
921+
-->
914922
```yaml
915923
apiVersion: v1
916924
kind: Pod
@@ -1191,6 +1199,9 @@ Here is an example Pod referencing a pre-provisioned Portworx volume:
11911199
`portworxVolume` 类型的卷可以通过 Kubernetes 动态创建,也可以预先配备并在 Pod 内引用。
11921200
下面是一个引用预先配备的 Portworx 卷的示例 Pod:
11931201

1202+
<!--
1203+
# This Portworx volume must already exist.
1204+
-->
11941205
```yaml
11951206
apiVersion: v1
11961207
kind: Pod
@@ -1253,7 +1264,7 @@ To enable the feature, set `CSIMigrationPortworx=true` in kube-controller-manage
12531264
A projected volume maps several existing volume sources into the same
12541265
directory. For more details, see [projected volumes](/docs/concepts/storage/projected-volumes/).
12551266
-->
1256-
### projected (投射) {#projected}
1267+
### 投射(projected) {#projected}
12571268

12581269
投射卷能将若干现有的卷来源映射到同一目录上。更多详情请参考[投射卷](/zh-cn/docs/concepts/storage/projected-volumes/)。
12591270

@@ -1354,7 +1365,7 @@ RBD CSI driver:
13541365
* 你必须在集群中安装 v3.5.0 或更高版本的 Ceph CSI 驱动(`rbd.csi.ceph.com`)。
13551366
* 因为 `clusterID` 是 CSI 驱动程序必需的参数,而树内存储类又将 `monitors`
13561367
作为一个必需的参数,所以 Kubernetes 存储管理者需要根据 `monitors`
1357-
的哈希值(:`#echo -n '<monitors_string>' | md5sum`)来创建
1368+
的哈希值(例如:`#echo -n '<monitors_string>' | md5sum`)来创建
13581369
`clusterID`,并保持该 `monitors` 存在于该 `clusterID` 的配置中。
13591370
* 同时,如果树内存储类的 `adminId` 的值不是 `admin`,那么其 `adminSecretName`
13601371
就需要被修改成 `adminId` 参数的 base64 编码值。
@@ -1427,7 +1438,6 @@ For more information, see the [vSphere volume](https://github.com/kubernetes/exa
14271438

14281439
{{< feature-state for_k8s_version="v1.26" state="stable" >}}
14291440

1430-
14311441
<!--
14321442
In Kubernetes {{< skew currentVersion >}}, all operations for the in-tree `vsphereVolume` type
14331443
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.
15681578
-->
15691579
在这个示例中,`Pod` 使用 `subPathExpr` 来 `hostPath` 卷 `/var/log/pods` 中创建目录 `pod1`。
15701580
`hostPath` 卷采用来自 `downwardAPI` 的 Pod 名称生成目录名。
1571-
宿主目录 `/var/log/pods/pod1` 被挂载到容器的 `/logs` 中。
1581+
宿主机目录 `/var/log/pods/pod1` 被挂载到容器的 `/logs` 中。
15721582

1583+
<!--
1584+
# The variable expansion uses round brackets (not curly brackets).
1585+
-->
15731586
```yaml
15741587
apiVersion: v1
15751588
kind: Pod
@@ -1652,8 +1665,8 @@ to the [volume plugin FAQ](https://github.com/kubernetes/community/blob/master/s
16521665
-->
16531666
CSI 和 FlexVolume 都允许独立于 Kubernetes 代码库开发卷插件,并作为扩展部署(安装)在 Kubernetes 集群上。
16541667

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)。
16571670

16581671
### CSI
16591672

@@ -1778,7 +1791,7 @@ persistent volume:
17781791
该映射必须与 CSI 驱动程序返回的 `CreateVolumeResponse` 中的 `volume.attributes`
17791792
字段的映射相对应;
17801793
[CSI 规范](https://github.com/container-storage-interface/spec/blob/master/spec.md#createvolume)中有相应的定义。
1781-
该映射通过`ControllerPublishVolumeRequest`、`NodeStageVolumeRequest`
1794+
该映射通过`ControllerPublishVolumeRequest`、`NodeStageVolumeRequest`
17821795
`NodePublishVolumeRequest` 中的 `volume_context` 字段传递给 CSI 驱动。
17831796

17841797
<!--
@@ -1912,7 +1925,7 @@ stand-alone binary that needs to be pre-installed on each Windows node.
19121925
For more details, refer to the deployment guide of the CSI plugin you wish to deploy.
19131926
-->
19141927
CSI 节点插件需要执行多种特权操作,例如扫描磁盘设备和挂载文件系统等。
1915-
这些操作在每个宿主操作系统上都是不同的。对于 Linux 工作节点而言,容器化的 CSI
1928+
这些操作在每个宿主机操作系统上都是不同的。对于 Linux 工作节点而言,容器化的 CSI
19161929
节点插件通常部署为特权容器。对于 Windows 工作节点而言,容器化 CSI
19171930
节点插件的特权操作是通过 [csi-proxy](https://github.com/kubernetes-csi/csi-proxy)
19181931
来支持的。csi-proxy 是一个由社区管理的、独立的可执行二进制文件,
@@ -1986,7 +1999,7 @@ The following FlexVolume [plugins](https://github.com/Microsoft/K8s-Storage-Plug
19861999
deployed as PowerShell scripts on the host, support Windows nodes:
19872000
-->
19882001
下面的 FlexVolume [插件](https://github.com/Microsoft/K8s-Storage-Plugins/tree/master/flexvolume/windows)
1989-
以 PowerShell 脚本的形式部署在宿主系统上,支持 Windows 节点:
2002+
以 PowerShell 脚本的形式部署在宿主机系统上,支持 Windows 节点:
19902003

19912004
* [SMB](https://github.com/microsoft/K8s-Storage-Plugins/tree/master/flexvolume/windows/plugins/microsoft.com~smb.cmd)
19922005
* [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:
20342047
cri-dockerd (Docker) is known to choose `rslave` mount propagation when the
20352048
mount source contains the Docker daemon's root directory (`/var/lib/docker`).
20362049
-->
2037-
20382050
* `None` - 此卷挂载将不会感知到主机后续在此卷或其任何子目录上执行的挂载变化。
2039-
类似的,容器所创建的卷挂载在主机上是不可见的。这是默认模式。
2051+
类似的,容器所创建的卷挂载在主机上是不可见的。这是默认模式。
20402052

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` 挂载传播选项。
20432055

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` 挂载传播选项。
20482059

20492060
<!--
20502061
* `HostToContainer` - This volume mount will receive all subsequent mounts
@@ -2084,7 +2095,7 @@ in `Container.volumeMounts`. Its values are:
20842095
* `Bidirectional` - 这种卷挂载和 `HostToContainer` 挂载表现相同。
20852096
另外,容器创建的卷挂载将被传播回至主机和使用同一卷的所有 Pod 的所有容器。
20862097

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) 中描述的
20882099
`rshared` 挂载传播选项。
20892100

20902101
{{< warning >}}
@@ -2101,36 +2112,6 @@ in `Container.volumeMounts`. Its values are:
21012112
此外,由 Pod 中的容器创建的任何卷挂载必须在终止时由容器销毁(卸载)。
21022113
{{< /warning >}}
21032114

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-
21342115
## {{% heading "whatsnext" %}}
21352116

21362117
<!--

0 commit comments

Comments
 (0)