这是一个可选字段。如果要在 VPC Service Controls 边界内创建专用池,请将此字段的值设置为 NO_PUBLIC_EGRESS。如果您不在专用池配置文件中添加此字段,系统会启用公共出站流量。如需了解如何为专用池设置 VPC Service Controls,请参阅使用 VPC Service Controls。
这是一个可选字段。设置此字段的值,以指定可在对等网络的分配范围内分配给虚拟机的内部 IP 地址范围。如果指定的 IP 地址范围无法在专用连接的范围内分配(例如,由于大小限制或起始 IP 地址无效),则无法创建专用 IP 地址池。
peeredNetworkIpRange 使用无类别域间路由 (CIDR) 表示法指定,格式为 'STARTING_IP/SUBNET_PREFIX_SIZE'。如果使用此字段,则必须指定 SUBNET_PREFIX_SIZE。SUBNET_PREFIX_SIZE 决定 IP 地址范围的大小。该值必须以斜杠 (/) 开头,且值小于或等于 29。STARTING_IP 部分是可选的,用于指定范围的起始地址。如果未指定 STARTING_IP,系统会从专用连接范围内自动分配一个起始地址。如果未为 peeredNetworkIpRange 指定任何值,系统将使用默认值 /24,该值会自动分配一个范围为 256 个 IP 地址的起始 IP 地址。
SUBNET_PREFIX_SIZE 的值不得超过 29。数字越大,指定的子网前缀就越大,可用的 IP 就越少,IP 范围就越小。由于 IP 地址为 32 位,因此前缀大小为 /24 时,范围内允许 256 个可能的 IP 地址(8 位),而前缀大小为 /29 时,范围内允许 8 个可能的 IP 地址(3 位)。构建器虚拟机的数量上限为该范围内可用 IP 的数量(该范围内可能的 IP 总数减去 2)。
请参阅以下 peeredNetworkIpRange 字段示例:
192.168.0.0/24 指定了从 192.168.0.0 开始且子网前缀大小为 24 的 IP 地址范围(256 个 IP 地址,其中 254 个 IP 地址可用)。
/29 指定一个范围,其中包含自动确定的起始 IP 地址,并且子网前缀大小为 29(8 个 IP 地址,其中 6 个可用)。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-25。"],[[["\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)."]]