此為選填欄位。如果您要在 VPC Service Controls 範圍內建立私人集區,請將這個欄位的值設為 NO_PUBLIC_EGRESS。如果未在私人集區設定檔中加入這個欄位,系統會啟用公開輸出。
如要瞭解如何為私人集區設定 VPC Service Controls,請參閱使用 VPC Service Controls。
此為選填欄位。設定這個欄位的值,指定 VM 可在對等互連網路的已分配範圍內指派的內部 IP 範圍。如果指定的 IP 範圍無法在私人連線範圍內分配 (例如因大小限制或起始 IP 無效),則無法建立私人集區。
peeredNetworkIpRange 是以無類別跨網域路由 (CIDR) 標記法指定,格式為 'STARTING_IP/SUBNET_PREFIX_SIZE'。如果使用這個欄位,就必須指定 SUBNET_PREFIX_SIZE。SUBNET_PREFIX_SIZE 決定 IP 範圍的大小。開頭必須為斜線 (/),且值須小於或等於 29。STARTING_IP 部分為選用,可指定範圍的起始位址。如果未指定 STARTING_IP,系統會從私人連線範圍內自動指派起始位址。如果未指定 peeredNetworkIpRange 的值,系統會使用 /24 的預設值,自動指派 IP 範圍為 256 個 IP 的起始 IP。
SUBNET_PREFIX_SIZE 的值不得超過 29。數字越大,代表子網路前置越大,可用的 IP 就越少,IP 範圍也會越小。由於 IP 位址為 32 位元,前置大小為 /24 時,範圍內可有 256 個可能的 IP (八位元),而前置大小為 /29 時,則有八個可能的 IP (三位元)。建構工具 VM 的數量上限,取決於範圍內可用的 IP 數量 (範圍內可能的 IP 總數減去兩個)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eA private pool config file is essential for defining the specifications of a private pool in Cloud Build, including disk size and machine type.\u003c/p\u003e\n"],["\u003cp\u003eThe private pool config file can be written in either YAML or JSON format, but when using \u003ccode\u003ecurl\u003c/code\u003e it must be in JSON.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003enetworkConfig\u003c/code\u003e is an optional setting for private pools that enables peering with a VPC network, requiring \u003ccode\u003epeeredNetwork\u003c/code\u003e to be defined and allowing \u003ccode\u003epeeredNetworkIpRange\u003c/code\u003e for IP range customization.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eworkerConfig\u003c/code\u003e is required to specify the setup of your private pool and to use optional fields such as \u003ccode\u003ediskSizeGb\u003c/code\u003e for disk size configuration and \u003ccode\u003emachineType\u003c/code\u003e to determine the type of Compute Engine.\u003c/p\u003e\n"],["\u003cp\u003eWhen setting a \u003ccode\u003epeeredNetworkIpRange\u003c/code\u003e subnet prefix it must not exceed 29, with a larger number resulting in a smaller number of useable IP's.\u003c/p\u003e\n"]]],[],null,["# Private pool configuration file schema\n\nA private pool configuration file (private pool config file) contains\ninstructions for Cloud Build to create a private pool based on\nyour specifications. A private pool config file contains information such as the\ndisk size and machine type you want to use for your private pool. The\nprivate pool config file is required when you create and manage private pools\nusing the `gcloud` tool or the Cloud Build API.\n| **Note:** The private pool config file is different from the [Cloud Build configuration file](/build/docs/build-config): the Cloud Build config file lets you configure your build whereas the private pool config file lets you configure your private pool.\n\nStructure of a private pool config file\n---------------------------------------\n\nYou can write the private pool config file using the YAML or the JSON\nsyntax. To create and manage private pools using `curl`, write\nthe private pool config file in the JSON format. To create and manage private\npools using the `gcloud` tool, write the private pool config file in the\nYAML or the JSON format.\n\nA private pool config file has the following structure: \n\n### YAML\n\n privatePoolV1Config:\n networkConfig:\n egressOption: NO_PUBLIC_EGRESS\n peeredNetwork: '\u003cvar translate=\"no\"\u003ePEERED_NETWORK\u003c/var\u003e'\n peeredNetworkIpRange: '\u003cvar translate=\"no\"\u003ePEERED_NETWORK_IP_RANGE\u003c/var\u003e'\n workerConfig:\n diskSizeGb: '\u003cvar translate=\"no\"\u003ePRIVATE_POOL_DISK_SIZE\u003c/var\u003e'\n machineType: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003ePRIVATE_POOL_MACHINE_TYPE\u003c/span\u003e\u003c/var\u003e\n\n### JSON\n\n {\n \"privatePoolV1Config\": {\n \"networkConfig\": {\n \"egressOption\": \"NO_PUBLIC_EGRESS\",\n \"peeredNetwork\": \"\u003cvar translate=\"no\"\u003ePEERED_NETWORK\u003c/var\u003e\",\n \"peeredNetworkIpRange\": \"\u003cvar translate=\"no\"\u003ePEERED_NETWORK_IP_RANGE\u003c/var\u003e\"\n },\n \"workerConfig\": {\n \"diskSizeGb\": \"\u003cvar translate=\"no\"\u003ePRIVATE_POOL_DISK_SIZE\u003c/var\u003e\",\n \"machineType\": \"\u003cvar translate=\"no\"\u003ePRIVATE_POOL_MACHINE_TYPE\u003c/var\u003e\"\n }\n }\n }\n\nThe fields in the private pool config file are explained as follows:\n\n`networkConfig`\n---------------\n\nThis is an optional field. Specify `networkConfig` only if you're peering your\nVPC network with the service producer network.\n\n### `egressOption`\n\nThis is an optional field. Set the value of this field to `NO_PUBLIC_EGRESS` if\nyou're creating your private pool within a VPC Service Controls perimeter. If you\ndon't include this field in the private pool config file, public egress is enabled.\nFor information on setting up VPC Service Controls for private pools, see\n[Using VPC Service Controls](/build/docs/private-pools/using-vpc-service-controls).\n\n### `peeredNetwork`\n\nThis is a required field if your private pool config file contains the `networkConfig`\nfield. Set the value of this field to the network\nresource URL of the VPC network that is peered to the service\nproducer network. The network resource URL must be of the format\n`projects/`\u003cvar translate=\"no\"\u003eNETWORK_PROJECT_ID\u003c/var\u003e`/global/networks/`\u003cvar translate=\"no\"\u003eNETWORK_NAME\u003c/var\u003e,\nwhere \u003cvar translate=\"no\"\u003eNETWORK_PROJECT_ID\u003c/var\u003e is the project ID of\nthe Google Cloud project that holds your VPC network and\n\u003cvar translate=\"no\"\u003eNETWORK_NAME\u003c/var\u003e is the name of your VPC network.\nIf you don't specify a value, Cloud Build uses the [service producer\nnetwork](/build/docs/private-pools/set-up-private-pool-environment) by default.\n\n### `peeredNetworkIpRange`\n\nThis is an optional field. Set the value of this field to specify the internal\nIP range that VMs can be assigned to within the peered network's allocated\nrange. If the specified IP range can't be allocated within the range of the\nprivate connection, for example due to size limitations or an invalid starting\nIP, then the private pool can't be created.\n\n`peeredNetworkIpRange` is specified using Classless Inter-Domain Routing (CIDR)\nnotation in the format `'STARTING_IP/SUBNET_PREFIX_SIZE'`.\nIf this field is used, then `SUBNET_PREFIX_SIZE` must be specified.\n`SUBNET_PREFIX_SIZE` determines the size of the IP range. It must begin with a\nslash (`/`) and have a value less than or equal to 29.The `STARTING_IP` portion\nis optional, and specifies the starting address of the range. If the\n`STARTING_IP` is not specified, then a starting address is automatically\nassigned from within the private connection range. If no value is specified for\n`peeredNetworkIpRange`, a default value of `/24` will be used which\nautomatically assigns a starting IP with a range of 256 IPs.\n\nThe value of `SUBNET_PREFIX_SIZE` must not exceed 29. A larger number specifies\na larger subnet prefix, which would leave fewer possible IPs and result in a\nsmaller IP range. Since an IP address is 32 bits, a prefix size of `/24` allows\n256 possible IPs in the range (eight bits) whereas a prefix size of `/29` leaves\neight possible IPs (three bits). The maximum number of builder VMs is limited to\nthe number of usable IPs in the range (the total possible number of IPs in the\nrange minus two).\n\nSee the following for examples of the `peeredNetworkIpRange` field:\n\n- `192.168.0.0/24` specifies an IP range starting at 192.168.0.0 with a subnet prefix size of 24 (256 IPs, with 254 usable IPs).\n- `/29` specifies a range with an automatically determined starting IP and a subnet prefix size of 29 (eight IPs, with six usable IPs).\n\n`workerConfig`\n--------------\n\nThis is a required field. It contains configuration options for your private\npool.\n\n### `diskSizeGb`\n\nThis is an optional field. Use this field to specify a disk size for your\nprivate pool instance in GB. Specify a value greater than or equal to\n100 and less than or equal to 4000. If you don't include this field in your\nprivate pool config file, or if you specify `0` as the value of this field,\nCloud Build uses the default value of 100.\n\n### `machineType`\n\nThis is an optional field. Use this field to specify the [Compute Engine\nmachine type](/compute/docs/machine-resource#predefined_machine_types) for your\nprivate pool instance. If you don't specify a value, then Cloud Build\nuses the default value of `e2-medium`. Otherwise, specify one of the following\nmachine types: \n\n#### Machine types\n\nThe following table shows the availability of machine types by region: \n\n#### Machine type availability by region\n\n### `enableNestedVirtualization`\n\nThis is an optional field. If your private pool uses a VM with a\n`C3` machine type, then you can enable nested virtualization to run other\nVM instances inside your private pool's VM. For more information, see\n[About nested virtualization](/compute/docs/instances/nested-virtualization/overview).\n\nWhat's next\n-----------\n\n- Learn how to [run builds in private pools](/build/docs/private-pools/run-builds-in-private-pool).\n- Learn how to [create and manage private pools](/build/docs/private-pools/create-manage-private-pools)."]]