diff --git a/content/zh-cn/docs/concepts/storage/volumes.md b/content/zh-cn/docs/concepts/storage/volumes.md index 1a158586e3..51a3b29307 100644 --- a/content/zh-cn/docs/concepts/storage/volumes.md +++ b/content/zh-cn/docs/concepts/storage/volumes.md @@ -34,7 +34,7 @@ kubelet 会重新启动容器,但容器会以干净的状态重启。 Kubernetes {{< glossary_tooltip text="卷(Volume)" term_id="volume" >}} 这一抽象概念能够解决这两个问题。 -阅读本文前建议你熟悉一下 [Pod](/zh-cn/docs/concepts/workloads/pods)。 +阅读本文前建议你熟悉一下 [Pod](/zh-cn/docs/concepts/workloads/pods)。 @@ -121,8 +121,6 @@ Kubernetes 支持下列类型的卷: @@ -212,22 +209,20 @@ If the EBS volume is partitioned, you can supply the optional field `partition: --> #### AWS EBS CSI 卷迁移 -{{< feature-state for_k8s_version="v1.17" state="beta" >}} +{{< feature-state for_k8s_version="v1.25" state="stable" >}} 如果启用了对 `awsElasticBlockStore` 的 `CSIMigration` 特性支持,所有插件操作都不再指向树内插件(In-Tree Plugin),转而指向 `ebs.csi.aws.com` 容器存储接口(Container Storage Interface,CSI)驱动。 为了使用此特性,必须在集群中安装 -[AWS EBS CSI 驱动](https://github.com/kubernetes-sigs/aws-ebs-csi-driver), -并确保 `CSIMigration` 和 `CSIMigrationAWS` Beta 功能特性被启用。 +[AWS EBS CSI 驱动](https://github.com/kubernetes-sigs/aws-ebs-csi-driver)。 - 启用 `azureDisk` 的 `CSIMigration` 特性后,所有插件操作从现有的树内插件重定向到 `disk.csi.azure.com` 容器存储接口(CSI)驱动程序。 为了使用此特性,必须在集群中安装 -[Azure 磁盘 CSI 驱动程序](https://github.com/kubernetes-sigs/azuredisk-csi-driver), -并且 `CSIMigration` 特性必须被启用。 +[Azure 磁盘 CSI 驱动程序](https://github.com/kubernetes-sigs/azuredisk-csi-driver)。 @@ -299,8 +288,6 @@ and the kubelet, set the `InTreePluginAzureDiskUnregister` flag to `true`. 启用 `azureFile` 的 `CSIMigration` 特性后,所有插件操作将从现有的树内插件重定向到 `file.csi.azure.com` 容器存储接口(CSI)驱动程序。要使用此特性,必须在集群中安装 [Azure 文件 CSI 驱动程序](https://github.com/kubernetes-sigs/azurefile-csi-driver), -并且 `CSIMigration` 和 `CSIMigrationAzureFile` +并且 `CSIMigrationAzureFile` [特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/) 必须被启用。 @@ -345,8 +332,6 @@ Azure 文件 CSI 驱动尚不支持为同一卷设置不同的 fsgroup。 @@ -416,7 +401,7 @@ metadata: name: test-cinder spec: containers: - - image: k8s.gcr.io/test-webserver + - image: registry.k8s.io/test-webserver name: test-cinder-container volumeMounts: - mountPath: /test-cinder @@ -606,18 +591,15 @@ memory limit. 虽然 tmpfs 速度非常快,但是要注意它与磁盘不同。 tmpfs 在节点重启时会被清除,并且你所写入的所有文件都会计入容器的内存消耗,受容器内存限制约束。 - - -{{< note >}} -当启用 `SizeMemoryBackedVolumes` [特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/) -时,你可以为基于内存提供的卷指定大小。 -如果未指定大小,则基于内存的卷的大小为 Linux 主机上内存的 50%。 +当启用 `SizeMemoryBackedVolumes` [特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)时, +你可以为基于内存提供的卷指定大小。 +如果未指定大小,则基于内存的卷的大小为 Linux 主机上内存的 50%。 {{< /note>}} 更多详情请参考 [FC 示例](https://github.com/kubernetes/examples/tree/master/staging/volumes/fibre_channel)。 - - -### flocker (已弃用) {#flocker} - -[Flocker](https://github.com/ClusterHQ/flocker) 是一个开源的、集群化的容器数据卷管理器。 -Flocker 提供了由各种存储后端所支持的数据卷的管理和编排。 - - -使用 `flocker` 卷可以将一个 Flocker 数据集挂载到 Pod 中。 -如果数据集在 Flocker 中不存在,则需要首先使用 Flocker CLI 或 Flocker API 创建数据集。 -如果数据集已经存在,那么 Flocker 将把它重新附加到 Pod 被调度的节点。 -这意味着数据可以根据需要在 Pod 之间共享。 - - -{{< note >}} -在使用 Flocker 之前你必须先安装运行自己的 Flocker。 -{{< /note >}} - - -更多详情请参考 [Flocker 示例](https://github.com/kubernetes/examples/tree/master/staging/volumes/flocker)。 - -### gcePersistentDisk (deprecated) {#gcepersistentdisk} +### gcePersistentDisk(已弃用) {#gcepersistentdisk} {{< feature-state for_k8s_version="v1.17" state="deprecated" >}} -`gcePersistentDisk` 卷能将谷歌计算引擎 (GCE) [持久盘(PD)](http://cloud.google.com/compute/docs/disks) +`gcePersistentDisk` 卷能将谷歌计算引擎 (GCE) [持久盘(PD)](http://cloud.google.com/compute/docs/disks) 挂载到你的 Pod 中。 不像 `emptyDir` 那样会在 Pod 被删除的同时也会被删除,持久盘卷的内容在删除 Pod 时会被保留,卷只是被卸载了。 @@ -791,7 +733,7 @@ metadata: name: test-pd spec: containers: - - image: k8s.gcr.io/test-webserver + - image: registry.k8s.io/test-webserver name: test-container volumeMounts: - mountPath: /test-pd @@ -871,27 +813,23 @@ spec: --> #### GCE CSI 迁移 {#gce-csi-migration} -{{< feature-state for_k8s_version="v1.17" state="beta" >}} +{{< feature-state for_k8s_version="v1.25" state="stable" >}} 启用 GCE PD 的 `CSIMigration` 特性后,所有插件操作将从现有的树内插件重定向到 -`pd.csi.storage.gke.io` 容器存储接口( CSI )驱动程序。 +`pd.csi.storage.gke.io` 容器存储接口(CSI)驱动程序。 为了使用此特性,必须在集群中上安装 -[GCE PD CSI驱动程序](https://github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver), -并且 `CSIMigration` 和 `CSIMigrationGCE` Beta 特性必须被启用。 +[GCE PD CSI 驱动程序](https://github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver)。 @@ -948,7 +886,12 @@ spec: revision: "22f1d8406d464b0c0874075539c1f2e96c253775" ``` -### glusterfs + +### glusterfs(已弃用) + +{{< feature-state for_k8s_version="v1.25" state="deprecated" >}} -#### hostPath 配置示例: +#### hostPath 配置示例 ```yaml apiVersion: v1 @@ -1085,7 +1028,7 @@ metadata: name: test-pd spec: containers: - - image: k8s.gcr.io/test-webserver + - image: registry.k8s.io/test-webserver name: test-container volumeMounts: - mountPath: /test-pd @@ -1125,7 +1068,7 @@ metadata: spec: containers: - name: test-webserver - image: k8s.gcr.io/test-webserver:latest + image: registry.k8s.io/test-webserver:latest volumeMounts: - mountPath: /var/local/aaa name: mydir @@ -1341,7 +1284,12 @@ details. --> 更多详情请参考[持久卷](/zh-cn/docs/concepts/storage/persistent-volumes/)。 -### portworxVolume {#portworxvolume} + +### portworxVolume(已弃用) {#portworxvolume} + +{{< feature-state for_k8s_version="v1.25" state="deprecated" >}} - 更多详情可以参考 [Portworx 卷](https://github.com/kubernetes/examples/tree/master/staging/volumes/portworx/README.md)。 -### projected (投射) + +#### Portworx CSI 迁移 + +{{< feature-state for_k8s_version="v1.25" state="beta" >}} +已针对 Portworx 添加 `CSIMigration` 特性,但在 Kubernetes 1.23 中默认禁用,因为它处于 Alpha 状态。 +自 v1.25 以来它已进入 Beta 阶段,但默认仍关闭。 +它将所有插件操作不再指向树内插件(In-Tree Plugin),转而指向 +`pxd.portworx.com` 容器存储接口(Container Storage Interface,CSI)驱动。 +[Portworx CSI 驱动程序](https://docs.portworx.com/portworx-install-with-kubernetes/storage-operations/csi/)必须安装在集群上。 +要启用此特性,需在 kube-controller-manager 和 kubelet 中设置 `CSIMigrationPortworx=true`。 + + +### projected (投射) + 投射卷能将若干现有的卷来源映射到同一目录上。更多详情请参考[投射卷](/zh-cn/docs/concepts/storage/projected-volumes/)。 -### quobyte (已弃用) {#quobyte} - - -`quobyte` 卷允许将现有的 [Quobyte](https://www.quobyte.com) 卷挂载到你的 Pod 中。 - - -{{< note >}} -在使用 Quobyte 卷之前,你首先要进行安装 Quobyte 并创建好卷。 -{{< /note >}} - - -Quobyte 支持{{< glossary_tooltip text="容器存储接口(CSI)" term_id="csi" >}}。 -推荐使用 CSI 插件以在 Kubernetes 中使用 Quobyte 卷。 -Quobyte 的 GitHub 项目包含以 CSI 形式部署 Quobyte -的[说明](https://github.com/quobyte/quobyte-csi#quobyte-csi)及使用示例。 - ### rbd 启用 RBD 的 `CSIMigration` 特性后,所有插件操作从现有的树内插件重定向到 `rbd.csi.ceph.com` {{}} 驱动程序。 要使用该特性,必须在集群内安装 -[Ceph CSI 驱动](https://github.com/ceph/ceph-csi),并启用 `CSIMigration` 和 `csiMigrationRBD` +[Ceph CSI 驱动](https://github.com/ceph/ceph-csi),并启用 `csiMigrationRBD` [特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)。 +(请注意,`csiMigrationRBD` 标志已在 v1.24 版本中移除且替换为 `CSIMigrationRBD`。) 更多详情请参考[配置 Secrets](/zh-cn/docs/concepts/configuration/secret/)。 -### storageOS (已弃用) {#storageos} - -`storageos` 卷允许将现有的 [StorageOS](https://www.storageos.com) 卷挂载到你的 Pod 中。 - - -StorageOS 在 Kubernetes 环境中以容器的形式运行,这使得应用能够从 Kubernetes -集群中的任何节点访问本地的或挂接的存储。为应对节点失效状况,可以复制数据。 -若需提高利用率和降低成本,可以考虑瘦配置(Thin Provisioning)和数据压缩。 - - -作为其核心能力之一,StorageOS 为容器提供了可以通过文件系统访问的块存储。 - -StorageOS 容器需要 64 位的 Linux,并且没有其他的依赖关系。 -StorageOS 提供免费的开发者授权许可。 - - -{{< caution >}} -你必须在每个希望访问 StorageOS 卷的或者将向存储资源池贡献存储容量的节点上运行 -StorageOS 容器。有关安装说明,请参阅 [StorageOS 文档](https://docs.storageos.com)。 -{{< /caution >}} - - -以下示例是使用 StorageOS 的 Pod 配置: -```yaml -apiVersion: v1 -kind: Pod -metadata: - labels: - name: redis - role: master - name: test-storageos-redis -spec: - containers: - - name: master - image: kubernetes/redis:v1 - env: - - name: MASTER - value: "true" - ports: - - containerPort: 6379 - volumeMounts: - - mountPath: /redis-master-data - name: redis-data - volumes: - - name: redis-data - storageos: - # `redis-vol01` 卷必须在 StorageOS 中存在,并位于 `default` 名字空间内 - volumeName: redis-vol01 - fsType: ext4 -``` - - - -关于 StorageOS 的进一步信息、动态供应和持久卷申领等等,请参考 -[StorageOS 示例](https://github.com/kubernetes/examples/blob/master/volumes/storageos)。 - -### vsphereVolume(弃用) {#vspherevolume} +### vsphereVolume(已弃用) {#vspherevolume} -当 `vsphereVolume` 的 `CSIMigration` 特性被启用时,所有插件操作都被从树内插件重定向到 -`csi.vsphere.vmware.com` {{< glossary_tooltip text="CSI" term_id="csi" >}} 驱动。 -为了使用此功能特性,必须在集群中安装 -[vSphere CSI 驱动](https://github.com/kubernetes-sigs/vsphere-csi-driver),并启用 -`CSIMigration` 和 `CSIMigrationvSphere` -[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)。 +从 Kubernetes v1.25 开始,针对 `vsphereVolume` 的 `CSIMigrationvSphere` 特性默认被启用。 +来自树内 `vspherevolume` 的所有插件操作将被重新指向到 +`csi.vsphere.vmware.com` {{< glossary_tooltip text="CSI" term_id="csi" >}} 驱动, +除非 `CSIMigrationvSphere` 特性门控被禁用。 +[vSphere CSI 驱动](https://github.com/kubernetes-sigs/vsphere-csi-driver)必须安装到集群上。 你可以在 VMware 的文档页面[迁移树内 vSphere 卷插件到 vSphere 容器存储插件](https://docs.vmware.com/en/VMware-vSphere-Container-Storage-Plug-in/2.0/vmware-vsphere-csp-getting-started/GUID-968D421F-D464-4E22-8127-6CB9FF54423F.html) -中找到有关如何迁移的其他建议。 +中找到有关如何迁移树内 `vsphereVolume` 的其他建议。 + -为了迁移到树外 CSI 驱动程序,Kubernetes v{{< skew currentVersion >}} -要求你使用 vSphere 7.0u2 或更高版本。 -如果你正在运行 v{{< skew currentVersion >}} 以外的 Kubernetes 版本, -请查阅该 Kubernetes 版本的文档。 -如果你正在运行 Kubernetes v{{< skew currentVersion >}} 和旧版本的 vSphere, -请考虑至少升级到 vSphere 7.0u2。 +从 Kubernetes v1.25 开始,(已弃用)树内 vSphere 存储驱动不支持低于 7.0u2 的 vSphere 版本。 +你必须运行 vSphere 7.0u2 或更高版本才能继续使用这个已弃用的驱动,或迁移到替代的 CSI 驱动。 + +如果你正在运行 Kubernetes v{{< skew currentVersion >}},请查阅该 Kubernetes 版本的文档。 {{< note >}} -#### Portworx CSI 迁移 - -{{< feature-state for_k8s_version="v1.23" state="alpha" >}} - - -Kubernetes 1.23 中加入了 Portworx 的 `CSIMigration` 特性,但默认不会启用,因为该特性仍处于 alpha 阶段。 -该特性会将所有的插件操作从现有的树内插件重定向到 -`pxd.portworx.com` 容器存储接口(Container Storage Interface, CSI)驱动程序。 -集群中必须安装 -[Portworx CSI 驱动](https://docs.portworx.com/portworx-install-with-kubernetes/storage-operations/csi/)。 -要启用此特性,请在 kube-controller-manager 和 kubelet 中设置 `CSIMigrationPortworx=true`。 - - ### 使用带有扩展环境变量的 subPath {#using-subpath-expanded-environment} {{< feature-state for_k8s_version="v1.17" state="stable" >}} @@ -1968,8 +1813,7 @@ A `csi` volume can be used in a Pod in three different ways: * through a reference to a [PersistentVolumeClaim](#persistentvolumeclaim) * with a [generic ephemeral volume](/docs/concepts/storage/ephemeral-volumes/#generic-ephemeral-volumes) -* with a [CSI ephemeral volume](/docs/concepts/storage/ephemeral-volumes/#csi-ephemeral-volumes) -if the driver supports that (beta feature) +* with a [CSI ephemeral volume](/docs/concepts/storage/ephemeral-volumes/#csi-ephemeral-volumes) if the driver supports that --> 一旦在 Kubernetes 集群上部署了 CSI 兼容卷驱动程序,用户就可以使用 `csi` 卷类型来挂接、挂载 CSI 驱动所提供的卷。 @@ -1979,7 +1823,7 @@ if the driver supports that (beta feature) * 通过 PersistentVolumeClaim(#persistentvolumeclaim) 对象引用 * 使用[一般性的临时卷](/zh-cn/docs/concepts/storage/ephemeral-volumes/#generic-ephemeral-volumes) * 使用 [CSI 临时卷](/zh-cn/docs/concepts/storage/ephemeral-volumes/#csi-ephemeral-volumes), - 前提是驱动支持这种用法(Beta 特性) + 前提是驱动支持这种用法 -* `nodeStageSecretRef`:对包含敏感信息的 Secret 对象的引用。 - 该信息会传递给 CSI 驱动来完成 CSI `NodeStageVolume` 调用。 +* `nodeExpandSecretRef`:对包含敏感信息的 Secret 对象的引用, + 该信息会传递给 CSI 驱动以完成 CSI `NodeExpandVolume` 调用。 此字段是可选的,如果不需要 Secret,则可能是空的。 如果 Secret 包含多个 Secret 条目,则传递所有 Secret 条目。 + 当你为节点初始化的卷扩展配置 Secret 数据时,kubelet 会通过 `NodeExpandVolume()` 调用将该数据传递给 CSI 驱动。 + 为了使用 `nodeExpandSecretRef` 字段,你的集群应运行 Kubernetes 1.25 或更高版本, + 并且你必须为每个 kube-apiserver 和每个节点上的 kubelet 启用名为 `CSINodeExpandSecret` + 的[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)。 + 在节点初始化的存储大小调整操作期间,你还必须使用支持或需要 Secret 数据的 CSI 驱动。 +* `nodeStageSecretRef`:对包含敏感信息的 Secret 对象的引用, + 该信息会传递给 CSI 驱动以完成 CSI `NodeStageVolume` 调用。 + 此字段是可选的,如果不需要 Secret,则可能是空的。 + 如果 Secret 包含多个 Secret 条目,则传递所有 Secret 条目。 + - #### CSI 原始块卷支持 {#csi-raw-block-volume-support} {{< feature-state for_k8s_version="v1.18" state="stable" >}} @@ -2106,8 +1973,8 @@ in Kubernetes workloads. You can set up your [PersistentVolume/PersistentVolumeClaim with raw block volume support](/docs/concepts/storage/persistent-volumes/#raw-block-volume-support) as usual, without any CSI specific changes. --> -你可以和以前一样,安装自己的 -[带有原始块卷支持的 PV/PVC](/zh-cn/docs/concepts/storage/persistent-volumes/#raw-block-volume-support), +你可以和以前一样, +安装自己的[带有原始块卷支持的 PV/PVC](/zh-cn/docs/concepts/storage/persistent-volumes/#raw-block-volume-support), 采用 CSI 对此过程没有影响。 #### CSI 临时卷 {#csi-ephemeral-volumes} -{{< feature-state for_k8s_version="v1.16" state="beta" >}} +{{< feature-state for_k8s_version="v1.25" state="stable" >}} #### 从树内插件迁移到 CSI 驱动程序 {#migrating-to-csi-drivers-from-in-tree-plugins} -{{< feature-state for_k8s_version="v1.17" state="beta" >}} +{{< feature-state for_k8s_version="v1.25" state="stable" >}} -启用 `CSIMigration` 特性后,针对现有树内插件的操作会被重定向到相应的 CSI 插件(应已安装和配置)。 +`CSIMigration` 特性针对现有树内插件的操作会被定向到相应的 CSI 插件(应已安装和配置)。 因此,操作员在过渡到取代树内插件的 CSI 驱动时,无需对现有存储类、PV 或 PVC(指树内插件)进行任何配置更改。 所支持的操作和特性包括:配备(Provisioning)/删除、挂接(Attach)/解挂(Detach)、 @@ -2201,7 +2068,10 @@ The following in-tree plugins support persistent storage on Windows nodes: * [`gcePersistentDisk`](#gcepersistentdisk) * [`vsphereVolume`](#vspherevolume) -### flexVolume + +### flexVolume(已弃用) {{< feature-state for_k8s_version="v1.23" state="deprecated" >}}