Help Center/ Cloud Container Engine/ FAQs/ Node/ Node Running/ What Should I Do If the Data Disk Usage Is High Because a Large Volume of Data Is Written Into the Log File?
Updated on 2024-09-04 GMT+08:00

What Should I Do If the Data Disk Usage Is High Because a Large Volume of Data Is Written Into the Log File?

Symptom

Service containers on nodes that use containerd as the container runtime continuously write a large volume of data into the log file, resulting in full space of the /var/lib/containerd directory and slowing down the creation and deletion of containers on the node. This may evict pods and cause problems like high disk usage and abnormal nodes.

Possible Causes

For such service containers, if their logs are generated to the STDOUT, the kubelet will dump the logs. The kubelet also maintains the lifecycle of all containers on the node.

The kubelet will be overloaded if there are too many service containers on a node and they write a large volume of data into the log files. If the load exceeds a certain threshold, kubelet will dump the logs to the disk, which further results in a high disk usage. Operations such as container creation and deletion on the node will be affected.

Solution

Typically, for a node with 8 vCPUs and 16 GiB of memory, and a 100-GiB data disk, the standard log output rate of a single container should be less than or equal to 512 KB/s and the overall standard log output rate of all containers on the node should be less than or equal to 5 MB/s. If a large number of logs are generated, resolve this issue in either of the following ways:

  • Do not schedule containers which generate too many logs on the same node. For example, configure anti-affinity policies for pods running such containers or reduce the maximum number of pods on a single node.
  • Attach an additional data disk separately. For example, you can attach an extra data disk or mount a dynamically provisioned storage volume when creating a node so that logs can be written to files in it.