# Quickstart: Deploy a sample worker pool to Cloud Run

Cloud Run worker pools let you run continuous background workloads,
such as pulling messages from a queue, without handling inbound HTTP requests.
In this quickstart, you deploy a sample worker pool container and view the log
messages that it continually writes.

## Before you begin

1. Review [Cloud Run
   pricing](https://cloud.google.com/run/pricing) or estimate costs with the [pricing calculator](https://cloud.google.com/products/calculator).

### Required roles


To get the permissions that
you need to complete this quickstart,

ask your administrator to grant you the
following IAM roles:

- [Cloud Run Admin](https://docs.cloud.google.com/iam/docs/roles-permissions/run.md.txt#run.admin) (`roles/run.admin`) on the worker pool
- [Service Account User](https://docs.cloud.google.com/iam/docs/roles-permissions/iam.md.txt#iam.serviceAccountUser) (`roles/iam.serviceAccountUser`) on the service identity
- [Logs Viewer](https://docs.cloud.google.com/iam/docs/roles-permissions/logging.md.txt#logging.viewer) (`roles/logging.viewer`) on the project


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).


You might also be able to get
the required permissions through [custom
roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles) or other [predefined
roles](https://docs.cloud.google.com/iam/docs/roles-overview#predefined).

## Deploy worker pool

To deploy the sample worker pool container, follow these steps:

1. In the Google Cloud console, go to Cloud Run:

   [Go to Cloud Run](https://console.cloud.google.com/run/worker-pools)
2. Select **Worker pools** from the menu, and click **Deploy container** to
   display the **Create worker pools** form.

3. Click **Test with a sample container**.

4. Click **Create** to deploy the image to Cloud Run. Wait for the
   deployment to finish.

5. Click the **Logs** tab to view the logs written by the worker pool.
   The worker pool continually writes the log message
   `Cloud Run Worker Pool instance is running!`.

> [!TIP]
> **Success:** You deployed a sample worker pool to Cloud Run.

## Clean up

To avoid additional charges to your Google Cloud account, delete all the resources
you deployed with this quickstart.

### Delete your repository

You might be [charged for storing the container image in
Artifact Registry](https://cloud.google.com/artifact-registry/pricing). To delete Artifact Registry repositories,
follow the steps in [Delete
repositories](https://docs.cloud.google.com/artifact-registry/docs/repositories/delete-repos) in the Artifact Registry
documentation.

### Delete your worker pool

The sample worker pool continually writes logs. To stop logging, follow one of these
steps to delete the worker pool:

1. In the Google Cloud console, go to Cloud Run:

   [Go to Cloud Run](https://console.cloud.google.com/run/worker-pools)
2. Select **Worker pools** from the menu, and select the worker pool you want
   to delete.

3. Click **Delete**.

### Delete your test project

Deleting your Google Cloud project stops billing for all resources in that
project. To release all Google Cloud resources in your project, follow these steps:

> [!CAUTION]
> **Caution** : Deleting a project has the following effects:
>
> - **Everything in the project is deleted.** If you used an existing project for the tasks in this document, when you delete it, you also delete any other work you've done in the project.
> - **Custom project IDs are lost.** When you created this project, you might have created a custom project ID that you want to use in the future. To preserve the URLs that use the project ID, such as an `appspot.com` URL, delete selected resources inside the project instead of deleting the whole project.

1. In the Google Cloud console, go to the **Manage resources** page.

   [Go to Manage resources](https://console.cloud.google.com/iam-admin/projects)
2. In the project list, select the project that you want to delete, and then click **Delete**.
3. In the dialog, type the project ID, and then click **Shut down** to delete the project.

<br />

## What's next

For more information on worker pools, see:

- [Deploy worker pools to Cloud Run](https://docs.cloud.google.com/run/docs/deploy-worker-pools.md.txt)
- [Logging and viewing logs](https://docs.cloud.google.com/run/docs/logging.md.txt)
- [Manually scale worker pools](https://docs.cloud.google.com/run/docs/configuring/workerpools/manual-scaling.md.txt)