Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menunjukkan cara menskalakan pool pekerja secara manual.
Ringkasan
Penskalaan manual memungkinkan Anda menetapkan jumlah instance
tertentu
tanpa memerlukan deployment ulang.
Hal ini memberi Anda opsi untuk menulis logika penskalaan sendiri menggunakan sistem eksternal. Lihat Kafka Autoscaler
untuk contohnya.
Pertimbangan penagihan saat menggunakan penskalaan manual
Saat Anda menggunakan penskalaan manual, semua instance yang Anda minta akan
ditagih sebagai instance aktif, meskipun instance tersebut sedang tidak digunakan.
Untuk mengetahui detail penagihan selengkapnya, lihat halaman harga.
Peran yang diperlukan
Untuk mendapatkan izin yang
Anda perlukan untuk men-deploy kumpulan pekerja Cloud Run,
minta administrator untuk memberi Anda
peran IAM berikut:
Jika Anda sedang mengonfigurasi kumpulan pekerja baru, pilih Worker pools dari menu, lalu
klik Deploy container. Jika Anda
mengonfigurasi kumpulan pekerja yang ada, klik kumpulan pekerja untuk menampilkan
panel detailnya, lalu klik ikon pena di samping Penskalaan di kanan atas
panel detail.
Temukan formulir Penskalaan (untuk kumpulan pekerja baru) atau formulir Edit penskalaan untuk kumpulan pekerja yang ada.
Di kolom berlabel Number of instances, tentukan jumlah instance container untuk layanan.
Selesaikan spesifikasi.
Klik Buat untuk kumpulan pekerja baru atau Simpan untuk kumpulan pekerja yang ada.
gcloud
Untuk menentukan penskalaan bagi kumpulan pekerja baru, gunakan perintah deploy:
INSTANCE_COUNT: jumlah instance untuk worker pool.
Tindakan ini akan menyetel kumpulan pekerja ke penskalaan manual. Tentukan nilai 0 untuk menonaktifkan
worker pool.
IMAGE_URL: referensi ke image container yang
berisi worker pool, seperti us-docker.pkg.dev/cloudrun/container/worker-pool:latest.
Tentukan penskalaan untuk worker pool yang ada menggunakan perintah
update berikut:
REGION: Google Cloud region—misalnya,
europe-west1.
IMAGE_URL: referensi ke image container yang
berisi worker pool, seperti us-docker.pkg.dev/cloudrun/container/worker-pool:latest.
INSTANCE_COUNT: jumlah instance untuk worker pool.
Tindakan ini akan menyetel kumpulan pekerja ke penskalaan manual. Tentukan nilai 0 untuk
menonaktifkan worker pool.
Melihat konfigurasi penskalaan untuk kumpulan pekerja
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-21 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."]]