Create subnets in the Calico network to achieve finer granularity of network isolation for resources within the cluster.
In an IPv6 cluster environment, the subnets created within the Calico network, by default, use VXLAN encapsulation. The ports required for VXLAN encapsulation differ from those of IPIP encapsulation. You need to ensure that UDP port 4789 is open.
Note: If a project or namespace is assigned multiple subnets, an IP address will be randomly selected from one of the subnets.
Project Allocation:
Namespace Allocation:
Go to Platform Management.
In the left navigation bar, click Network Management > Subnets.
Click Create Subnet.
Refer to the following instructions to configure the relevant parameters.
Parameter | Description |
---|---|
CIDR | After allocating the subnet to a project or namespace, the container groups within the namespace will randomly use IP addresses within this CIDR for communication. Note: For the correspondence between CIDR and BlockSize, please refer to Reference Content. |
Encapsulation Protocol | Select the encapsulation protocol. IPIP is not supported in dual-stack mode.
|
Encapsulation Mode | When the encapsulation protocol is IPIP or VXLAN, the encapsulation mode must be set, defaulting to Always.
|
Outbound Traffic NAT | Choose whether to enable outbound traffic NAT (Network Address Translation), which is enabled by default. It is primarily used to set the access addresses exposed to the external network when the subnet container group accesses the external network. When outbound traffic NAT is enabled, the host IP will be used as the access address for the current subnet container group; when not enabled, the IPs of the container groups in the subnet will be directly exposed to the external network. |
Click Confirm.
On the subnet details page, select Actions > Allocate Project / Allocate Namespace.
Complete the configuration and click Allocate.
The dynamic matching relationship between CIDR and blockSize is shown in the table below.
CIDR | blockSize Size | Number of Hosts | Size of a Single IP Pool |
---|---|---|---|
prefix<=16 | 26 | 1024+ | 64 |
16<prefix<=19 | 27 | 256~1024 | 32 |
prefix=20 | 28 | 256 | 16 |
prefix=21 | 29 | 256 | 8 |
prefix=22 | 30 | 256 | 4 |
prefix=23 | 30 | 128 | 4 |
prefix=24 | 30 | 64 | 4 |
prefix=25 | 30 | 32 | 4 |
prefix=26 | 31 | 32 | 2 |
prefix=27 | 31 | 16 | 2 |
prefix=28 | 31 | 8 | 2 |
prefix=29 | 31 | 4 | 2 |
prefix=30 | 31 | 2 | 2 |
prefix=31 | 31 | 1 | 2 |
Note: Subnet configurations with prefixes greater than 31 are not supported.