跳转到主内容

使用 Trident CSI 驱动程序时,增加支持 Kubernetes 永久卷(PV)(ext4 或 XFS)的文件系统大小的最佳实践是什么?

Views:
38
Visibility:
Public
Votes:
0
Category:
trident-kubernetes
Specialty:
snapx
Last Updated:

适用于

  • NetApp Trident CSI 驱动程序(所有支持的版本)
  • Kubernetes(包括 K3s、OpenShift 和其他支持的发行版)
  • 通过 Trident 使用 fsType ext4 或 XFS 配置的持久卷

回答

通过 Trident CSI 自动调整文件系统大小:

当您需要增加由 Trident(使用 ext4 或 XFS)支持的 Kubernetes PV 的大小时,Trident CSI 驱动程序会将此过程完全自动化,作为 CSI 卷扩展工作流程的一部分。以下最佳实践适用:

  1. StorageClass 配置:
    确保您的 StorageClass 已 allowVolumeExpansion: true 设置。示例:

    apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: ontap-san provisioner: csi.trident.netapp.io parameters: backendType: "ontap-san" fsType: "xfs" # or "ext4" allowVolumeExpansion: true
  2. PVC 必须挂载:
    在调整大小请求时,PVC 必须处于使用中状态(由正在运行的 Pod 挂载)。

  3. 调整大小工作流程:
    当您编辑 PVC 并增加请求的存储大小时,Trident 将自动执行以下操作:

    • 展开 ONTAP 上的 LUN/命名空间。
    • 重新扫描工作节点上的块设备。
    • 在挂载的文件系统上运行 xfs_growfs (对于 XFS)或 resize2fs (对于 ext4)。

    只要 PVC 连接到运行中的 Pod,就无需手动干预或重新启动 Pod。 

    相关日志输出:
    在 Trident 控制器日志中,您将看到类似以下的条目:
    Expanding volume ...
    Filesystem resize successful for device /dev/sdX using xfs_growfs

    Filesystem resize successful for device /dev/sdX using resize2fs

  4. 参考:

追加信息

如果在调整大小请求时未挂载 PVC,Trident 无法扩展文件系统(只有块设备将被调整大小)。要完成文件系统大小调整:

  • 将 PVC 连接到正在运行的 Pod 并重新挂载。Trident 将检测待处理的大小调整并自动执行文件系统扩展。

 

NetApp provides no representations or warranties regarding the accuracy or reliability or serviceability of any information or recommendations provided in this publication or with respect to any results that may be obtained by the use of the information or observance of any recommendations provided herein. The information in this document is distributed AS IS and the use of this information or the implementation of any recommendations or techniques herein is a customer's responsibility and depends on the customer's ability to evaluate and integrate them into the customer's operational environment. This document and the information contained herein may be used solely in connection with the NetApp products discussed in this document.