Help Center/ Cloud Container Engine/ User Guide/ Nodes/ Node O&M/ Maximum Number of Pods That Can Be Created on a Node
Updated on 2024-09-02 GMT+08:00

Maximum Number of Pods That Can Be Created on a Node

Calculation of the Maximum Number of Pods on a Node

The maximum number of pods that can be created on a node is calculated based on the cluster type:

Network Model

Maximum Number of Pods on a Node

Recommended Configuration

Tunnel network

Maximum number of pods on a node

None

VPC network

The smaller value between the maximum number of pods on a node and the number of container IP addresses that can be allocated on a node

To ensure new pods run smoothly on a node, make sure that the number of pods on the node does not exceed the number of container IP addresses that can be assigned to it. If there are not enough container IP addresses available on the node, the new pods may not function properly.

Cloud Native Network 2.0 (for CCE Turbo clusters)

The smaller value between the maximum number of pods on a node and the number of ENIs on a node in a CCE Turbo cluster

To ensure new pods run smoothly on a node, make sure that the number of pods on the node does not exceed the number of ENIs on it. If there are not enough ENIs available on the node, the new pods may not function properly.

Number of Allocatable Container IP Addresses on a Node

When creating a cluster in the VPC network model, follow the rules for managing container IP addresses and specify the number of container IP addresses that can be allocated to each node using alpha.cce/fixPoolMask.

The maximum number of pods that can be created on a node is determined by the number of container IP addresses that can be allocated to it. In a container network, each pod needs its own IP address. If there are not enough pre-allocated container IP addresses on the node, pods cannot be created. If hostNetwork: true is configured in the YAML file, pods will use the host network instead of the allocatable container IP addresses. For details, see Pod IP Address Allocation Differences Between the Container Network and Host Network.

Figure 1 Specifying the number of allocatable container IP addresses on a node in the VPC network model

By default, a node occupies three container IP addresses (network address, gateway address, and broadcast address). Therefore, the number of container IP addresses that can be allocated to a node equals the number of selected container IP addresses minus 3. For example, in the preceding figure, the number of container IP addresses that can be allocated to a node is 125 (128 – 3).

Maximum Number of Pods on a Node

When creating a node, you can configure the maximum number of pods (maxPods) that can be created on the node. This parameter is a configuration item of kubelet and determines the maximum number of pods that can be created by kubelet.

For nodes in the default node pool (DefaultPool), the maximum number of pods cannot be changed after the nodes are created.

After a node in a custom node pool is created, you can modify the max-pods parameter in the node pool configuration to change the maximum number of pods on the node. For details, see Configuring a Node Pool.

By default, the maximum number of pods on a node can be adjusted to 256. To increase the deployment density on a node, submit a service ticket to increase the maximum number of pods on a node, which can be 512.

Figure 2 Configuring the maximum number of pods during node creation

Table 1 lists the default maximum number of pods on a node based on node specifications.

Table 1 Default maximum number of pods on a node

Memory

Max. Pods

4 GB

20

8 GB

40

16 GB

60

32 GB

80

64 GB or above

110

Number of Node ENIs (Available Only in CCE Turbo Clusters)

In a CCE Turbo cluster, ECS nodes use sub-ENIs and BMS nodes use ENIs. The maximum number of pods that can be created on a node depends on the number of ENIs that can be used by the node.

Figure 3 Node ENIs

Pod IP Address Allocation Differences Between the Container Network and Host Network

When creating a pod, you can select the container network or host network for the pod.

  • Container network (default): Each pod is assigned an IP address by the cluster networking add-ons, which occupies the IP addresses of the container network.
  • Host network: Pods with hostNetwork: true configured directly use the network of the host. For details, see Configuring hostNetwork for Pods. After the configuration, the pods use the ports on the host and their IP address is identical to that of the host, without relying on the IP addresses of the container network. When using a host network, avoid conflicts between the pod ports and service ports on the host. Use a host network only if a particular application requires access to a specific port on the host.