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:
- For a cluster using the container tunnel network model, the value depends only on the maximum number of pods on a node.
- For clusters using the VPC network model, the value depends on the maximum number of pods on a node and the minimum number of container IP addresses that can be allocated to a node. It is recommended that the maximum number of pods on a node be less than or equal to the number of container IP addresses that can be allocated to the node. Otherwise, pods may fail to be scheduled.
- For CCE Turbo clusters using the Cloud Native Network 2.0 model, the value depends on the maximum number of pods on a node and the minimum number of ENIs on a CCE Turbo cluster node. It is recommended that the maximum number of pods on a node be less than or equal to the number of ENIs on the node. Otherwise, pods may fail to be scheduled.
Number of Container IP Addresses That Can Be Allocated on a Node
If you select VPC network for Network Model when creating a CCE cluster, you also need to set the number of container IP addresses that can be allocated to each node (alpha.cce/fixPoolMask). If the pod uses the host network (hostNetwork: true), the pod does not occupy the IP address of the allocatable container network. For details, see Container Network vs. Host Network.
This parameter affects the maximum number of pods that can be created on a node. Each pod occupies an IP address (when the container network is used). If the number of available IP addresses is insufficient, pods cannot be created. If the pod uses the host network (hostNetwork: true), the pod does not occupy the IP address of the allocatable container network.
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.
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.
Table 1 lists the default maximum number of pods on a node based on node specifications.
Number of Node ENIs (CCE Turbo Clusters)
In a CCE Turbo cluster, ECS nodes use sub-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.
Container Network vs. 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: The pod uses the host network (hostNetwork: true needs to be configured for the pod) and occupies the host port. The pod IP address is the host IP address. The pod does not occupy the IP addresses of the container network. To use the host network, you must confirm whether the container ports conflict with the host ports. Do not use the host network unless you know exactly which host port is used by which container.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.