Category | Description | Recommendation |
Control the Pod object size | For large workloads requiring frequent operations (such as scaling), keep the Pod size under 10 KiB. In Kubernetes, resource manifests are stored in the ETCD database. Each time a resource is retrieved (via List or Watch), the full manifest is transmitted. Excess data significantly increases API Server load and network bandwidth usage. This affects the overall performance of the control plane. When a cluster has a large number of Pods, the impact of the Pod size on performance is multiplied. | Avoid directly embedding large amounts of configuration data into env or args of the Pod YAML file. Use ConfigMap or Secret for mounting instead. |
Control the total number of Watch connections in the cluster | For each Secret and ConfigMap referenced by a Pod, the kubelet on each node creates a corresponding Watch connection to listen for changes. The total number of Watches generated by all nodes can impose a high load on the control plane. When the number of Watches in a cluster exceeds 200,000, it may affect cluster initialization time and even cause frequent control plane restarts. |
|
Prohibit percentage-based updates for DaemonSets | In large-scale clusters with thousands of nodes, batch creation or updating of DaemonSets imposes a high load on the control plane. If Pods in the DaemonSets initiate a large number of requests to the API Server during startup, more control plane resources will be consumed. | Strictly control the concurrency of rolling updates by configuring updateStrategy:
The sample YAML file for updateStrategy is as follows: |
Set Job ttlSecondsAfterFinished | For a large number of Job objects created via CronJob or other mechanisms, configure the ttlSecondsAfterFinished field to automatically clean up the objects after they are complete. Without automatic cleanup, completed and failed Jobs and their Pods will continuously use ETCD storage space and control plane resources. This may lead to increased latencies of the API Server List operation, ETCD storage bloat, and exceeded namespace object count limits. |
The following sample code shows the YAML content. |
Disable automatic ServiceAccount mounting for Pods | By default, Kubernetes automatically mounts ServiceAccount credential Secrets into Pods, and the kubelet creates a Watch for each Secret on each node to listen for changes, which imposes a high load on the API Server. | For Pods that do not need to access the API Server, set automountServiceAccountToken: false in the Pod spec. The following sample code shows the YAML content. |
Disable automatic injection of Service environment variables into Pods | By default, Kubernetes injects environment variables (such as MY_SERVICE_SERVICE_HOST and MY_SERVICE_SERVICE_PORT) of all active Services in the namespace into each Pod. When excess services exist, Pods may crash at startup due to excess environment variables. | Set enableServiceLinks: false in the Pod spec to disable service environment variable injection. The following sample code shows the YAML content. |
Set revisionHistoryLimit to reduce the number of ReplicaSets | By default, Kubernetes retains 10 historical ReplicaSet versions. When a large number of Deployments exist in a large-scale cluster, the historical ReplicaSet versions of each Deployment are stored in ETCD. This continuously uses ETCD storage space. |
The following sample code shows the YAML content. |
Prohibit DaemonSets from performing List and Watch operations on ClusterScope resources | Avoid deploying independent controllers on each node to listen for the full cluster data. In this mode, a large number of List requests are simultaneously sent to the API Server during node startup to synchronize cluster status, and each node maintains its own Watch connection. This leads to a surge in Watch connections and request volume, and great pressure on the control plane. |
|
Category | Description | Recommendation |
Access APIServer | In large-scale clusters, the way clients access kube-apiserver directly affects control plane stability. Inappropriate API call modes can cause a surge in CPU, memory, and network load on kube-apiserver and ETCD. This may even lead to control plane overload or request timeouts. VKE has built-in rate-limiting mechanisms to protect the API Server, but optimizing API Server access mode from the client side remains a core measure for ensuring cluster performance. |