Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Guide de démarrage rapide : déployer un pool de nœuds de calcul échantillon sur Cloud Run
Cette page vous explique comment déployer un exemple de conteneur de pool de nœuds de calcul.
Après le déploiement, le pool de nœuds de calcul écrit en continu un message de journal.
Avant de commencer
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.
Dans le champ Nouveaux comptes principaux, saisissez votre identifiant utilisateur.
Il s'agit généralement de l'adresse e-mail d'un compte Google.
Dans la liste Sélectionner un rôle, sélectionnez un rôle.
Pour attribuer des rôles supplémentaires, cliquez sur addAjouter un autre rôle et ajoutez tous les rôles supplémentaires.
Cliquez sur Enregistrer.
Assurez-vous que le rôle Utilisateur du compte de service vous a été attribué pour l'identité de service. Par défaut, l'identité de service est le compte de service Compute Engine par défaut.
Attribuer les rôles
Pour accorder l'accès à la ressource d'identité de service, utilisez la commande gcloud iam service-accounts add-iam-policy-binding en remplaçant les variables en surbrillance par les valeurs appropriées :
Sélectionnez Pools de nœuds de calcul dans le menu, puis cliquez sur Déployer un conteneur pour afficher le formulaire Créer des pools de nœuds de calcul.
Cliquez sur Tester avec un exemple de conteneur.
Cliquez sur Créer pour déployer l'image sur Cloud Run. Attendez la fin du déploiement.
Cliquez sur l'onglet Journaux pour afficher les journaux écrits par le pool de nœuds de calcul.
Le pool de nœuds de calcul écrit en continu le message de journal Cloud Run Worker Pool instance is running!.
Effectuer un nettoyage
Pour éviter que des frais supplémentaires ne soient facturés sur votre compte Google Cloud , supprimez toutes les ressources que vous avez déployées avec ce guide de démarrage rapide.
L'exemple de pool de nœuds de calcul écrit en continu des journaux. Pour arrêter la journalisation, suivez l'une des procédures suivantes pour supprimer le pool de nœuds de calcul :
Dans la console Google Cloud , accédez à Cloud Run :
Sélectionnez Pools de nœuds de calcul dans le menu, puis sélectionnez le pool de nœuds de calcul que vous souhaitez supprimer.
Cliquez sur Supprimer.
Supprimer votre projet de test
La suppression de votre projet Google Cloud arrête la facturation de toutes les ressources de ce projet. Pour libérer toutes les ressources Google Cloud de votre projet, procédez comme suit :
In the Google Cloud console, go to the Manage resources page.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 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)"]]