Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page vous explique comment mettre à l'échelle manuellement votre pool de nœuds de calcul.
Présentation
Le scaling manuel vous permet de définir un nombre d'instances spécifique sans avoir à redéployer.
Cela vous permet d'écrire votre propre logique de scaling à l'aide d'un système externe. Pour obtenir un exemple, consultez Kafka Autoscaler.
Facturation avec le scaling manuel
Lorsque vous utilisez le scaling manuel, toutes les instances que vous avez demandées sont facturées en tant qu'instances actives, même si elles sont inactives.
Pour en savoir plus sur la facturation, consultez la page des tarifs.
Rôles requis
Pour obtenir les autorisations nécessaires pour déployer des pools de nœuds de calcul Cloud Run, demandez à votre administrateur de vous accorder les rôles IAM suivants :
Si vous configurez un nouveau pool de nœuds de calcul, sélectionnez Pools de nœuds de calcul dans le menu, puis cliquez sur Déployer un conteneur. Si vous configurez un pool de nœuds de calcul existant, cliquez sur celui-ci pour afficher son panneau de détails, puis sur l'icône en forme de crayon à côté de Scaling (Mise à l'échelle) en haut à droite du panneau de détails.
Localisez le formulaire Scaling (pour un nouveau pool de nœuds de calcul) ou le formulaire Modifier le scaling pour un pool de nœuds de calcul existant.
Dans le champ Nombre d'instances, spécifiez le nombre d'instances de conteneur pour le service.
Terminez la spécification.
Cliquez sur Créer pour un nouveau pool de nœuds de calcul ou sur Enregistrer pour un pool de nœuds de calcul existant.
gcloud
Pour spécifier le scaling d'un nouveau pool de nœuds de calcul, utilisez la commande deploy :
WORKER_POOL : nom de votre pool de nœuds de calcul.
INSTANCE_COUNT : nombre d'instances pour le pool de nœuds de calcul.
Cela définit le pool de nœuds de calcul sur le scaling manuel. Spécifiez la valeur 0 pour désactiver le pool de nœuds de calcul.
IMAGE_URL : référence à l'image de conteneur contenant le pool de nœuds de calcul, par exemple us-docker.pkg.dev/cloudrun/container/worker-pool:latest.
Spécifiez le scaling pour un pool de nœuds de calcul existant à l'aide de la commande update suivante :
REGION : région Google Cloud , par exemple europe-west1.
IMAGE_URL : référence à l'image de conteneur contenant le pool de nœuds de calcul, par exemple us-docker.pkg.dev/cloudrun/container/worker-pool:latest.
INSTANCE_COUNT : nombre d'instances pour le pool de nœuds de calcul.
Cela définit le pool de nœuds de calcul sur le scaling manuel. Spécifiez la valeur 0 pour désactiver le pool de nœuds de calcul.
Afficher la configuration du scaling pour un pool de nœuds de calcul
Dans la console Google Cloud , accédez à Cloud Run :
Remplacez WORKER_POOL par le nom de votre pool de nœuds de calcul.
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,["# Manual scaling for worker pools\n\n| **Preview\n| --- Cloud Run manual scaling**\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 manually scale your worker pool.\n\nOverview\n--------\n\nManual scaling lets you set a specific instance\ncount\nwithout requiring redeployment.\nThis gives you the option to write your own\nscaling logic using an external system. See the [Kafka Autoscaler](/run/docs/configuring/workerpools/kafka-autoscaler)\nfor an example of this.\n\nBilling considerations when using manual scaling\n------------------------------------------------\n\nWhen you use manual scaling, all the instances that you requested are\nbilled as *active* instances, even if they happen to be idle.\nFor complete billing details, see the [pricing page](/run/pricing).\n\nRequired roles\n--------------\n\n\nTo get the permissions that\nyou need to deploy Cloud Run worker pools,\n\nask your administrator to grant you the\nfollowing IAM roles:\n\n- [Cloud Run Developer](/iam/docs/roles-permissions/run#run.developer) (`roles/run.developer`) on the Cloud Run service\n- [Service Account User](/iam/docs/roles-permissions/iam#iam.serviceAccountUser) (`roles/iam.serviceAccountUser`) on the service identity\n- [Artifact Registry Reader](/iam/docs/roles-permissions/artifactregistry#artifactregistry.reader) (`roles/artifactregistry.reader`) on the Artifact Registry repository of the deployed container image (if applicable)\n\n\nFor a list of IAM roles and permissions that are associated with\nCloud Run, see\n[Cloud Run IAM roles](/run/docs/reference/iam/roles)\nand [Cloud Run IAM permissions](/run/docs/reference/iam/permissions).\nIf your Cloud Run worker pool interfaces with\nGoogle Cloud APIs, such as Cloud Client Libraries, see the\n[service identity configuration guide](/run/docs/configuring/workerpools/service-identity).\nFor more information about granting roles, see\n[deployment permissions](/run/docs/reference/iam/roles#additional-configuration)\nand [manage access](/iam/docs/granting-changing-revoking-access).\n\nConfigure scaling\n-----------------\n\nChanging scaling mode or changing the manual instance count\ndoes not create a new revision.\n\nTo configure the scaling mode, use the Google Cloud console or the Google Cloud CLI: \n\n### Console\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. If you are configuring a new worker pool, select **Worker pools** from the menu, and\n click **Deploy container** . If you are\n configuring an existing worker pool, click the worker pool to display its\n detail pane, then click the pen icon next to **Scaling** at the top right\n of the detail panel.\n\n3. Locate the **Scaling** form (for a new worker pool) or the\n **Edit scaling** form for an existing worker pool.\n\n4. In the field labelled **Number of instances**, specify the number of container instances for the service.\n\n5. Finish the specification.\n\n6. Click **Create** for a new worker pool or **Save** for an existing worker pool.\n\n### gcloud\n\n\nTo specify scaling for a new worker pool, use the [deploy](/sdk/gcloud/reference/beta/run/worker-pools/deploy)\ncommand: \n\n```bash\ngcloud beta run worker-pools deploy WORKER_POOL \\\n --scaling=INSTANCE_COUNT \\\n --image IMAGE_URL\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eWORKER_POOL\u003c/var\u003e: the name of your worker pool.\n- \u003cvar translate=\"no\"\u003eINSTANCE_COUNT\u003c/var\u003e: the number of instances for the worker pool. This sets the worker pool to manual scaling. Specify a value of `0` to disable the worker pool.\n- \u003cvar translate=\"no\"\u003eIMAGE_URL\u003c/var\u003e: a reference to the container image that contains the worker pool, such as `us-docker.pkg.dev/cloudrun/container/worker-pool:latest`.\n\nSpecify scaling for an existing worker pool by using the following\n[update](/sdk/gcloud/reference/beta/run/worker-pools/update) command: \n\n```bash\ngcloud beta run worker-pools update WORKER_POOL \\\n --scaling=INSTANCE_COUNT\n```\n\n### Terraform\n\n\u003cbr /\u003e\n\nTo learn how to apply or remove a Terraform configuration, see\n[Basic Terraform commands](/docs/terraform/basic-commands).\n\n\u003cbr /\u003e\n\n resource \"google_cloud_run_v2_worker_pool\" \"default\" {\n name = \"\u003cvar translate=\"no\"\u003eWORKER_POOL\u003c/var\u003e\"\n location = \"\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e\"\n launch_stage = \"BETA\"\n\n template {\n containers {\n image = \"\u003cvar translate=\"no\"\u003eIMAGE_URL\u003c/var\u003e\"\n }\n }\n scaling {\n scaling_mode = \"MANUAL\"\n manual_instance_count = \"\u003cvar translate=\"no\"\u003eINSTANCE_COUNT\u003c/var\u003e\"\n }\n }\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eWORKER_POOL\u003c/var\u003e: the name of the worker pool.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the Google Cloud region---for example, `europe-west1`.\n- \u003cvar translate=\"no\"\u003eIMAGE_URL\u003c/var\u003e: a reference to the container image that contains the worker pool, such as `us-docker.pkg.dev/cloudrun/container/worker-pool:latest`.\n- \u003cvar translate=\"no\"\u003eINSTANCE_COUNT\u003c/var\u003e: the number of instances for the worker pool. This sets the worker pool to manual scaling. Specify a value of `0` to disable the worker pool.\n\nView scaling configuration for a worker pool\n--------------------------------------------\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. Click **Worker pools** to display the list of deployed worker pools.\n\n3. Click the worker pool you want to examine to display its details pane.\n\n4. The current scaling setting is shown above the worker pools revision list:\n **Scaling: Manual (Instances: )**.\n\n| **Note:** You can also use the Google Cloud CLI command [`gcloud beta run worker-pools describe`](/sdk/gcloud/reference/beta/run/worker-pools/describe) to view configuration details.\n\nDisable a worker pool\n---------------------\n\nTo disable a worker pool, use the following command to set scaling to zero: \n\n```bash\ngcloud beta run worker-pools update WORKER_POOL --scaling=0\n```\n\nReplace \u003cvar translate=\"no\"\u003eWORKER_POOL\u003c/var\u003e with the name of your worker pool."]]