Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Guía de inicio rápido: Implementa un grupo de trabajadores de muestra en Cloud Run
En esta página, se muestra cómo implementar un contenedor de grupo de trabajadores de muestra.
Después de la implementación, el grupo de trabajadores escribe continuamente un mensaje de registro.
Antes de comenzar
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.
In the Principal column, find all rows that identify you or a group that
you're included in. To learn which groups you're included in, contact your
administrator.
For all rows that specify or include you, check the Role column to see whether
the list of roles includes the required roles.
In the Principal column, find all rows that identify you or a group that
you're included in. To learn which groups you're included in, contact your
administrator.
For all rows that specify or include you, check the Role column to see whether
the list of roles includes the required roles.
En el campo Principales nuevas, ingresa tu identificador de usuario.
Esta suele ser la dirección de correo electrónico de una Cuenta de Google.
En la lista Seleccionar un rol, elige uno.
Para otorgar roles adicionales, haz clic en addAgregar
otro rol y agrega uno más.
Haz clic en Guardar.
Asegúrate de tener el rol de usuario de cuenta de servicio otorgado en la identidad del servicio. De forma predeterminada, la identidad del servicio es la cuenta de servicio predeterminada de Compute Engine.
Otorga los roles
Para otorgar acceso al recurso de identidad del servicio, usa el comando
gcloud iam service-accounts add-iam-policy-binding,
y reemplaza las variables destacadas por los valores adecuados:
Selecciona Grupos de trabajadores en el menú y haz clic en Implementar contenedor para mostrar el formulario Crear grupos de trabajadores.
Haz clic en Probar con un contenedor de muestra.
Haz clic en Crear para implementar la imagen en Cloud Run. Espera a que finalice la implementación.
Haz clic en la pestaña Registros para ver los registros escritos por el grupo de trabajadores.
El grupo de trabajadores escribe continuamente el mensaje de registro Cloud Run Worker Pool instance is running!.
Limpia
Para evitar cargos adicionales en tu cuenta de Google Cloud , borra todos los recursos que implementaste con esta guía de inicio rápido.
El grupo de trabajadores de muestra escribe registros de forma continua. Para detener el registro, sigue uno de estos pasos para borrar el grupo de trabajadores:
Selecciona Grupos de trabajadores en el menú y, luego, el grupo de trabajadores que deseas borrar.
Haz clic en Borrar.
Borra tu proyecto de prueba
Si borras tu proyecto de Google Cloud , se detendrá la facturación de todos los recursos que contenga. Para liberar todos los recursos Google Cloud de tu proyecto, sigue estos pasos:
In the Google Cloud console, go to the Manage resources page.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (UTC)"],[],[],null,["# Quickstart: Deploy a sample worker pool to Google Cloud with Cloud Run\n\nQuickstart: Deploy a sample worker pool to Cloud Run\n====================================================\n\n|\n| **Preview\n| --- Cloud Run worker pools**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis page shows you how to deploy a sample worker pool container.\nAfter deploying, the worker pool continually writes a log message.\n\nBefore you begin\n----------------\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n Make sure that you have the following role or roles on the project:\n\n Cloud Run Admin, Cloud Run Developer, Logs Viewer\n\n #### Check for the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n 2. Select the project.\n 3.\n In the **Principal** column, find all rows that identify you or a group that\n you're included in. To learn which groups you're included in, contact your\n administrator.\n\n 4. For all rows that specify or include you, check the **Role** column to see whether the list of roles includes the required roles.\n\n #### Grant the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n 2. Select the project.\n 3. Click person_add **Grant access**.\n 4.\n In the **New principals** field, enter your user identifier.\n\n This is typically the email address for a Google Account.\n\n 5. In the **Select a role** list, select a role.\n 6. To grant additional roles, click add **Add\n another role** and add each additional role.\n 7. Click **Save**.\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n Make sure that you have the following role or roles on the project:\n\n Cloud Run Admin, Cloud Run Developer, Logs Viewer\n\n #### Check for the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n 2. Select the project.\n 3.\n In the **Principal** column, find all rows that identify you or a group that\n you're included in. To learn which groups you're included in, contact your\n administrator.\n\n 4. For all rows that specify or include you, check the **Role** column to see whether the list of roles includes the required roles.\n\n #### Grant the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n 2. Select the project.\n 3. Click person_add **Grant access**.\n 4.\n In the **New principals** field, enter your user identifier.\n\n This is typically the email address for a Google Account.\n\n 5. In the **Select a role** list, select a role.\n 6. To grant additional roles, click add **Add\n another role** and add each additional role.\n 7. Click **Save**.\n\n1. Make sure that you have the Service Account User role granted on the service identity. By\n default, the service identity is the Compute Engine default service account.\n\n #### Grant the roles\n\n To grant access on the service identity resource, use the\n `gcloud iam service-accounts add-iam-policy-binding` command,\n replacing the highlighted variables with the appropriate values: \n\n ```bash\n gcloud iam service-accounts add-iam-policy-binding SERVICE_ACCOUNT_EMAIL \\\n --member=\"\u003cvar translate=\"no\"\u003ePRINCIPAL\u003c/var\u003e\" \\\n --role=\"roles/iam.serviceAccountUser\"\n \n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_EMAIL\u003c/var\u003e: the service account email address you are using as the service identity, such as:\n - The Compute Engine default service account: \u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e`-compute@developer.gserviceaccount.com`\n - A service account that you created: \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_NAME\u003c/var\u003e`@`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.iam.gserviceaccount.com`\n - \u003cvar translate=\"no\"\u003ePRINCIPAL\u003c/var\u003e: the user identifier. This is typically the email address for a Google Account.\n2. Review [Cloud Run pricing](/run/pricing) or estimate costs with the [pricing calculator](/products/calculator).\n\nDeploy worker pool\n------------------\n\nTo deploy the sample worker pool container, follow these steps:\n\n1. In the Google Cloud console, go to Cloud Run:\n\n [Go to Cloud Run](https://console.cloud.google.com/run/worker-pools)\n2. Select **Worker pools** from the menu, and click **Deploy container** to\n display the **Create worker pools** form.\n\n3. Click **Test with a sample container**.\n\n4. Click **Create** to deploy the image to Cloud Run. Wait for the\n deployment to finish.\n\n5. Click the **Logs** tab to view the logs written by the worker pool.\n The worker pool continually writes the log message\n `Cloud Run Worker Pool instance is running!`.\n\n| **Success:** You deployed a sample worker pool to Cloud Run.\n\nClean up\n--------\n\nTo avoid additional charges to your Google Cloud account, delete all the resources\nyou deployed with this quickstart.\n\n### Delete your repository\n\nYou might be [charged for storing the container image in\nArtifact Registry](/artifact-registry/pricing). To delete Artifact Registry repositories,\nfollow the steps in [Delete\nrepositories](/artifact-registry/docs/manage-repos#delete) in the Artifact Registry\ndocumentation.\n\n### Delete your worker pool\n\nThe sample worker pool continually writes logs. To stop logging, follow one of these\nsteps to delete the worker pool:\n\n1. In the Google Cloud console, go to Cloud Run:\n\n [Go to Cloud Run](https://console.cloud.google.com/run/worker-pools)\n2. Select **Worker pools** from the menu, and select the worker pool you want\n to delete.\n\n3. Click **Delete**.\n\n### Delete your test project\n\nDeleting your Google Cloud project stops billing for all resources in that\nproject. To release all Google Cloud resources in your project, follow these steps:\n\n| **Caution** : Deleting a project has the following effects:\n|\n| - **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.\n| - **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.\n1. In the Google Cloud console, go to the **Manage resources** page.\n\n [Go to Manage resources](https://console.cloud.google.com/iam-admin/projects)\n2. In the project list, select the project that you want to delete, and then click **Delete**.\n3. In the dialog, type the project ID, and then click **Shut down** to delete the project.\n\n\u003cbr /\u003e\n\nWhat's next\n-----------\n\nFor more information on worker pools, see:\n\n- [Deploy worker pools to Cloud Run](/run/docs/deploy-worker-pools)\n- [Logging and viewing logs](/run/docs/logging)\n- [Manually scale worker pools](/run/docs/configuring/workerpools/manual-scaling)"]]