此示例 IP 地址块文件预留了来自三个子网的 IP 地址,每个子网都表示为 blocks[i]。blocks[i].gateway 十分重要,因为它用作 IP 地址块的标识。您需要在 vSphere 基础设施配置文件中将相同的 IP 地址添加到 VSphereInfraConfig 自定义资源中的 topologyDomains[i].network.gateway。
有三个 IP 地址使用 isControlPlane: true 进行配置,这表示这些 IP 地址仅预留用于控制平面节点。在管理员集群或用户集群的 IP 地址块文件中,必须为控制平面节点预留三个 IP 地址。请根据集群的适用拓扑,在目标子网中预留这些地址。
由于控制平面节点必须位于单个拓扑网域中,因此控制平面节点的 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"]],["最后更新时间 (UTC):2025-09-01。"],[],[],null,["This page describes the fields in an IP block file, which is used in the setup\nof Google Distributed Cloud.\n\nYou use an IP block file to describe a set of node machines and the network that\nthe machines are connected to. You create a separate IP block file for each\ncluster. Both the admin and user cluster configuration files have a field called\n`network.ipMode.ipBlockFilePath`. You specify the absolute or relative path\nof the IP block in this field.\n\nUse an IP block file to list the IP addresses and optionally the hostnames in the\nfollowing cases:\n\n- User clusters:\n\n - If [`network.ipMode.type`](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/user-cluster-configuration-file-latest#network-ipmode-type-field)\n is set to `\"static\"` in the user cluster configuration file, list the IP\n addresses for worker nodes in the user cluster IP block file.\n\n - If\n [`infraConfigFilePath`](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/admin-cluster-configuration-file-latest#infra-config-file-path-field)\n is configured in the admin cluster configuration file (which enables\n topology domains), list the IP addresses for the control-plane nodes in the\n user cluster IP block file. The IP addresses for control-plane nodes are\n always static IP addresses even if worker nodes use DHCP.\n\n- Admin clusters:\n\n - If\n [`infraConfigFilePath`](/kubernetes-engine/distributed-cloud/vmware/docs/how-to/admin-cluster-configuration-file-latest#infra-config-file-path-field)\n is configured in the admin cluster configuration file (which enables\n topology domains), list the IP addresses for the control-plane nodes in the\n admin cluster IP block file.\n\n - 1.16 and lower non-HA admin cluster: list the IP addresses for the\n control-plane node and add-on nodes in the admin cluster IP block file.\n\n - 1.16 and lower HA admin cluster: list the IP addresses for add-on nodes\n in an IP block file.\n\n - 1.29 and lower kubeception user clusters: list the IP addresses for\n the user cluster control-plane nodes in the admin cluster IP block file.\n\n| **Note:** If your system uses a Docker runtime, the default network of the Docker daemon is `172.17.0.0/16`. Make sure that the IP addresses you select for the VMs for the admin cluster aren't in that network.\n\n**Template**\nClick to see a template for an IP block file. \n\n```yaml\n blocks:\n - netmask: \"\u003cvar translate=\"no\"\u003eNETMASK\u003c/var\u003e\"\n gateway: \"\u003cvar translate=\"no\"\u003eGATEWAY\u003c/var\u003e\"\n ips:\n - ip: \"\u003cvar translate=\"no\"\u003eIP_ADDRESS_1\u003c/var\u003e\"\n hostname: \"\u003cvar translate=\"no\"\u003eHOSTNAME_1\u003c/var\u003e\"\n - ip: \"\u003cvar translate=\"no\"\u003eIP_ADDRESS_2\"\u003c/var\u003e\n hostname: \"\u003cvar translate=\"no\"\u003eHOSTNAME_2\u003c/var\u003e\"\n - ip: \"\u003cvar translate=\"no\"\u003eIP_ADDRESS_3\"\u003c/var\u003e\n hostname: \"\u003cvar translate=\"no\"\u003eHOSTNAME_3\u003c/var\u003e\"\n ...\n \n```\n\nFilling in the fields in an IP block file\n\nThis section describes the fields in an IP block file.\n\n`blocks`\n\nAn array of objects, each of which describes a set of hosts.\n\n`blocks[i].netmask`\n\nString. The subnet mask for the set of hosts. For example:\n\n```\nblocks:\n- netmask: \"255.255.252.0\"\n```\n\n`blocks[i].gateway`\n\nString. The address of the default gateway for the set of hosts. For example:\n\n```\nblocks:\n- netmask: \"255.255.252.0\"\n gateway: \"172.16.23.254\"\n```\n\n`blocks[i].ips`\n\nAn array of objects. Each object has an individual IP address or a\n[CIDR](https://tools.ietf.org/html/rfc4632) block of IP addresses.\n\n- If the object has an individual IP address, optionally, it can also have a\n hostname.\n\n- If you set `ip` to a CIDR block, don't specify a value for `hostname`.\n\n- When you don't specify a value for `hostname`, Google Distributed Cloud uses the\n VM's name from vSphere as the hostname.\n\n`blocks[i].isControlPlane`\n\nIf `infraConfigFilePath` is configured in the admin cluster configuration file,\nand if the IP address is for a control-plane node, include\n`isControlPlane: true`. For user cluster worker nodes, specify\n`false` or omit the field because the default value is `false`.\n\nExample configuration files\n\nThe section provides some configurations with examples values filled in.\n\nExample 1\n\nThis example specifies six IP addresses: two individual addresses and\na CIDR block of four addresses.\n\n```\nblocks:\n- netmask: \"255.255.252.0\"\n gateway: \"203.0.113.1\"\n ips:\n - ip: 198.51.100.10\n hostname: worker-node1\n - ip: 198.51.100.11\n hostname: worker-node2\n - ip: 198.51.100.12/30 # 198.51.100.12 - 198.51.100.15\n```\n\nExample 2\n\nThis example shows an IP block file configured for topology domains.\n\n```\nblocks:\n- netmask: 255.255.255.0\n gateway: 100.115.222.254\n ips:\n - ip: 100.115.222.204\n hostname: worker-1\n - ip: 100.115.222.205\n hostname: cp-1\n isControlPlane: true\n - ip: 100.115.222.206\n hostname: cp-2\n isControlPlane: true\n - ip: 100.115.222.207\n hostname: cp-3\n isControlPlane: true\n - ip: 100.115.222.220/28 # 100.115.222.208 - 100.115.222.223\n- netmask: 255.255.255.0\n gateway: 100.115.223.254\n ips:\n - ip: 100.115.223.206\n hostname: worker-2\n - ip: 100.115.223.220/28 # 100.115.223.208 - 100.115.223.223\n- netmask: 255.255.255.0\n gateway: 100.115.224.254\n ips:\n - ip: 100.115.224.206\n hostname: worker-3\n - ip: 100.115.224.220/28 # 100.115.224.208 - 100.115.224.223\n```\n\nThis example IP block file reserved IP addresses from three subnets, and each\nsubnet is represented as `blocks[i]`. The `blocks[i].gateway` is important, as\nit works as the identification of the IP block. You add the same IP address to\n`topologyDomains[i].network.gateway` in the `VSphereInfraConfig` custom resource\ninside the\n[vSphere Infrastructure Configuration File.](/kubernetes-engine/distributed-cloud/vmware/docs/reference/vsphere-infrastructure-configuration-file)\n\nThere are three IPs configured with `isControlPlane: true`, which indicates that\nthese IP addresses are reserved for control-plane nodes only. In the\nIP block file of the admin cluster or user cluster, there must be three IP\naddresses reserved for control-plane nodes. Reserve them in the target subnet\naccording to the applicable topology of the cluster.\n\nBecause the control-plane nodes must be in a single topology domain, the\nIP addresses for the control-plane nodes must be in the same IP block."]]