管理圖片版本

本頁說明如何管理 Gemini Enterprise Agent Platform Workbench 執行個體的映像檔版本,包括如何執行下列操作:

  • 列出可用的圖片名稱
  • 根據特定映像檔名稱建立執行個體
  • 在映像檔系列之間升級或移動執行個體

如要瞭解版本管理機制、映像檔內容和生命週期,請參閱「映像檔版本管理和生命週期」。

如要瞭解各版本異動內容,請參閱「映像檔版本資訊」。

VM 映像檔

本節說明如何列出可用的 VM 映像檔、在特定 VM 映像檔上建立執行個體,以及升級執行個體的 VM 映像檔。

列出可用的 VM 映像檔

VM 映像檔會儲存在私人存放區。如要列出可用的 VM 映像檔及其支援的設定,請使用 gcloud workbench instances get-config 或 GetConfig API。

gcloud

gcloud workbench instances get-config --location=LOCATION

將 LOCATION 替換為 Cloud de Confiance by S3NS 區域,例如 us-central1。

cURL

curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  "https://notebooks.googleapis.com/v2/projects/PROJECT_ID/locations/LOCATION/instances:getConfig"

更改下列內容:

  • PROJECT_ID:您的 Cloud de Confiance by S3NS 專案 ID。
  • LOCATION:要擷取設定的區域。

使用特定 VM 映像檔建立執行個體

如要在特定 VM 映像檔上建立執行個體,請使用 gcloud CLI 或 Terraform。您可以指定映像檔系列來取得最新映像檔名稱,也可以指定映像檔名稱來取得確切版本。

gcloud

# Using an image family
gcloud workbench instances create INSTANCE_NAME \
  --vm-image-project=cloud-notebooks-managed \
  --vm-image-family=IMAGE_FAMILY \
  --location=LOCATION

# Using a specific image name
gcloud workbench instances create INSTANCE_NAME \
  --vm-image-project=cloud-notebooks-managed \
  --vm-image-name=IMAGE_NAME \
  --location=LOCATION

更改下列內容:

Terraform

resource "google_workbench_instance" "vm_instance" {
  # ... other configurations
  gce_setup {
    vm_image {
      project = "cloud-notebooks-managed"
      family  = "IMAGE_FAMILY" # Or specify image name to get an exact version
    }
  }
  # ...
}

升級 VM 映像檔

根據預設,執行個體會升級至目前映像檔系列中的最新映像檔名稱。如要使用舊版映像檔名稱,請從特定映像檔名稱建立新的執行個體。

gcloud

gcloud workbench instances upgrade INSTANCE_NAME --location=LOCATION

更改下列內容:

  • INSTANCE_NAME:執行個體的名稱。
  • LOCATION:執行個體所在的區域。

Terraform

在 Terraform 設定中,於 google_workbench_instance 資源內設定 vm_image 區塊。

resource "google_workbench_instance" "vm_instance" {
  # ... other configurations
  gce_setup {
    vm_image {
      project = "cloud-notebooks-managed"
      family  = "workbench-instances-2603" # Or use name = "workbench-instances-2603-20240315-1800-rc0"
    }
  }
  # ...
}

如要進一步瞭解如何建立特定版本的執行個體,請參閱「建立特定版本」。

升級至不同的映像檔系列

如要將執行個體變更為不同映像檔系列中的最新映像檔名稱 (例如從 workbench-instances 變更為較新的 workbench-instances-2603),請在升級期間指定目標映像檔系列。這是支援在主要版本之間變更的路徑,不必重新建立執行個體。

gcloud

使用 --image-family 標記和 gcloud workbench instances upgrade 指定目標映像檔系列。執行個體會升級至指定系列中的最新映像檔。

gcloud workbench instances upgrade INSTANCE_NAME \
  --location=LOCATION \
  --image-family=projects/IMAGE_PROJECT/global/images/family/IMAGE_FAMILY

更改下列內容:

  • INSTANCE_NAME:執行個體的名稱。
  • LOCATION:執行個體所在的區域。
  • IMAGE_PROJECT:託管映像檔系列的專案 (例如 cloud-notebooks-managed)。
  • IMAGE_FAMILY:目標映像檔系列的名稱 (例如 workbench-instances-2603)。

舉例來說,如要將執行個體升級為 workbench-instances-2603 系列中的最新映像檔,請執行下列操作:

gcloud workbench instances upgrade example-instance \
  --location=us-central1 \
  --image-family=projects/cloud-notebooks-managed/global/images/family/workbench-instances-2603

如果省略 --image-family 標記,執行個體會升級至目前映像檔系列中的最新映像檔。

自訂容器映像檔

Agent Platform Workbench 執行個體上的自訂容器會嚴格遵循循序發布模型,不會有任何映像檔分支或平行維護。使用日期版本管理標記,該標記會與所有用於管理 Agent Platform Workbench 執行個體上自訂容器的映像檔共用,適用於任何指定版本。版本管理標記的格式為 YYYYMMDD-HHMM-rcX。

建立以自訂容器為基礎的執行個體:說明如何在 Agent Platform Workbench 執行個體上建構及使用自訂容器。

主辦人圖片

映像檔系列: workbench-container-host

容器主機使用 Google 的 Container Optimized OS (COS)。建立新的 Agent Platform Workbench 自訂容器執行個體時,無法指定版本。新執行個體會改用最新的 COS 映像檔做為容器主機。基礎映像檔採用 COS 的最新穩定 OS 版本。請參閱 Container-Optimized OS 版本資訊。

自訂容器執行個體

本節說明如何建立及升級使用自訂容器的執行個體。 如要建構自訂容器,請參閱使用自訂容器建立執行個體。 如要瞭解基礎容器映像檔及其規格,請參閱「映像檔版本管理和生命週期」。

使用自訂容器建立執行個體

如要使用自訂容器建立 Agent Platform Workbench 執行個體,請使用 gcloud CLI 或 Terraform。

gcloud

gcloud workbench instances create INSTANCE_NAME \
  --project=PROJECT_ID \
  --location=ZONE \
  --container-repository=REGION-docker.pkg.dev/PROJECT_ID/REPOSITORY_NAME/IMAGE_NAME \
  --container-tag=TAG

更改下列內容:

  • INSTANCE_NAME:執行個體的名稱。

  • PROJECT_ID:您要建立執行個體的 Cloud de Confiance by S3NS 專案。

  • ZONE:要建立執行個體的可用區 (例如 us-central1-a)。

  • REGION:Artifact Registry 存放區的區域 (例如 us)。

  • REPOSITORY_NAME:Artifact Registry 存放區的名稱。

  • IMAGE_NAME:特定圖片名稱。如要查看可用的映像檔名稱,請參閱「映像檔版本資訊」或執行 gcloud workbench instances get-config。詳情請參閱「列出可用的 VM 映像檔」。

  • TAG:圖片代碼,例如 latest。

Terraform

resource "google_workbench_instance" "container_instance" {
  # ... other configurations
  gce_setup {
    container_image {
      repository = "REGION-docker.pkg.dev/PROJECT_ID/REPOSITORY_NAME/IMAGE_NAME"
      tag        = "TAG"
    }
  }
  # ...
}

升級自訂容器

自訂容器執行個體會在兩個映像檔上執行,升級方式如下:

  • 容器主機映像檔:由 Google 管理。這項作業遵循虛擬機升級路徑。
  • 基本容器映像檔:您建構及選取的映像檔。如要升級,請參照可變動的標記 (例如 :latest,執行個體會在重新啟動時擷取該標記的變更),或將執行個體更新為其他標記。

後續步驟