If the default kubelet configuration does not meet your needs, you can customize kubelet parameters at the node pool level to adjust node behavior. For example, you can fine-tune resource reservations to manage resource usage, set custom node-pressure eviction thresholds to mitigate resource shortages, or change the topology manager policy to improve system performance.
Limitations
-
Only ACK clusters that run Kubernetes 1.20 or later support custom kubelet parameters. To upgrade a cluster, see Manually upgrade a cluster.
-
Only ACK Lingjun clusters that run Kubernetes 1.22 or later support custom kubelet parameters. To upgrade a cluster, see Upgrade a cluster.
If your cluster version does not meet these conditions, unexpected behavior may occur.
Usage notes
-
Custom kubelet parameters are applied to nodes in batches. The changes take effect immediately on existing nodes in the node pool and are automatically applied to new nodes. Applying the configuration restarts the kubelet process, which may affect running nodes and workloads. We recommend that you perform this operation during off-peak hours.
-
If
evictionHard,kubeReserved, orsystemReservedis not configured, the system uses default values for resource reservation. For more information about how the default values are calculated, see Node resource reservation policy. -
Changes to the resource reservation configuration may reduce a node's allocatable resources. For nodes with high resource usage, this may trigger node eviction.
-
We strongly recommend that you do not use the command line to define kubelet parameters that are not supported in the console. Using the command line poses significant stability risks. You are responsible for the correctness and compatibility of the user data file content. Incorrect or deprecated parameters can make nodes unavailable.
-
When the kubelet starts, it merges configurations from different sources based on their priority. If the same configuration item is set in multiple ways, the setting with the higher priority overwrites the one with the lower priority.
Customize kubelet parameters in the console
Applying custom kubelet parameters restarts the kubelet process, which may affect your services. We recommend that you perform this operation during off-peak hours.
On the ACK Clusters page, click the name of your cluster. In the left navigation pane, click .
-
On the Node Pools page, find the target node pool and choose
> Kubelet Configuration in the Actions column. -
Read the notes on the page. Click Custom Parameters, select the parameters to configure, specify the nodes to upgrade, and set the batch update policy. Then, complete the operation as prompted.
The batch update policy is described as follows:
-
Maximum Parallel Nodes per Batch: The number of nodes to update concurrently in each batch. You can monitor and manage the update process in the event list.
-
Interval Between Batches: The waiting time between consecutive update batches.
You can pause the update to verify the upgraded nodes. When paused, any in-progress node updates will complete, but new updates will not start until you resume the task.
Complete the custom configuration task as soon as possible. A paused task is automatically canceled after seven days, and the related events and logs are cleared.
-
In addition to the console, you can also call the ModifyNodePoolNodeConfig API operation to customize kubelet parameters. The following section describes the customizable kubelet parameters supported by ACK.
Customizable kubelet parameters
|
Parameter |
Description |
Default |
Values |
|
allowedUnsafeSysctls |
Specify the allowed unsafe sysctls or sysctl wildcards (patterns ending with Important
Before you use this parameter, carefully assess the risks and ensure availability. |
N/A |
Supports sysctl configurations with the following prefixes:
|
|
containerLogMaxFiles |
The maximum number of log files for a container. The value must be 2 or greater. The container runtime must be containerd. |
10 |
[2, 10] |
|
containerLogMaxSize |
The maximum size of a container log file before it is rotated. The container runtime must be containerd. |
100Mi |
N/A |
|
cpuCFSQuota |
Enables CPU CFS quota enforcement for containers that have CPU limits. |
true |
Valid values:
|
|
cpuCFSQuotaPeriod |
Sets the CPU CFS quota period value. The CustomCPUCFSQuotaPeriod feature gate must be enabled. |
100ms |
A value from 1 millisecond to 1 second, inclusive. |
|
cpuManagerPolicy |
The CPU manager policy. |
none |
Valid values:
|
|
eventBurst |
The maximum number of event records in a burst. |
10 |
The value must be an integer from 1 to 100 and greater than or equal to the value of |
|
eventRecordQPS |
The number of events that can be generated per second. |
5 |
[1, 50] |
|
evictionHard |
A set of hard eviction thresholds that trigger pod eviction. |
imagefs.available<15%,memory.available<300Mi,nodefs.available<10%,nodefs.inodesFree<5% |
None |
|
evictionSoft |
A set of soft eviction thresholds. |
None |
None |
|
evictionSoftGracePeriod |
A set of eviction grace periods. Note
|
None |
None |
|
featureGates |
The set of feature gates for experimental features. Each gate is represented as In the configuration form, select a key (such as Important
|
N/A |
N/A |
|
imageGCHighThresholdPercent |
The percentage of disk usage that triggers image garbage collection. Image garbage collection runs continuously when disk usage exceeds this threshold. This value must be greater than the value of imageGCLowThresholdPercent. |
85 |
[60, 95] |
|
imageGCLowThresholdPercent |
The percentage of disk usage below which image garbage collection does not run. This value must be less than the value of imageGCHighThresholdPercent. |
80 |
[30, 90] |
|
kubeAPIBurst |
The maximum number of burst requests sent to the API server per second. |
10 |
[1, 100], and must be greater than or equal to |
|
kubeAPIQPS |
The number of queries per second (QPS) to the API server. |
5 |
[1, 50] |
|
kubeReserved |
The resource configuration reserved for Kubernetes system daemons. |
The value is automatically calculated by default. For more information, see Node resource reservation policy. |
N/A |
|
maxPods |
The maximum number of pods that can run on a node. Important
Modifying the value of |
N/A. The value depends on physical resource configurations such as machine specifications and container network planning. |
N/A |
|
memoryManagerPolicy |
The policy for the memory manager. |
None |
Valid values:
|
|
podPidsLimit |
The maximum number of process IDs (PIDs) that can be used in each pod.
|
16384 |
None |
|
readOnlyPort |
The read-only port for the kubelet that does not require authentication. |
|
0 For information about the risks of opening the read-only port (10255) for kubelet container monitoring, see [Product Change] Migrate the monitoring port of earlier-version ACK clusters to an authenticated port. |
|
registryBurst |
The maximum number of burst image pulls. |
10 |
The value must be in the range [1, 100] and must be greater than or equal to the value of |
|
registryPullQPS |
The maximum QPS for the image registry. |
5 |
[1, 50] |
|
reservedMemory |
A list of memory reservations for NUMA nodes. |
None |
None |
|
serializeImagePulls |
Specifies whether to pull images serially. |
False |
Valid values:
|
|
systemReserved |
The resource configuration reserved for system daemons. |
The value is automatically calculated by default. For more information, see Node resource reservation policy. |
N/A |
|
topologyManagerPolicy |
The topology manager policy. With a NUMA architecture, allocating data to the same NUMA node reduces cross-node access and improves performance. The topology manager makes topology-aligned resource allocation decisions. For more information, see Control Topology Management Policies on a node. |
none |
|
|
containerLogMonitorInterval |
The cluster must run Kubernetes 1.30 or later. The interval at which container logs are checked for rotation. |
10s |
[3s, 60s] |
|
containerLogMaxWorkers |
The cluster must run Kubernetes 1.30 or later. The maximum number of concurrent workers for log rotation. |
1 |
[1, 20] |
|
tracing |
Enables tracing for control plane or data plane components of the cluster. For more information, see Tracing management. |
None |
|
|
singleProcessOOMKill |
Controls the OOM Kill behavior of containers in a cgroup v2 environment. When set to
|
In a cgroup v2 environment, the default is |
|
|
configMapAndSecretChangeDetectionStrategy |
The operating mode for the ConfigMap and Secret manager. |
|
|
|
serverTLSBootstrap |
Only ACK Managed Pro clusters are supported. Ensure that the
Enable Kubelet server certificate bootstrapping. When this feature is enabled, Kubelet requests server certificates from the cluster through the |
|
Valid values:
|
FAQ
Will custom configurations be deprecated?
As Kubernetes evolves, parameters and feature gates can be deprecated or removed. If a custom parameter managed by ACK is deprecated in a new Kubernetes version, ACK removes the corresponding configuration during a cluster upgrade.
Managing kubelet with a configuration file
Container Service for Kubernetes adjusts how kubelet configurations are managed based on community best practices. For clusters that run Kubernetes 1.20 or later, deprecated kubelet command-line flags are gradually replaced by a configuration file. For more information, see Kubelet Configuration (v1beta1).
New nodes use both the configuration file and the original configuration method. Existing nodes are not affected. To manage the configurations of all nodes in a node pool by using only the configuration file, you can apply a custom configuration as described in Customizable kubelet parameters to standardize the configurations of all nodes in the node pool.
Modifying unsupported kubelet parameters
ACK allows you to write custom parameters to the /etc/kubernetes/kubelet-customized-args.conf file. This file stores custom startup parameters and configuration options for the kubelet. Parameters in this file take precedence over values set through the node pool's custom kubelet configuration feature when the node restarts.
Adjusting kubelet parameters can cause issues such as node registration failures and pod scheduling failures, which affect your services. Before you proceed, fully assess the risks of the change.
-
(Recommended) For nodes that will be added to the node pool in the future, you can add a script that writes to the custom parameter configuration file to the User Data section of the node pool. This ensures that new nodes use these custom parameter values by default.
Configure the following content in the User Data section of the node pool configuration, and replace
${kubelet_key}and${kubelet_value}with the actual values.You can write to the
kubelet-customized-args.conffile only by using the> /etc/kubernetes/kubelet-customized-args.confor> kubelet-customized-args.confcommand in User Data. If you modify the file by using any other method in Pre-defined Custom Data, the /etc/kubernetes/kubelet-customized-args.conf file will be overwritten during the ACK initialization process.mkdir -p /etc/kubernetes echo 'KUBELET_CUSTOMIZED_ARGS="--${kubelet_key}=${kubelet_value}"' > /etc/kubernetes/kubelet-customized-args.conf systemctl daemon-reload systemctl restart kubeletTo access the configuration page, see Create and manage node pools.
-
For existing nodes in the node pool, log on to the node to modify the custom parameter configuration file. Then, run the following commands to apply the configuration.
systemctl daemon-reload systemctl restart kubelet
References
-
For more information about the configuration items for a node pool, see Create and manage node pools.
-
If you encounter errors or abnormal behavior with your nodes, pods, or the kubelet, see Troubleshoot node exceptions, Pod troubleshooting, and FAQ about nodes and node pools to troubleshoot the issues.