为 NAS 工作负载配置 Google Cloud NetApp Volumes
您可以将 Google Cloud NetApp Volumes 配置为 Trident 的后端,以配置基于文件的存储卷。Trident 可以使用 Google Cloud NetApp Volumes 后端连接 NFS 和 SMB 卷。
Trident 在 Google Cloud NetApp Volumes 中为 NAS 和 SAN 工作负载使用不同的后端。该 google-cloud-netapp-volumes 后端仅支持基于文件的协议,无法用于配置 iSCSI 卷。
要配置 iSCSI 块卷,请使用 `google-cloud-netapp-volumes-san`后端,这是专门为 SAN 工作负载设计的单独后端类型。
NAS 卷和 iSCSI 块卷
Google Cloud NetApp Volumes 同时支持 NAS 和块存储,这在应用程序访问和管理数据的方式上有所不同。
NAS 卷提供基于文件的存储,可通过 NFS 或 SMB 等标准文件协议进行访问。卷被装载为共享文件系统,并支持从多个 pod 或节点进行并发访问。
iSCSI 块卷提供原始块存储,并作为连接到 Kubernetes 节点的块设备进行访问。当工作负载需要块级访问或应用程序管理的 I/O 行为时,通常使用块存储。
这适用于以下环境:
-
Trident 26.02 及更高版本
-
Google Kubernetes Engine ( GKEE )
-
Google Cloud NetApp Volumes NAS 池
-
NFS 和 SMB 工作负载
有关块 (iSCSI) 工作负载,请参见 配置块存储 (iSCSI)。
Google Cloud NetApp卷驱动程序详细信息
Trident 提供 google-cloud-netapp-volumes 驱动程序,用于从 Google Cloud NetApp Volumes 配置 NAS 存储。
驱动程序支持以下访问模式:
-
ReadWriteOnce(RWO)
-
ReadOnlyMany(ROX)
-
ReadWriteMany(RWX)
-
ReadWriteOncePod(RWOP)
| 驱动程序 | 协议 | 卷模式 | 支持的访问模式 | 支持的文件系统 |
|---|---|---|---|---|
|
NFS SMB |
文件系统 |
Rwo、ROX、rwx、RWOP |
|
Google Kubernetes Engine 的云身份
云身份使 Kubernetes 工作负载能够通过作为工作负载身份进行身份验证而不是使用静态 Google Cloud 凭据来访问 Google Cloud 资源。
要在 Google Cloud NetApp Volumes 中使用云标识,必须具有:
-
使用 Google Kubernetes Engine (GKE) 部署的 Kubernetes 集群
-
已在 GKE 群集上启用工作负载标识,已在节点池上启用元数据服务器
-
具有 Google Cloud NetApp Volumes Admin 角色(
roles/netapp.admin)的 Google Cloud 服务帐户或同等自定义角色 -
安装 Trident 时,云提供商设置为 `GCP`并配置了云身份注释
要使用 Trident 操作员安装 Trident,请编辑 `tridentorchestrator_cr.yaml`以将 `cloudProvider`设置为 `GCP`并将 `cloudIdentity`设置为 GKE 服务帐户。
apiVersion: trident.netapp.io/v1
kind: TridentOrchestrator
metadata:
name: trident
spec:
namespace: trident
cloudProvider: "GCP"
cloudIdentity: "iam.gke.io/gcp-service-account: cloudvolumes-admin-sa@mygcpproject.iam.gserviceaccount.com"
使用 Helm 安装 Trident 时设置云提供商和云标识。
helm install trident trident-operator-100.6.0.tgz \ --set cloudProvider=GCP \ --set cloudIdentity="iam.gke.io/gcp-service-account: cloudvolumes-admin-sa@mygcpproject.iam.gserviceaccount.com"
通过指定云提供商和云身份来安装 Trident。
tridentctl install \ --cloud-provider=GCP \ --cloud-identity="iam.gke.io/gcp-service-account: cloudvolumes-admin-sa@mygcpproject.iam.gserviceaccount.com" \ -n trident
配置 Trident NAS 后端
apiVersion: trident.netapp.io/v1
kind: TridentBackendConfig
metadata:
name: gcnv-nas
namespace: trident
spec:
version: 1
storageDriverName: google-cloud-netapp-volumes
projectNumber: "<project-number>"
location: "<region>"
sdkTimeout: "600"
storage:
- labels:
cloud: gcp
network: "<vpc-network>"
配置 NAS 卷
NAS 卷使用 `google-cloud-netapp-volumes`后端进行调配,并支持 NFS 和 SMB 协议。
StorageClass 适用于 NFS 卷
要配置 NFS 卷,请将 nasType`设置为 `nfs。
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: gcnv-nfs
provisioner: csi.trident.netapp.io
parameters:
backendType: "google-cloud-netapp-volumes"
trident.netapp.io/nasType: "nfs"
allowVolumeExpansion: true
StorageClass 适用于 SMB 卷
使用 nasType、 csi.storage.k8s.io/node-stage-secret-name`和
`csi.storage.k8s.io/node-stage-secret-namespace,可以指定 SMB 卷并提供所需的 Active Directory 凭据。
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: gcnv-smb
provisioner: csi.trident.netapp.io
parameters:
backendType: "google-cloud-netapp-volumes"
trident.netapp.io/nasType: "smb"
csi.storage.k8s.io/node-stage-secret-name: "smbcreds"
csi.storage.k8s.io/node-stage-secret-namespace: "default"
allowVolumeExpansion: true
PersistentVolumeClaim 示例 (RWX)
NAS 卷支持并发访问,通常使用
ReadWriteMany 进行调配。
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gcnv-nas-rwx
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Gi
storageClassName: gcnv-nfs
PersistentVolumeClaim 示例 (RWO)
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gcnv-nas-rwo
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Gi
storageClassName: gcnv-nfs
|
|
NAS 卷使用 volumeMode: Filesystem。
|