Configure Subnets
TOC
IP Allocation Rules
If a project or namespace is assigned multiple subnets, an IP address will be randomly selected from one of the subnets.
-
Project Allocation:
- If a project is not bound to a subnet, Pods in all namespaces under that project can only use IP addresses from the default subnet. If there are insufficient IP addresses in the default subnet, the Pods will not be able to start.
- If a project is bound to a subnet, Pods in all namespaces under that project can only use IP addresses from that specific subnet.
-
Namespace Allocation:
- If a namespace is not bound to a subnet, Pods in that namespace can only use IP addresses from the default subnet. If there are insufficient IP addresses in the default subnet, the Pods will not be able to start.
- If a namespace is bound to a subnet, Pods in that namespace can only use IP addresses from that specific subnet.
Calico Network
Creating subnets in the Calico network to achieve finer granularity of network isolation for resources within the cluster.
Constraints and Limitations
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.
Example Subnet custom resource (CR) with Calico Network
- When
defaultIf true, use VXLAN encapsulation. - See Encapsulation Mode parameters and Encapsulation Protocol parameters.
- See Outbound Traffic NAT parameters.
Creating a Subnet in the Calico network by using the web console
-
Go to Administrator.
-
In the left navigation bar, click Network Management > Subnets.
-
Click Create Subnet.
-
Refer to the following instructions to configure the relevant parameters.
-
Click Confirm.
-
On the subnet details page, select Actions > Allocate Project / Allocate Namespace.
-
Complete the configuration and click Allocate.
Creating a Subnet in the Calico network by using the CLI
Reference Content
The dynamic matching relationship between CIDR and blockSize is shown in the table below.
Subnet configurations with prefixes greater than 31 are not supported.
Kube-OVN Network
Creating a subnet in the Kube-OVN Overlay Network to achieve more granular network isolation of resources in the cluster.
The platform has a built-in join subnet for communication between nodes and Pods; please avoid conflicts in network segments between join and newly created subnets.
Example Subnet custom resource (CR) with Kube-OVN Overlay Network
- See Outbound Traffic NAT parameters.
- See Reserved IP parameters.
- See Gateway Type parameters. The available values are
distributedorcentralized. - See Gateway Nodes parameters.
- See ECMP parameters. Provided that you contact the administrator to enable the feature gate.
Creating a Subnet in the Kube-OVN Overlay Network by using the web console
-
Go to Administrator.
-
In the left navigation bar, click on Network Management > Subnet.
-
Click on Create Subnet.
-
Refer to the following instructions to configure the related parameters.
-
Click Confirm.
-
On the subnet details page, select Actions > Allocate Project / Namespace.
-
Complete the configuration and click Allocate.
Creating a Subnet in the Kube-OVN Overlay Network by using the the CLI
Underlay Network
Creating subnets in the Kube-OVN Underlay network not only enables finer-grained network isolation for resources but also provides a better performance experience.
The container network in Kube-OVN Underlay requires support from the physical network. Please refer to the best practices Preparing the Kube-OVN Underlay Physical Network to ensure network connectivity.
Usage Instructions
The general process for creating subnets in the Kube-OVN Underlay network is: Add Bridge Network > Add VLAN > Create Subnet.
- Default Network Card Name.
- Configure Network Card by Node.
Add Bridge Network by using the web console (Optional)
- Default Network Card Name.
- Configure Network Card by Node.
A bridge network refers to a bridge, and after binding the network card to the bridge, it can forward container network traffic, achieving intercommunication with the physical network.
Procedure:
-
Go to Administrator.
-
In the left navigation bar, click Network Management > Bridge Network.
-
Click Add Bridge Network.
-
Configure the relevant parameters based on the following instructions.
Note:
-
Target Pod refers to all Pods scheduled on the current node or Pods in namespaces bound to specific subnets scheduled to the current node. This depends on the scope of the subnet under the bridge network.
-
The nodes in the Underlay subnet must have multiple network cards, and the network card used by the bridge network must be exclusively assigned to the Underlay and cannot carry other traffic, such as SSH. For example, if the bridge network has three nodes planning for eth0, eth0, eth1 for exclusive use by the Underlay, then the default network card can be set as eth0, and the network card for node three can be eth1.
-
-
Click Add.
Add Bridge Network by using the CLI
Add VLAN by using the web console (Optional)
- VLAN ID.
- Bridge network reference.
The platform has a pre-configured ovn-vlan virtual LAN, which will connect to the provider bridge network. You can also configure a new VLAN to connect to other bridge networks, thereby achieving network isolation between VLANs.
Procedure:
-
Navigate to Administrator.
-
In the left navigation bar, click Network Management > VLAN.
-
Click Add VLAN.
-
Configure the relevant parameters based on the following instructions.
-
Click Add.
Add VLAN by using the CLI
Example Subnet custom resource (CR) with Kube-OVN Underlay Network
- VLAN reference.
Creating a Subnet in the Kube-OVN Underlay Network by using the web console
The platform also pre-configures a join subnet for communication between nodes and Pods in Overlay transport mode. This subnet will not be used in Underlay transport mode, so it is crucial to avoid IP segment conflicts between join and other subnets.
Procedure:
-
Navigate to Administrator.
-
In the left navigation bar, click Network Management > Subnet.
-
Click Create Subnet.
-
Configure the relevant parameters based on the following instructions.
-
Click Confirm.
-
On the subnet details page, select Action > Assign Project / Namespace.
-
Complete the configuration and click Assign.
Creating a Subnet in the Kube-OVN Underlay Network by using the CLI
Related Operations
When both Underlay and Overlay subnets exist in a cluster, you can configure the Automatic Intercommunication Between Underlay and Overlay Subnets as needed.
Subnet Management
Updating Gateway by using the web console
This includes changing the outbound traffic method, gateway nodes, and NAT configuration.
-
Go to Administrator.
-
In the left sidebar, click on Network Management > Subnets.
-
Click the name of the subnet.
-
Select Action > Update Gateway.
-
Update the parameter configurations; refer to the Parameter Description for details.
-
Click OK.
Updating Gateway by using the CLI
Updating Reserved IPs by using the web console
The gateway IP cannot be removed from the reserved IPs, while other reserved IPs can be edited, deleted, or added freely.
-
Go to Administrator.
-
In the left sidebar, click on Network Management > Subnets.
-
Click the name of the subnet.
-
Select Action > Update Reserved IP.
-
After completing the updates, click Update.
Updating Reserved IPs by using the CLI
Assigning Projects by using the web console
Assigning subnets to specific projects helps teams better manage and isolate network traffic for different projects, ensuring that each project has sufficient network resources.
-
Navigate to Administrator.
-
In the left sidebar, click on Network Management > Subnets.
-
Click the name of the subnet.
-
Select Action > Assign Project.
-
After adding or removing projects, click Assign.
Assigning Projects by using the CLI
Assigning Namespaces by using the web console
Assigning subnets to specific namespaces allows for finer network isolation.
Note: The assignment process will rebuild the gateway, and outbound data packets will be discarded! Please ensure no business applications are currently accessing external clusters.
-
Navigate to Administrator.
-
In the left sidebar, click on Network Management > Subnets.
-
Click the name of the subnet.
-
Select Action > Assign Namespace.
-
After adding or removing namespaces, click Assign.
Assigning Namespaces by using the CLI
Expanding Subnets by using the web console
When the reserved IP range of a subnet reaches its usage limit or is about to be exhausted, it can be expanded based on the original subnet range without affecting the normal operation of existing services.
-
Navigate to Administrator.
-
In the left sidebar, click on Network Management > Subnets.
-
Click the name of the subnet.
-
Select Action > Expand Subnet.
-
Complete the configuration and click Update.
Expanding Subnets by using the CLI
Managing Calico Networks
Support for assigning projects and namespaces; for details, please refer to the project assignment and namespace assignment.
Delete Subnet by using the web console
-
When a subnet is deleted, if there are still container groups using the IPs within the subnet, the container groups can continue to run and the IP addresses will remain unchanged, but they will be unable to communicate over the network. The container groups can be rebuilt to use IPs within the default subnet, or assign a new subnet to the namespace where the container groups reside for usage.
-
The default subnet cannot be deleted.
-
Go to Administrator.
-
In the left navigation bar, click Network Management > Subnets.
-
Click ⋮ > Delete, and proceed with the deletion.