为 Google Cloud 后端配置Cloud Volumes Service
了解如何使用提供的示例配置,将NetApp Cloud Volumes Service for Google Cloud 配置为Trident安装的后端。
Google Cloud 驱动程序详情
Trident提供 `gcp-cvs`驱动程序与集群通信。支持的访问模式有:ReadWriteOnce (RWO)、ReadOnlyMany (ROX)、ReadWriteMany (RWX)、ReadWriteOncePod (RWOP)。
| 驱动程序 | 协议 | 音量模式 | 支持的访问模式 | 支持的文件系统 |
|---|---|---|---|---|
|
NFS |
Filesystem |
RWO、ROX、RWX、RWOP |
|
了解Trident对 Google Cloud Cloud Volumes Service 的支持
Trident可以在以下两种格式之一中创建Cloud Volumes Service卷:"服务类型" :
-
CVS-Performance: Trident 的默认服务类型。这种性能优化型服务类型最适合重视性能的生产工作负载。 CVS-Performance 服务类型是一种硬件选项,支持最小 100 GiB 大小的卷。您可以选择其中之一"三个服务级别":
-
standard -
premium -
extreme
-
-
CVS:CVS 服务类型提供较高的区域可用性,但性能水平有限或中等。 CVS 服务类型是一种软件选项,它使用存储池来支持小至 1 GiB 的卷。存储池最多可包含 50 个卷,所有卷共享池的容量和性能。您可以选择其中之一"两种服务级别":
-
standardsw -
zoneredundantstandardsw
-
配置和使用 "适用于 Google Cloud 的Cloud Volumes Service"后端需要以下组件:
-
已配置NetApp Cloud Volumes Service的 Google Cloud 帐户
-
您的 Google Cloud 帐户的项目编号
-
拥有 Google Cloud 服务帐户 `netappcloudvolumes.admin`角色
-
您的Cloud Volumes Service帐户的 API 密钥文件
后端配置选项
每个后端都在单个 Google Cloud 区域中配置卷。要在其他区域创建卷,您可以定义其他后端。
| 参数 | 描述 | 默认 |
|---|---|---|
|
始终为 1 |
|
|
存储驱动程序的名称 |
"gcp-cvs" |
|
自定义名称或存储后端 |
驱动程序名称 + "_" + API 密钥的一部分 |
|
用于指定 CVS 服务类型的可选参数。使用 |
|
|
仅限CVS服务类型。用于指定卷创建存储池的可选参数。 |
|
|
Google Cloud 帐户项目编号。该值可在 Google Cloud 门户网站首页找到。 |
|
|
如果使用共享 VPC 网络,则必须执行此操作。在这种情况下, `projectNumber`这是一个服务项目,而且 `hostProjectNumber`是宿主项目。 |
|
|
Trident创建Cloud Volumes Service卷的 Google Cloud 区域。创建跨区域 Kubernetes 集群时,在以下位置创建的卷: `apiRegion`可用于跨多个 Google Cloud 区域的节点上调度的工作负载。跨区域运输会产生额外费用。 |
|
|
用于 Google Cloud 服务帐户的 API 密钥 `netappcloudvolumes.admin`角色。它包含 Google Cloud 服务帐户私钥文件的 JSON 格式内容(原封不动地复制到后端配置文件中)。 |
|
|
如果需要代理服务器才能连接到 CVS 帐户,请提供代理 URL。代理服务器可以是HTTP代理,也可以是HTTPS代理。对于 HTTPS 代理,会跳过证书验证,以允许在代理服务器中使用自签名证书。不支持启用身份验证的代理服务器。 |
|
|
对 NFS 挂载选项进行精细控制。 |
"nfsvers=3" |
|
如果请求的卷大小大于此值,则配置失败。 |
(默认情况下不强制执行) |
|
CVS-Performance 或 CVS 服务级别(适用于新卷)。 CVS-Performance 值是 |
CVS-Performance 默认值为“标准”。 CVS 默认值为“standardsw”。 |
|
Google Cloud 网络用于Cloud Volumes Service卷。 |
“默认” |
|
故障排除时要使用的调试标志。例子, |
无效的 |
|
要启用跨区域访问,您的 StorageClass 定义如下: |
卷配置选项
您可以控制默认卷配置 `defaults`配置文件部分。
| 参数 | 描述 | 默认 |
|---|---|---|
|
新卷的出口规则。必须是以逗号分隔的 IPv4 地址或 IPv4 子网的列表,采用 CIDR 表示法。 |
“0.0.0.0/0” |
|
访问 `.snapshot`目录 |
"false" |
|
快照预留的卷百分比 |
(接受 CVS 默认值 0) |
|
新卷的规模。 CVS-Performance 最低要求为 100 GiB。 CVS 最小容量为 1 GiB。 |
CVS-Performance 服务类型默认为“100GiB”。 CVS 服务类型不设置默认值,但要求至少 1 GiB。 |
CVS-Performance 服务类型示例
以下示例提供了 CVS-Performance 服务类型的示例配置。
示例 1:最小配置
这是使用默认 CVS-Performance 服务类型和默认“标准”服务级别的最小后端配置。
---
version: 1
storageDriverName: gcp-cvs
projectNumber: "012345678901"
apiRegion: us-west2
apiKey:
type: service_account
project_id: my-gcp-project
private_key_id: <id_value>
private_key: |
-----BEGIN PRIVATE KEY-----
<key_value>
-----END PRIVATE KEY-----
client_email: cloudvolumes-admin-sa@my-gcp-project.iam.gserviceaccount.com
client_id: "123456789012345678901"
auth_uri: https://accounts.google.com/o/oauth2/auth
token_uri: https://oauth2.googleapis.com/token
auth_provider_x509_cert_url: https://www.googleapis.com/oauth2/v1/certs
client_x509_cert_url: https://www.googleapis.com/robot/v1/metadata/x509/cloudvolumes-admin-sa%40my-gcp-project.iam.gserviceaccount.com
示例 2:服务级别配置
此示例展示了后端配置选项,包括服务级别和卷默认值。
---
version: 1
storageDriverName: gcp-cvs
projectNumber: '012345678901'
apiRegion: us-west2
apiKey:
type: service_account
project_id: my-gcp-project
private_key_id: "<id_value>"
private_key: |
-----BEGIN PRIVATE KEY-----
<key_value>
-----END PRIVATE KEY-----
client_email: cloudvolumes-admin-sa@my-gcp-project.iam.gserviceaccount.com
client_id: '123456789012345678901'
auth_uri: https://accounts.google.com/o/oauth2/auth
token_uri: https://oauth2.googleapis.com/token
auth_provider_x509_cert_url: https://www.googleapis.com/oauth2/v1/certs
client_x509_cert_url: https://www.googleapis.com/robot/v1/metadata/x509/cloudvolumes-admin-sa%40my-gcp-project.iam.gserviceaccount.com
proxyURL: http://proxy-server-hostname/
nfsMountOptions: vers=3,proto=tcp,timeo=600
limitVolumeSize: 10Ti
serviceLevel: premium
defaults:
snapshotDir: 'true'
snapshotReserve: '5'
exportRule: 10.0.0.0/24,10.0.1.0/24,10.0.2.100
size: 5Ti
示例 3:虚拟池配置
此示例使用 `storage`配置虚拟池和 `StorageClasses`指的是他们。请参阅存储类定义查看存储类的定义方式。
这里为所有虚拟池设置了特定的默认值,这些默认值决定了: snapshotReserve 5%和 exportRule`至 0.0.0.0/0。虚拟池在以下位置定义: `storage`部分。每个虚拟池都定义了自己的规则。 `serviceLevel`并且有些池会覆盖默认值。虚拟池标签用于根据以下因素区分池子: `performance`和 `protection。
---
version: 1
storageDriverName: gcp-cvs
projectNumber: '012345678901'
apiRegion: us-west2
apiKey:
type: service_account
project_id: my-gcp-project
private_key_id: "<id_value>"
private_key: |
-----BEGIN PRIVATE KEY-----
<key_value>
-----END PRIVATE KEY-----
client_email: cloudvolumes-admin-sa@my-gcp-project.iam.gserviceaccount.com
client_id: '123456789012345678901'
auth_uri: https://accounts.google.com/o/oauth2/auth
token_uri: https://oauth2.googleapis.com/token
auth_provider_x509_cert_url: https://www.googleapis.com/oauth2/v1/certs
client_x509_cert_url: https://www.googleapis.com/robot/v1/metadata/x509/cloudvolumes-admin-sa%40my-gcp-project.iam.gserviceaccount.com
nfsMountOptions: vers=3,proto=tcp,timeo=600
defaults:
snapshotReserve: '5'
exportRule: 0.0.0.0/0
labels:
cloud: gcp
region: us-west2
storage:
- labels:
performance: extreme
protection: extra
serviceLevel: extreme
defaults:
snapshotDir: 'true'
snapshotReserve: '10'
exportRule: 10.0.0.0/24
- labels:
performance: extreme
protection: standard
serviceLevel: extreme
- labels:
performance: premium
protection: extra
serviceLevel: premium
defaults:
snapshotDir: 'true'
snapshotReserve: '10'
- labels:
performance: premium
protection: standard
serviceLevel: premium
- labels:
performance: standard
serviceLevel: standard
存储类定义
以下 StorageClass 定义适用于虚拟池配置示例。使用 `parameters.selector`您可以为每个 StorageClass 指定用于托管卷的虚拟池。该卷将具有所选池中定义的方面。
存储类示例
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: cvs-extreme-extra-protection
provisioner: csi.trident.netapp.io
parameters:
selector: performance=extreme; protection=extra
allowVolumeExpansion: true
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: cvs-extreme-standard-protection
provisioner: csi.trident.netapp.io
parameters:
selector: performance=premium; protection=standard
allowVolumeExpansion: true
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: cvs-premium-extra-protection
provisioner: csi.trident.netapp.io
parameters:
selector: performance=premium; protection=extra
allowVolumeExpansion: true
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: cvs-premium
provisioner: csi.trident.netapp.io
parameters:
selector: performance=premium; protection=standard
allowVolumeExpansion: true
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: cvs-standard
provisioner: csi.trident.netapp.io
parameters:
selector: performance=standard
allowVolumeExpansion: true
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: cvs-extra-protection
provisioner: csi.trident.netapp.io
parameters:
selector: protection=extra
allowVolumeExpansion: true
-
第一个存储类(
cvs-extreme-extra-protection) 映射到第一个虚拟池。这是唯一一个提供极致性能且快照储备为 10% 的存储池。 -
最后一个存储类(
cvs-extra-protection) 调用任何提供 10% 快照保留的存储池。 Trident决定选择哪个虚拟池,并确保满足快照储备要求。
CVS 服务类型示例
以下示例提供了 CVS 服务类型的示例配置。
示例 1:最小配置
这是使用最简后端配置 `storageClass`指定 CVS 服务类型和默认值 `standardsw`服务水平。
---
version: 1
storageDriverName: gcp-cvs
projectNumber: '012345678901'
storageClass: software
apiRegion: us-east4
apiKey:
type: service_account
project_id: my-gcp-project
private_key_id: "<id_value>"
private_key: |
-----BEGIN PRIVATE KEY-----
<key_value>
-----END PRIVATE KEY-----
client_email: cloudvolumes-admin-sa@my-gcp-project.iam.gserviceaccount.com
client_id: '123456789012345678901'
auth_uri: https://accounts.google.com/o/oauth2/auth
token_uri: https://oauth2.googleapis.com/token
auth_provider_x509_cert_url: https://www.googleapis.com/oauth2/v1/certs
client_x509_cert_url: https://www.googleapis.com/robot/v1/metadata/x509/cloudvolumes-admin-sa%40my-gcp-project.iam.gserviceaccount.com
serviceLevel: standardsw
示例 2:存储池配置
此示例后端配置使用 `storagePools`配置存储池。
---
version: 1
storageDriverName: gcp-cvs
backendName: gcp-std-so-with-pool
projectNumber: '531265380079'
apiRegion: europe-west1
apiKey:
type: service_account
project_id: cloud-native-data
private_key_id: "<id_value>"
private_key: |-
-----BEGIN PRIVATE KEY-----
<key_value>
-----END PRIVATE KEY-----
client_email: cloudvolumes-admin-sa@cloud-native-data.iam.gserviceaccount.com
client_id: '107071413297115343396'
auth_uri: https://accounts.google.com/o/oauth2/auth
token_uri: https://oauth2.googleapis.com/token
auth_provider_x509_cert_url: https://www.googleapis.com/oauth2/v1/certs
client_x509_cert_url: https://www.googleapis.com/robot/v1/metadata/x509/cloudvolumes-admin-sa%40cloud-native-data.iam.gserviceaccount.com
storageClass: software
zone: europe-west1-b
network: default
storagePools:
- 1bc7f380-3314-6005-45e9-c7dc8c2d7509
serviceLevel: Standardsw
下一步是什么?
创建后端配置文件后,运行以下命令:
tridentctl create backend -f <backend-file>
如果后端创建失败,则后端配置存在问题。您可以通过运行以下命令查看日志以确定原因:
tridentctl logs
在您发现并纠正配置文件中的问题后,您可以再次运行创建命令。