快速入門導覽課程:將範例工作站集區部署至 Cloud Run
本頁說明如何部署範例工作站集區容器。部署後,工作站集區會持續寫入記錄訊息。
事前準備
- 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.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
- 啟用 Cloud Run Admin API:
啟用 Cloud Run Admin API - 安裝並初始化 gcloud CLI。
-
更新元件:
gcloud components update
部署工作站集區
如要部署範例工作站集區容器,請按照下列步驟操作:
-
In the Google Cloud console, 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.
請執行下列指令:
您可以為工作站集區使用任何名稱或區域。本快速入門導覽課程假設您使用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
這個區域。部署作業成功完成後,Cloud Run 會顯示類似以下的訊息:
Worker pool [my-example-worker-pool] revision [my-example-worker-pool-REVISION] has been deployed
查看工作站集區寫入的記錄檔。
前往 Google Cloud 控制台的 Cloud Run 頁面:
按一下「工作站集區」。
在工作站集區清單中,按一下所需的工作站集區。
按一下「記錄」分頁標籤,取得此工作站集區所有修訂版本的容器記錄。工作站集區會持續寫入記錄訊息
Cloud Run Worker Pool instance is running!
。
清除所用資源
範例工作站集區會持續寫入記錄。因此如要停止,您必須刪除工作站集區。如要刪除工作站集區,請使用下列指令:
gcloud beta run worker-pools delete my-example-workerpool
--region europe-west1
如果您在部署時使用其他名稱,請將 my-example-workerpool
替換為工作站集區名稱;如果您在部署時使用其他區域,請將 europe-west1
替換為您的區域。
後續步驟
如要進一步瞭解工作站集區,請參閱: