快速入門導覽課程:將範例工作站集區部署至 Cloud Run

本頁說明如何部署範例工作站集區容器。部署後,工作站集區會持續寫入記錄訊息。

事前準備

  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. 啟用 Cloud Run Admin API:
    啟用 Cloud Run Admin API
  7. 安裝並初始化 gcloud CLI。
  8. 更新元件:
    gcloud components update

部署工作站集區

如要部署範例工作站集區容器,請按照下列步驟操作:

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. 請執行下列指令:

    gcloud beta run worker-pools deploy example-worker-pool
      --image us-docker.pkg.dev/cloudrun/container/worker-pool:latest
      --region europe-west1
    您可以為工作站集區使用任何名稱或區域。本快速入門導覽課程假設您使用 example-worker-pool 這個名稱和 europe-west1 這個區域。

  3. 部署作業成功完成後,Cloud Run 會顯示類似以下的訊息:

    Worker pool [my-example-worker-pool] revision [my-example-worker-pool-REVISION] has been deployed

  4. 查看工作站集區寫入的記錄檔。

    1. 前往 Google Cloud 控制台的 Cloud Run 頁面:

      前往 Cloud Run

    2. 按一下「工作站集區」

    3. 在工作站集區清單中,按一下所需的工作站集區。

    4. 按一下「記錄」分頁標籤,取得此工作站集區所有修訂版本的容器記錄。工作站集區會持續寫入記錄訊息 Cloud Run Worker Pool instance is running!

清除所用資源

範例工作站集區會持續寫入記錄。因此如要停止,您必須刪除工作站集區。

如要刪除工作站集區,請使用下列指令:

gcloud beta run worker-pools delete my-example-workerpool 
--region europe-west1

如果您在部署時使用其他名稱,請將 my-example-workerpool 替換為工作站集區名稱;如果您在部署時使用其他區域,請將 europe-west1 替換為您的區域。

後續步驟

如要進一步瞭解工作站集區,請參閱: