設定多專案

本教學課程說明如何在多專案設定中使用二進位授權。如要簡化單一專案的設定,請參閱「開始使用 Google Cloud CLI (GKE)」。

如要建立權責劃分,您可以在多專案設定中設定二進位授權。本教學課程稍後會說明每個專案的用途。

目標

在本教學課程中,您將執行下列工作:

  1. 為部署作業 (GKE)、驗證者和驗證管理設定不同的專案,以支援職責分離

  2. 設定二進位授權政策的預設規則,要求進行認證。

  3. 建立公開金鑰基礎架構 (X.509) (PKIX) 金鑰組,用於簽署驗證資料,並在稍後驗證。

  4. 建立驗證者,供二進位授權執行者用來驗證認證。

  5. 簽署範例圖片,建立驗證。

  6. 部署範例圖片來測試政策。

您必須透過 Identity and Access Management (IAM),為每個專案設定適當的存取控管。

如要進一步提升安全性,可以使用 VPC Service Controls 保護在本教學課程中建立的資源。詳情請參閱「使用 VPC Service Controls 確保安全」。

費用

在本文件中,您會使用下列 Google Cloud的計費元件:

如要根據預測用量估算費用,請使用 Pricing Calculator

初次使用 Google Cloud 的使用者可能符合免費試用期資格。

事前準備

  1. 登入 Google Cloud 帳戶。如果您是 Google Cloud新手,歡迎 建立帳戶,親自評估產品在實際工作環境中的成效。新客戶還能獲得價值 $300 美元的免費抵免額,可用於執行、測試及部署工作負載。
  2. 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. 安裝 Google Cloud CLI。

  5. 若您採用的是外部識別資訊提供者 (IdP),請先使用聯合身分登入 gcloud CLI

  6. 執行下列指令,初始化 gcloud CLI:

    gcloud init
  7. 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  8. Verify that billing is enabled for your Google Cloud project.

  9. 安裝 Google Cloud CLI。

  10. 若您採用的是外部識別資訊提供者 (IdP),請先使用聯合身分登入 gcloud CLI

  11. 執行下列指令,初始化 gcloud CLI:

    gcloud init
  12. 安裝 kubectl,以便與 GKE 互動。

設定部署者專案