設定 Filestore 代理程式磁碟區

無論您打算在 Google Kubernetes Engine (GKE) 部署工作負載,還是使用自己的自動化調度管理架構,都必須先完成一次性專案設定,才能建立磁碟區集區或佈建磁碟區。這項設定包括啟用必要 API、授予 IAM 角色、初始化 Filestore 服務代理,以及使用 Private Service Connect (PSC) 設定虛擬私有雲 (VPC) 網路。

建立專案並啟用 API

  1. In the Cloud de Confiance console, on the project selector page, select or create a Cloud de Confiance 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  2. 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.

  3. Verify that billing is enabled for your Cloud de Confiance project.

  4. Enable the Filestore APIs, if any are not already enabled.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. 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.

    Enable the APIs

必要的角色

如要取得設定 Filestore 代理磁碟區所需的權限,請要求管理員在專案中授予您下列 IAM 角色:

  • 設定服務連線政策和虛擬私有雲網路:Compute 網路管理員 (roles/compute.networkAdmin)
  • 查看及管理 Filestore 執行個體和相關資源,包括磁碟區集區和代理磁碟區:Cloud Filestore 編輯者 (roles/file.editor)

如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。

您或許也能透過自訂角色或其他預先定義的角色,取得必要權限。

初始化服務代理

如果您尚未在專案中建立 Filestore 執行個體,請執行下列指令,初始化 Filestore 服務代理:

gcloud beta services identity create \
    --service=file.googleapis.com \
    --project=PROJECT_ID

將 PROJECT_ID 替換為 Cloud de Confiance專案 ID。

將權限授予服務代理

如要設定 Filestore 代理磁碟區,請將 Cloud Filestore 編輯者 (roles/file.editor) 角色授予 Filestore 服務代理:

gcloud projects add-iam-policy-binding PROJECT_ID \
    --member="serviceAccount:service-PROJECT_NUMBER@cloud-filer.s3ns-system.iam.gserviceaccount.com" \
    --role="roles/file.editor"

更改下列內容:

  • PROJECT_ID: Cloud de Confiance 專案的 ID。
  • PROJECT_NUMBER:Cloud de Confiance 專案的專案編號。

設定 Private Service Connect 網路

Filestore 代理磁碟區會使用 Private Service Connect,將代管儲存空間基礎架構直接連至虛擬私有雲網路。Private Service Connect 可確保私密、高頻寬和低延遲的通訊,不需要公開 IP 位址或虛擬私有雲網路對接設定。

如要建立服務連線政策,請執行下列指令:

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: Cloud de Confiance 專案的 ID。
  • REGION:磁碟區集區和工作負載所在的區域,例如 us-central1。
  • VPC_NETWORK:現有虛擬私有雲網路的名稱。
  • SUBNET_NAME:指定區域中一般虛擬私有雲子網路的名稱,Private Service Connect 端點 IP 位址會分配到該子網路。舉例來說,您可以使用預設子網路,並將 --purpose 旗標設為 PRIVATE。

建立磁碟區集區

建立及管理磁碟區集區,預留共用的區域容量和 IOPS。

選擇自動化調度管理路徑