diff --git a/content/zh-cn/docs/tasks/configure-pod-container/configure-persistent-volume-storage.md b/content/zh-cn/docs/tasks/configure-pod-container/configure-persistent-volume-storage.md index 5f58596b59..feec46cea8 100644 --- a/content/zh-cn/docs/tasks/configure-pod-container/configure-persistent-volume-storage.md +++ b/content/zh-cn/docs/tasks/configure-pod-container/configure-persistent-volume-storage.md @@ -27,17 +27,17 @@ PersistentVolume. 1. You create a Pod that uses the above PersistentVolumeClaim for storage. --> -本文将向你介绍如何配置 Pod 使用 +本文将向你介绍如何配置 Pod 使用 {{< glossary_tooltip text="PersistentVolumeClaim" term_id="persistent-volume-claim" >}} 作为存储。 以下是该过程的总结: -1. 你作为集群管理员创建由物理存储支持的 PersistentVolume。你不会将卷与任何 Pod 关联。 +1. 你作为集群管理员创建由物理存储支持的 PersistentVolume。你不会将该卷与任何 Pod 关联。 1. 你现在以开发人员或者集群用户的角色创建一个 PersistentVolumeClaim, 它将自动绑定到合适的 PersistentVolume。 -1. 你创建一个使用 PersistentVolumeClaim 作为存储的 Pod。 +1. 你创建一个使用以上 PersistentVolumeClaim 作为存储的 Pod。 ## {{% heading "prerequisites" %}} @@ -56,8 +56,8 @@ do not already have a single-node cluster, you can create one by using {{< glossary_tooltip text="kubectl" term_id="kubectl" >}} 命令行工具以便与集群交互。 如果还没有单节点集群,可以使用 [Minikube](https://minikube.sigs.k8s.io/docs/) 创建一个。 -. -* 熟悉[持久卷](/zh-cn/docs/concepts/storage/persistent-volumes/)中的材料。 + +* 熟悉[持久卷](/zh-cn/docs/concepts/storage/persistent-volumes/)文档。 @@ -70,7 +70,7 @@ can open a shell to your Node by entering `minikube ssh`. In your shell on that Node, create a `/mnt/data` directory: --> -## 在你的节点上创建一个 index.html 文件 +## 在你的节点上创建一个 index.html 文件 {#create-an-index-file-on-your-node} 打开集群中的某个节点的 Shell。 如何打开 Shell 取决于集群的设置。 @@ -106,8 +106,7 @@ If your Node uses a tool for superuser access other than `sudo`, you can usually make this work if you replace `sudo` with the name of the other tool. --> {{< note >}} -如果你的节点使用某工具而不是 `sudo` 来完成超级用户访问,你可以将上述命令 -中的 `sudo` 替换为该工具的名称。 +如果你的节点使用某工具而不是 `sudo` 来完成超级用户访问,你可以将上述命令中的 `sudo` 替换为该工具的名称。 {{< /note >}} @@ -139,7 +139,7 @@ In this exercise, you create a *hostPath* PersistentVolume. Kubernetes supports hostPath for development and testing on a single-node cluster. A hostPath PersistentVolume uses a file or directory on the Node to emulate network-attached storage. --> -## 创建 PersistentVolume +## 创建 PersistentVolume {#create-a-pv} 在本练习中,你将创建一个 **hostPath** 类型的 PersistentVolume。 Kubernetes 支持用于在单节点集群上开发和测试的 hostPath 类型的 PersistentVolume。 @@ -149,7 +149,7 @@ hostPath 类型的 PersistentVolume 使用节点上的文件或目录来模拟 In a production cluster, you would not use hostPath. Instead a cluster administrator would provision a network resource like a Google Compute Engine persistent disk, an NFS share, or an Amazon Elastic Block Store volume. Cluster administrators can also -use [StorageClasses](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#storageclass-v1-storage) +use [StorageClasses](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#storageclass-v1-storage-k8s-io) to set up [dynamic provisioning](/blog/2016/10/dynamic-provisioning-and-storage-in-kubernetes). @@ -158,7 +158,7 @@ Here is the configuration file for the hostPath PersistentVolume: 在生产集群中,你不会使用 hostPath。 集群管理员会提供网络存储资源,比如 Google Compute Engine 持久盘卷、NFS 共享卷或 Amazon Elastic Block Store 卷。 集群管理员还可以使用 -[StorageClasses](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#storageclass-v1-storage) +[StorageClasses](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#storageclass-v1-storage-k8s-io) 来设置[动态提供存储](/blog/2016/10/dynamic-provisioning-and-storage-in-kubernetes)。 下面是 hostPath PersistentVolume 的配置文件: @@ -173,13 +173,12 @@ read-write by a single Node. It defines the [StorageClass name](/docs/concepts/s `manual` for the PersistentVolume, which will be used to bind PersistentVolumeClaim requests to this PersistentVolume. --> -配置文件指定卷位于集群节点上的 `/mnt/data` 路径。 -配置还指定了卷的容量大小为 10 GB, -访问模式为 `ReadWriteOnce`, +此配置文件指定卷位于集群节点上的 `/mnt/data` 路径。 +其配置还指定了卷的容量大小为 10 GB,访问模式为 `ReadWriteOnce`, 这意味着该卷可以被单个节点以读写方式安装。 -配置文件还在 PersistentVolume 中定义了 -[StorageClass 的名称](/zh-cn/docs/concepts/storage/persistent-volumes/#class) -为 `manual`。它将用于将 PersistentVolumeClaim 的请求绑定到此 PersistentVolume。 +此配置文件还在 PersistentVolume 中定义了 +[StorageClass 的名称](/zh-cn/docs/concepts/storage/persistent-volumes/#class)为 `manual`。 +它将用于将 PersistentVolumeClaim 的请求绑定到此 PersistentVolume。 -输出结果显示该 PersistentVolume 的`状态(STATUS)` 为 `Available`。 +输出结果显示该 PersistentVolume 的`状态(STATUS)`为 `Available`。 这意味着它还没有被绑定给 PersistentVolumeClaim。 - NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE - task-pv-volume 10Gi RWO Retain Available manual 4s +``` +NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE +task-pv-volume 10Gi RWO Retain Available manual 4s +``` -## 创建 PersistentVolumeClaim +## 创建 PersistentVolumeClaim {#create-a-pvc} 下一步是创建一个 PersistentVolumeClaim。 Pod 使用 PersistentVolumeClaim 来请求物理存储。 @@ -294,11 +295,11 @@ The next step is to create a Pod that uses your PersistentVolumeClaim as a volum Here is the configuration file for the Pod: --> -## 创建 Pod +## 创建 Pod {#create-a-pod} -下一步是创建一个 Pod, 该 Pod 使用你的 PersistentVolumeClaim 作为存储卷。 +下一步是创建一个使用你的 PersistentVolumeClaim 作为存储卷的 Pod。 -下面是 Pod 的 配置文件: +下面是此 Pod 的配置文件: {{< codenew file="pods/storage/pv-pod.yaml" >}} @@ -340,7 +341,7 @@ kubectl exec -it task-pv-pod -- /bin/bash In your shell, verify that nginx is serving the `index.html` file from the hostPath volume: --> -在 Shell 中,验证 nginx 是否正在从 hostPath 卷提供 `index.html` 文件: +在 Shell 中,验证 Nginx 是否正在从 hostPath 卷提供 `index.html` 文件: -## 在两个地方挂载相同的 persistentVolume +## 在两个地方挂载相同的 persistentVolume {#mounting-the-same-pv-in-two-places} {{< codenew file="pods/storage/pv-duplicate.yaml" >}} @@ -449,6 +450,7 @@ GID 不匹配或缺失将会导致无权访问错误。 这样 GID 就能自动添加到使用 PersistentVolume 的任何 Pod 中。 使用 `pv.beta.kubernetes.io/gid` 注解的方法如下所示: + ```yaml apiVersion: v1 kind: PersistentVolume @@ -468,8 +470,7 @@ each container. --> 当 Pod 使用带有 GID 注解的 PersistentVolume 时,注解的 GID 会被应用于 Pod 中的所有容器, 应用的方法与 Pod 的安全上下文中指定的 GID 相同。 -每个 GID,无论是来自 PersistentVolume 注解还是来自 Pod 规约,都会被应用于每个容器中 -运行的第一个进程。 +每个 GID,无论是来自 PersistentVolume 注解还是来自 Pod 规约,都会被应用于每个容器中运行的第一个进程。