設定負載平衡器的生命週期管理

本文說明如何使用 Certificate Manager (第 2 代),為應用程式負載平衡器設定憑證生命週期管理。

視負載平衡器的屬性和先前設定的憑證設定參數而定,設定負載平衡器憑證的方式不盡相同。Certificate Manager (第 2 代) 介面會偵測並顯示特定負載平衡器可用的設定方法。

可用選項如下:

  1. 設定具備 SSL 憑證的全域負載平衡器。
  2. 使用網路憑證或 Compute SSL 憑證設定區域性負載平衡器。
  3. 設定具備憑證對應組合的全域負載平衡器。
  4. 使用網路憑證設定全域負載平衡器。

事前準備

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

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

  5. Enable the Compute Engine, Certificate Manager, Certificate Authority Service 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

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

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

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

  9. Enable the Compute Engine, Certificate Manager, Certificate Authority Service 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

  10. 確認您已有應用程式負載平衡器,且至少有一個目標 HTTPS Proxy。詳情請參閱「選擇負載平衡器」。

必要的角色

如要取得設定生命週期管理所需的權限,請要求管理員在專案中授予您下列 IAM 角色:

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

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

設定負載平衡器的生命週期

如要設定負載平衡器憑證的生命週期管理,請按照特定負載平衡器設定的步驟操作:

具備 Compute SSL 憑證的全域負載平衡器

  1. 在 Google Cloud 控制台中,前往「Certificate Manager (2nd gen)」(憑證管理工具 (第 2 代))。

    前往「Certificate Manager (2nd gen)」(Certificate Manager (第 2 代))

  2. 在導覽選單中,按一下「Manage Lifecycle」(管理生命週期)。

  3. 按一下「負載平衡」分頁標籤。系統會列出負載平衡器。

  4. 找出負載平衡器,然後按一下切換節點展開資料列,查看相關聯的目標 Proxy。

  5. 按一下目標 Proxy 的名稱。

  6. 按一下「設定生命週期管理」。頁面會顯示與這個目標 Proxy 相關聯的憑證。

  7. 從可用清單中選取憑證。您可以使用自己的憑證,或是 Google 代管的憑證。

  8. 依序點選「其他憑證」和「新增憑證」。

  9. 從可用清單中選取憑證。負載平衡器的每項轉送規則可以額外包含 1 至 14 組憑證。

  10. 按一下「更新」,將變更套用至目標 Proxy。這項操作會更新基礎憑證對應關係,或建立新的憑證對應關係。

具備網路或 SSL 憑證的區域性負載平衡器

  1. 在 Google Cloud 控制台中,前往「Certificate Manager (2nd gen)」(憑證管理工具 (第 2 代))。

    前往「Certificate Manager (2nd gen)」(Certificate Manager (第 2 代))

  2. 在導覽選單中,按一下「Manage Lifecycle」(管理生命週期)。

  3. 按一下「負載平衡」分頁標籤。系統會列出負載平衡器。

  4. 找出負載平衡器,然後按一下切換節點展開資料列,查看相關聯的目標 Proxy。

  5. 按一下目標 Proxy 的名稱。

  6. 按一下「設定生命週期管理」。頁面會顯示與這個目標 Proxy 有效憑證對應組合相關聯的憑證。

  7. 選取存放區類型:「憑證」或「傳統版憑證」。

  8. 按一下「新增憑證」。

  9. 選取現有憑證或建立新憑證。

  10. 輸入新憑證的下列詳細資料:

    • 名稱:這個憑證資源的專屬名稱 (例如 my-lb-cert)。
    • 範圍:選取適當的金鑰發布範圍 (例如 Default)。
    • 憑證類型:自行管理或 Google 代管的憑證類型。
    • 網域名稱:這張憑證涵蓋的網域名稱 (例如 app.example.com)。這個網域必須由您控制。
    • 核發設定:從清單中選取現有的核發設定。這項設定會指定 CA、生命週期和金鑰類型。
  11. 點選「建立」。控制台會將新憑證新增至目標 Proxy 的清單。

  12. 查看憑證清單,然後按一下「Update」(更新),將變更套用至目標 Proxy。這項操作會更新基礎憑證對應項目,或建立新的項目。

具有憑證對應組合的全域負載平衡器

  1. 在 Google Cloud 控制台中,前往「Certificate Manager (2nd gen)」(憑證管理工具 (第 2 代))。

    前往「Certificate Manager (2nd gen)」(Certificate Manager (第 2 代))

  2. 在導覽選單中,按一下「Manage Lifecycle」(管理生命週期)。

  3. 按一下「負載平衡」分頁標籤。系統會列出負載平衡器。

  4. 找出負載平衡器,然後按一下切換節點展開資料列,查看相關聯的目標 Proxy。

  5. 按一下目標 Proxy 的名稱。

  6. 按一下「Update certificate map」(更新憑證對應組合)。頁面會顯示憑證對應組合詳細資料和憑證對應關係。

  7. 依序點選「編輯」和「新增對應項目」。

  8. 輸入新對應關係的詳細資料:

    • 名稱:這個憑證資源的專屬名稱 (例如 my-lb-cert)。
    • 主機名稱:選取適當的主機名稱。憑證搜尋結果會與所提供的主機名稱完全相符。如為單一層級子網域,搜尋結果也會包含為上層網域萬用字元核發的憑證。舉例來說,輸入 app.example.com 會傳回 app.example.com 和 *.example.com 的憑證。
  9. 選取現有憑證或建立新憑證。

  10. 按一下「Add」(新增)。控制台會將新憑證新增至目標 Proxy 的清單。

  11. 查看憑證清單,然後按一下「Save」(儲存),將變更套用至目標 Proxy。這項操作會更新基礎憑證對應項目,或建立新的項目。

具有網路憑證的全域負載平衡器

  1. 在 Google Cloud 控制台中,前往「Certificate Manager (2nd gen)」(憑證管理工具 (第 2 代))。

    前往「Certificate Manager (2nd gen)」(Certificate Manager (第 2 代))

  2. 在導覽選單中,按一下「Manage Lifecycle」(管理生命週期)。

  3. 按一下「負載平衡」分頁標籤。系統會列出負載平衡器。

  4. 找出負載平衡器,然後按一下切換節點展開資料列,查看相關聯的目標 Proxy。

  5. 按一下目標 Proxy 的名稱。

  6. 按一下「設定生命週期管理」。頁面會顯示與這個目標 Proxy 有效憑證對應組合相關聯的憑證。

  7. 按一下「新增憑證」。

  8. 選取現有憑證或建立新憑證。

  9. 輸入新憑證的下列詳細資料:

    • 名稱:這個憑證資源的專屬名稱 (例如 my-lb-cert)。
    • 範圍:選取適當的金鑰發布範圍 (例如 Default)。
    • 憑證類型:自行管理或 Google 代管的憑證類型。
    • 網域名稱:這張憑證涵蓋的網域名稱 (例如 app.example.com)。這個網域必須由您控制。
    • 核發設定:從清單中選取現有的核發設定。這項設定會指定 CA、生命週期和金鑰類型。
  10. 點選「建立」。控制台會將新憑證新增至目標 Proxy 的清單。

  11. 查看憑證清單,然後按一下「Update」(更新),將變更套用至目標 Proxy。這項操作會更新基礎憑證對應項目,或建立新的項目。

後續步驟