クイックスタート: サンプル ワーカープールを 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
をリージョンに置き換えます。
次のステップ
ワーカープールの詳細については、以下をご覧ください。