使用 RHEL BYOS 映像檔建立 VM


您可以使用 Red Hat Cloud Access 訂閱的映像檔,在 Compute Engine 上建立虛擬機器 (VM) 執行個體。

使用這個選項時,您只需為產生的基礎架構費用付費, Google Cloud如果您在 Google Cloud上使用 Red Hat Cloud Access 訂閱的 OS 映像檔,就必須直接向 Red Hat 申請支援。如要申請支援服務,請登入 Red Hat 客戶入口網站並開立支援單。

建立使用 RHEL OS 映像檔的 VM 時,您可以使用 Google Cloud 控制台提供的單一登入 (SSO) 選項,存取 Red Hat 知識庫。

事前準備

  • 如果尚未設定,請先設定驗證機制。驗證是指驗證身分,以便存取 Google Cloud 服務和 API 的程序。如要在本機開發環境中執行程式碼或範例,您可以選取下列任一選項,向 Compute Engine 進行驗證:

    Select the tab for how you plan to use the samples on this page:

    Console

    When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.

    gcloud

    1. After installing the Google Cloud CLI, initialize it by running the following command:

      gcloud init

      If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

    2. Set a default region and zone.

必要的角色

如要取得建立 VM 所需的權限,請要求管理員為您授予專案的 Compute Instance Admin (v1) (roles/compute.instanceAdmin.v1) IAM 角色。如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和機構的存取權」。

這個預先定義的角色包含建立 VM 所需的權限。如要查看確切的必要權限,請展開「必要權限」部分:

所需權限

如要建立 VM,您必須具備下列權限:

  • compute.instances.create 專案
  • 如要使用自訂映像檔建立 VM,請按照下列步驟操作: compute.images.useReadOnly 在映像檔上
  • 如要使用快照建立 VM,請按照下列步驟操作: compute.snapshots.useReadOnly 在快照上
  • 如要使用執行個體範本建立 VM,請按照下列步驟操作: compute.instanceTemplates.useReadOnly 在執行個體範本上
  • 如要將舊版網路指派給 VM: compute.networks.use 專案上
  • 如要為 VM 指定靜態 IP 位址: compute.addresses.use 專案上的
  • 如要在使用舊版網路時將外部 IP 位址指派給 VM,請按照下列步驟操作: compute.networks.useExternalIp 專案
  • 如要為 VM 指定子網路: compute.subnetworks.use 在專案或所選子網路上
  • 如要在使用虛擬私有雲網路時,將外部 IP 位址指派給 VM,請按照下列步驟操作: compute.subnetworks.useExternalIp 在專案或所選子網路上
  • 如要為 VM 設定 VM 執行個體中繼資料,請按照下列步驟操作: compute.instances.setMetadata 在專案中
  • 如要為 VM 設定標記: compute.instances.setTags 在 VM 上
  • 如要為 VM 設定標籤,請按照下列步驟操作: compute.instances.setLabels VM 上
  • 如要設定 VM 使用的服務帳戶,請按照下列步驟操作: compute.instances.setServiceAccount 在 VM 上
  • 如要為 VM 建立新磁碟,請按照下列步驟操作: compute.disks.create 專案
  • 如要以唯讀或讀寫模式連接現有磁碟: 磁碟的 compute.disks.use 權限
  • 如要以唯讀模式連接現有磁碟,請執行下列操作: compute.disks.useReadOnly 磁碟

您或許還可透過自訂角色或其他預先定義的角色取得這些權限。

使用 RHEL BYOS 映像檔建立 VM

總而言之,如要在 Google Cloud上使用 Red Hat Cloud Access 訂閱,您必須完成下列步驟:

  1. 授予 Red Hat Cloud Access 訂閱中 Google Cloud 圖片的存取權
  2. 使用 Google Cloud 控制台或 Google Cloud CLI 建立 VM。

授予 Google 群組 RHEL 訂閱的存取權

如要讓 Google 群組存取 RHEL BYOS 映像檔,請完成下列步驟:

  1. 選取現有群組或建立 Google 群組
  2. 將所有要使用這些 BYOS 映像檔的使用者和服務帳戶新增至 Google 群組。請參閱將使用者加入群組
  3. 登入 Red Hat 客戶入口網站,然後完成下列步驟:
    1. 在導覽選單中選取「Cloud Access」
    2. 按一下「啟用新提供者」
    3. 在「Select a Red Hat Certified Cloud and Service Provider」選單中,選取「Google Compute Engine」
    4. 輸入 Google Compute Engine ID。這是您在步驟 1 中建立的 Google 網路論壇的電子郵件地址
    5. 選取要啟用的產品。
    6. 按一下「啟用」

Google Cloud 帳戶連結至 Red Hat 客戶入口網站可能需要 3 到 4 小時。

建立 VM

授予 Google 群組 RHEL 訂閱的存取權後,您就能在 Compute Engine 的 rhel-byos-cloud 專案中使用 RHEL BYOS 映像檔。接著,您可以使用 RHEL BYOS 映像檔建立 VM。

主控台

  1. 前往 Google Cloud 控制台的「Create an instance」(建立執行個體) 頁面。

    前往「Create an instance」(建立執行個體)

  2. 指定 VM 的「名稱」。詳情請參閱「資源命名慣例」。

  3. 選用:變更此 VM 的「Zone」。如果選取「任何」,Google 會根據機型和可用性自動選擇區域。

  4. 為 VM 選取機器設定

  5. 在「Boot disk」(開機磁碟) 區段,按一下 [Change] (變更)

  6. 在「Public images」(公開映像檔) 分頁中,完成下列步驟:

    1. 在「Operating system」下拉式選單中,選取下列其中一個選項:
      • Red Hat Enterprise Linux
      • Red Hat Enterprise Linux for SAP
    2. 在「版本類型」下拉式選單中,選取要使用的圖片。
    3. 在「授權類型」部分中,選取「自備訂閱或授權 (BYOS/BYOL)」
    4. 指定開機磁碟類型。
    5. 指定開機磁碟大小。
    6. 選用步驟:如要查看進階設定選項,請按一下「顯示進階設定」
    7. 如要確認開機磁碟選項,請按一下「選取」
  7. 視需要進行其他 VM 自訂設定。

  8. 如要建立並啟動 VM,請按一下 [Create] (建立)

gcloud

  1. 查看可用的 RHEL BYOS 映像檔清單。如要查看 RHEL BYOS 映像檔清單,請執行下列指令。

    gcloud compute images list \
        --project=rhel-byos-cloud \
        --no-standard-images
    
  2. 執行 gcloud compute instances create 指令,建立具有 BYOS 映像檔的 VM。

     gcloud compute instances create VM_NAME \
        --image-family=IMAGE_FAMILY \
        --image-project=rhel-byos-cloud
    

    更改下列內容:

    • VM_NAME:新 VM 的名稱
    • IMAGE_FAMILY:您要使用的 RHEL BYOS 映像檔系列。例如 rhel-9-byosrhel-9-2-sap-byos

後續步驟