在创建卷池或预配卷之前,无论您是计划在 Google Kubernetes Engine (GKE) 上部署工作负载,还是使用自己的编排框架,都必须完成一次性项目设置,以启用所需的 API、授予 IAM 角色、初始化 Filestore 服务代理,并使用 Private Service Connect (PSC) 配置虚拟私有云 (VPC) 网络。
创建项目并启用 API
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Filestore APIs, if any are not already enabled.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.
所需的角色
如需获得设置 Filestore 智能体存储卷所需的权限,请让管理员向您授予项目的以下 IAM 角色:
-
配置服务连接政策和 VPC 网络:Compute Network Admin (
roles/compute.networkAdmin) -
查看和管理 Filestore 实例及相关资源,包括存储卷池和智能体存储卷:
Cloud Filestore Editor (
roles/file.editor)
如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限。
初始化服务代理
如果您尚未在项目中创建 Filestore 实例,请运行以下命令来初始化 Filestore 服务代理:
gcloud beta services identity create \
--service=file.googleapis.com \
--project=PROJECT_ID
将 PROJECT_ID 替换为您的 Google Cloud项目的 ID。
向服务代理授予权限
如需设置 Filestore 智能体存储卷,请向 Filestore 服务代理授予 Cloud Filestore Editor (roles/file.editor) 角色:
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="serviceAccount:service-PROJECT_NUMBER@cloud-filer." \
--role="roles/file.editor"
替换以下内容:
PROJECT_ID:您的 Google Cloud 项目的 ID。PROJECT_NUMBER:您的Google Cloud 项目的项目编号。
配置 Private Service Connect 网络
Filestore 智能体存储卷使用 Private Service Connect 将托管式存储基础设施直接连接到您的 VPC 网络。Private Service Connect 可确保私密、高带宽和低延迟通信,而无需公共 IP 地址或 VPC 网络对等互连配置。
如需创建服务连接政策,请运行以下命令:
gcloud network-connectivity service-connection-policies create POLICY_NAME \
--project=PROJECT_ID \
--region=REGION \
--network=projects/PROJECT_ID/global/networks/VPC_NETWORK \
--subnets=SUBNET_NAME \
--service-class=google-cloud-filestore
替换以下内容:
POLICY_NAME:服务连接政策的名称,例如filestore-agent-psc-policy。PROJECT_ID:您的 Google Cloud 项目的 ID。REGION:卷池和工作负载所在的区域,例如us-central1。VPC_NETWORK:现有 VPC 网络的名称。SUBNET_NAME:指定区域中分配了 Private Service Connect 端点 IP 地址的常规 VPC 子网的名称。例如,您可以使用--purpose标志设置为PRIVATE的默认子网。
创建卷池
创建和管理卷池,以预留共享的区域级容量和 IOPS。
选择编排路径
- 为 Filestore 智能体存储卷设置 GKE 环境,以使用 Filestore CSI 驱动程序自动预配和装载存储卷。
- 将 Filestore 卷与编排框架搭配使用,以直接预配、克隆、分层和管理各个卷。