Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite wird beschrieben, wie Sie Ihren Worker-Pool manuell skalieren.
Übersicht
Bei der manuellen Skalierung können Sie eine bestimmte Anzahl von Instanzen festlegen, ohne dass eine erneute Bereitstellung erforderlich ist.
So haben Sie die Möglichkeit, Ihre eigene Skalierungslogik mit einem externen System zu schreiben. Ein Beispiel hierfür finden Sie unter Kafka Autoscaler.
Abrechnung bei Verwendung der manuellen Skalierung
Wenn Sie die manuelle Skalierung verwenden, werden alle von Ihnen angeforderten Instanzen als aktive Instanzen abgerechnet, auch wenn sie sich im Leerlauf befinden.
Vollständige Abrechnungsdetails finden Sie auf der Preisseite.
Erforderliche Rollen
Bitten Sie Ihren Administrator, Ihnen die folgenden IAM-Rollen zuzuweisen, um die Berechtigungen zu erhalten, die Sie zum Bereitstellen von Cloud Run-Worker-Pools benötigen:
Wenn Sie einen neuen Worker-Pool konfigurieren, wählen Sie im Menü Worker-Pools aus und klicken Sie auf Container bereitstellen. Wenn Sie einen vorhandenen Worker-Pool konfigurieren, klicken Sie auf den Worker-Pool, um das Detailfeld aufzurufen, und dann oben rechts im Detailfeld auf das Stiftsymbol neben Skalierung.
Suchen Sie das Formular Skalierung (für einen neuen Worker-Pool) oder das Formular Skalierung bearbeiten für einen vorhandenen Worker-Pool.
Geben Sie im Feld Anzahl der Instanzen die Anzahl der Containerinstanzen für den Dienst an.
Schließen Sie die Spezifikation ab.
Klicken Sie auf Erstellen, um einen neuen Worker-Pool zu erstellen, oder auf Speichern, um einen vorhandenen Worker-Pool zu speichern.
gcloud
Verwenden Sie den Befehl deploy, um die Skalierung für einen neuen Worker-Pool anzugeben:
INSTANCE_COUNT: Die Anzahl der Instanzen für den Worker-Pool.
Dadurch wird der Worker-Pool auf die manuelle Skalierung festgelegt. Geben Sie den Wert 0 an, um den Worker-Pool zu deaktivieren.
IMAGE_URL: Ein Verweis auf das Container-Image, das den Worker-Pool enthält, z. B. us-docker.pkg.dev/cloudrun/container/worker-pool:latest.
Mit dem folgenden update-Befehl können Sie die Skalierung für einen vorhandenen Worker-Pool angeben:
REGION: die Google Cloud Region, z. B. europe-west1.
IMAGE_URL: Ein Verweis auf das Container-Image, das den Worker-Pool enthält, z. B. us-docker.pkg.dev/cloudrun/container/worker-pool:latest.
INSTANCE_COUNT: Die Anzahl der Instanzen für den Worker-Pool.
Dadurch wird der Worker-Pool auf die manuelle Skalierung festgelegt. Geben Sie den Wert 0 an, um den Worker-Pool zu deaktivieren.
Skalierungskonfiguration für einen Worker-Pool ansehen
Rufen Sie in der Google Cloud Console Cloud Run auf:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 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."]]