All Products
Search
Document Center

Container Service for Kubernetes:Increase the maximum number of pods in a cluster

Last Updated:Nov 25, 2024

The maximum number of pods on a worker node varies based on the network plug-in and cannot be adjusted in most cases. In Terway mode, the maximum number of pods on a node depends on the number of elastic network interfaces (ENIs) provided by the Elastic Compute Service (ECS) instance. In Flannel mode, the maximum number of pods on a node depends on the cluster configurations that you specify when you create the cluster. The upper limit cannot be modified after the cluster is created. When the number of pods in your cluster reaches the upper limit, we recommend that you scale out the node pool in the cluster to increase the number of pods in the cluster.

Maximum number of pods

Terway

image

Maximum number of pods in the node network

Note

For more information, see Work with Terway.

Terway mode

Maximum number of pods on a node

Example

Maximum number of pods that support static IP addresses, separate vSwitches, and separate security groups on a node

Shared ENI mode

(EniQuantity - 1) × EniPrivateIpAddressQuantity, where EniQuantity is the number of ENIs provided by an ECS instance type, and EniPrivateIpAddressQuantity is the number of private IP addresses provided by an ENI.

Note

The maximum number of pods on a node must be greater than 11 so that the node can join a cluster.

In this example, the general-purpose ecs.g7.4xlarge instance type is used. This instance type provides 8 ENIs, and each ENI provides 30 private IP addresses. The maximum number of pods on a node is (8 - 1) × 30 = 210.

Important

The maximum number of pods that can use ENIs on a node is a fixed value determined by the instance type. If you modify the value of the maxPods parameter, only the maximum number of pods that use the hostNetwork mode is affected.

0

Shared ENI + Trunk ENI

EniTotalQuantity -EniQuantity, where EniTotalQuantity is the maximum number of network interfaces supported by an ECS instance type, and

Exclusive ENI

EniQuantity - 1

Note

To join the cluster, the maximum number of pods on a node must be greater than 6.

In this example, the general-purpose ecs.g7.4xlarge instance type is used. This instance type supports 8 ENIs. The maximum number of pods supported by a node is (8 - 1) = 7.

EniQuantity - 1

Maximum number of pods in the host network

By default, the maximum number of pods in the host network is three and cannot be modified. If you modify the maximum number of pods in the host network, IP addresses may fail to be allocated to newly created pods.

Flannel

In Flannel mode, the maximum number of pods on a node depends on the cluster configurations that you specify when you create the cluster and cannot be modified after the cluster is created.

image

How to increase the maximum number of pods in a cluster

You can use the following methods to increase the maximum number of pods in a cluster when different network plug-ins are used. Note that the following methods may not increase the maximum number of pods on a node.

(Recommended) Scale out the node pool in the cluster

Supported network plug-ins: Terway and Flannel.

Description: Manually or automatically scale out the node pool in the cluster. For more information, see Scale a node pool and Node scaling.

Impact: This method has no negative impact on your workloads. If the cluster contains an excessively large number of nodes, the availability and performance of the cluster may be compromised. We recommend that you retain a proper number of nodes in the cluster. For more information, see Suggestions on using large-scale clusters.

Upgrade the instance specifications of worker nodes to increase the maximum number of pods on a node

Supported network plug-ins: Terway.

Description: Upgrade the instance specifications of worker nodes to increase the maximum number of pods on a node. For more information, see Upgrade the configurations of a worker node. The pod upper limit of worker nodes does not linearly increase with the instance specifications of worker nodes. The maximum number of pods supported by a node depends on the number of ENIs provided by the ECS instance family.

Impact: You need to restart an ECS instance to make the specification upgrade take effect. This may lead to temporary service interruptions. Before you upgrade the instance specifications, assess the loads of your businesses and decide whether redundant nodes are required. Then, drain the node that you want to upgrade and then remove it from the cluster. Upgrade the instance specifications during off-peak hours and re-add the node to the cluster. For more information about instance specification upgrades, such as billing details, see Overview of instance configuration changes and Upgrade the configurations of a worker node. For more information about how to remove and add existing nodes, see Remove a node and Add existing ECS instances to an ACK cluster.

Recreate the cluster and reset the pod CIDR block

Supported network plug-ins: Flannel.

Description: Create a cluster and set the Number of Pods per Node parameter based on your business requirements. The value of the Number of Pods per Node parameter is the maximum number of pods supported by the node. For more information, see Work with Flannel.

Description: Redeploy your business.

FAQ

How do I check the maximum number of pods supported by the node network in Terway mode?

  • Method 1: When you create a node pool, you can view the maximum number of pods supported by an instance type in the node network by checking the Terway Mode (Supported Pods) column in the Instance Type section.

  • Method 2: Perform the following steps to calculate the maximum number of pods supported by an instance type in the node network:

    • Search the relevant documentation to obtain the number of ENIs provided by the instance type. For more information, see Overview of instance families.

    • Call an API operation in OpenAPI Explorer to query the details of the instance type. Specify the instance type of the node in the InstanceTypes parameter and click Initiate Call. The EniQuantity parameter that is returned by the system indicates the number of ENIs provided by the instance type. The EniPrivateIpAddressQuantity parameter indicates the number of private IP addresses provided by each ENI.

How do I check the maximum number of pods supported by a node?

To view the maximum number of pods supported by a node, perform the following steps:

  1. Log on to the ACK console. In the left-side navigation pane, click Clusters.

  2. On the Clusters page, find the cluster that you want to manage and click its name. In the left-side navigation pane, choose Nodes > Nodes.

  3. On the Nodes page, you can view the pod quota of a node, which equals the maximum number of pods supported by the node.97.png

Why is the pod upper limit reached immediately after I create a cluster?

Cluster components are deployed in pods. The pods consume node resources. Some components may require multiple pods. If you install a great number of components in the cluster, a large number of pods are created for the components. To resolve this issue, we recommend that you use the methods described in the How to increase the maximum number of pods in a cluster section.

Can I increase the maximum number of pods on a node by manually modifying the number of ENIs or the pod quota?

No. In Terway mode, the maximum number of pods on a node depends on the number of ENIs provided by the ECS instance. If you manually increase the pod upper limit of a node, you will fail to create new pods after the pod upper limit is reached because no IP address is available. As a result, an error is recorded in the results of cluster inspections and cluster upgrade prechecks.

To resolve this issue, we recommend that you remove the node and add the node to the cluster again. For more information, see Remove a node and Add existing ECS instances to an ACK cluster.

Why does the pod upper limit differ between two nodes with the same CPU and memory specifications?

The pod upper limit of worker nodes does not linearly increase with the instance specifications of worker nodes. In Terway mode, the maximum number of pods supported by a node depends on the number of ENIs provided by the instance family. In Flannel mode, the default maximum number of pods on a node is 256. The default value can be increased for specific cluster types.