Quickstart: Deploy a sample worker pool to Cloud Run
This page shows you how to deploy a sample worker pool container. After deploying, the worker pool continually writes a log message.
Before you begin
- 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.
- Enable the Cloud Run Admin API:
Enable the Cloud Run Admin API - Install and initialize the gcloud CLI.
-
Update components:
gcloud components update
Deploy worker pool
To deploy the sample worker pool container, follow these steps:
-
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.
Run the following command:
You can use any name or region you want for the worker pool. This quickstart assumes you are using the namegcloud beta run worker-pools deploy example-worker-pool --image us-docker.pkg.dev/cloudrun/container/worker-pool:latest --region europe-west1
example-worker-pool
and the regioneurope-west1
.When the deployment completes successfully, Cloud Run displays a message similar to this one:
Worker pool [my-example-worker-pool] revision [my-example-worker-pool-REVISION] has been deployed
View the logs written by the worker pool.
In the Google Cloud console, go to the Cloud Run page:
Click Worker pools.
Click the worker pool in the worker pools list.
Click the Logs tab to get the container logs for all revisions of this worker pool. The worker pool continually writes the log message
Cloud Run Worker Pool instance is running!
.
Clean up
The sample worker pool continually writes logs. So, to stop it, you'll need to delete the worker pool.To delete a worker pool, use the command:
gcloud beta run worker-pools delete my-example-workerpool
--region europe-west1
Replace my-example-workerpool
with the name of the worker pool if you used
a different name when you deployed, and replace
europe-west1
with your region if you used a different one
when you deployed.
What's next
For more information on worker pools, see: