建立代管執行個體群組 (MIG)

瞭解如何使用 Google Cloud 控制台在 Compute Engine 中建立代管執行個體群組 (MIG)

MIG 是虛擬機器 (VM) 執行個體的集合,您可以將此群組做為單一實體進行管理。MIG 支援自動修復、自動調度資源、負載平衡、多可用區涵蓋範圍和有狀態工作負載等功能。

MIG 中的每個 VM 都以執行個體範本為基礎。您必須先建立執行個體範本,才能建立 MIG。


如要直接在 Google Cloud 控制台按照逐步指南操作,請按一下「Guide me」(逐步引導)

逐步引導


事前準備

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  5. Make sure that billing is enabled for your Google Cloud project.

  6. 啟用 Compute Engine API。

    啟用 API

建立執行個體範本

  1. 前往 Google Cloud 控制台的「Instance Templates」(執行個體範本) 頁面。

    前往「Instance templates」(執行個體範本) 頁面

  2. 按一下「Create instance template」(建立執行個體範本)

  3. 如要建立採用 Ubuntu OS 的範本,請執行下列步驟:

    1. 按一下「Boot disk」(開機磁碟) 專區中的「Change」(變更)

    2. 在「Operating system」(作業系統) 清單中選取「Ubuntu」

    3. 按一下「Select」(選取)

    範本會將這些設定套用至依據這個範本建立的所有 VM。請記下範本名稱,以便在後續的教學課程中使用。

  4. 如要建立執行個體範本,請按一下「Create」(建立)

請稍候幾分鐘,讓 Compute Engine 建立範本。準備就緒之後,範本會出現在「Instance templates」(執行個體範本) 頁面中。

依據執行個體範本建立 MIG

  1. 前往「Instance groups」(執行個體群組) 頁面。

    前往「Instance groups」(執行個體群組)

  2. 按一下「Create instance group」(建立執行個體群組),然後執行下列步驟:

    1. 在「Name」(名稱) 欄位中接受預設名稱或輸入 quickstart-instance-group-1

    2. 在「Instance template」(執行個體範本) 清單中,選取稍早建立的執行個體範本。

    3. 「Location」(位置) 專區中確認已選取「Single zone」(單一可用區)

    4. 在「Region」(區域) 欄位中,選擇要建立 MIG 的區域。

    5. 接受「Autoscaling」(自動調度資源) 部分中的預設設定,或是視需求調整。

  3. 如要建立 MIG,請按一下「Create」(建立)

請稍候幾分鐘,讓 Compute Engine 建立群組和相關 VM。準備就緒之後,群組會出現在「Instance groups」(執行個體群組) 頁面中。

您已成功建立代管執行個體群組。

清除所用資源

如要避免系統向您的 Google Cloud 帳戶收取您在本頁所用資源的費用,請按照下列步驟操作。

刪除資源

如果您使用現有的 Google Cloud 專案,請刪除稍早建立的資源,以免系統向您的帳戶收取費用。

  1. 前往「Instance groups」(執行個體群組) 頁面。

    前往「Instance groups」(執行個體群組)

  2. 選取要刪除的執行個體群組。

  3. 按一下「Delete」(刪除)。

  4. 按照系統提示輸入所需的值,然後按一下「Delete」(刪除)

刪除專案

如要避免付費,最簡單的方法就是刪除您為了本教學課程所建立的專案。

如要刪除專案:

  1. In the Google Cloud console, go to the Manage resources page.

    Go to Manage resources

  2. In the project list, select the project that you want to delete, and then click Delete.
  3. In the dialog, type the project ID, and then click Shut down to delete the project.

後續步驟