-
Hi, how can I setup log rotation in a RKE2 cluster so that the container logs don't consume all disk space? I have found this:
work? Edit: kubelet-arg:
- container-log-max-files=3
- container-log-max-size=2Mi but it seems not to work properly, I can see on the command line (with ps aux) that both parameters are passed to kubelet, but while the files amount is working fine, the log files itself are still large (150 MB) instead of 2, which is also the case without any extra configuration. I don't really understand that, because here https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/ it says that default is 10Mi. Do you have any ideas or should I ask in kubelet github repository? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Which specific log files are you looking at? |
Beta Was this translation helpful? Give feedback.
-
use this option in the /etc/rancher/rke2/config.yaml file: kubelet-arg:
- container-log-max-files=3
- container-log-max-size=2Mi defaults for these options are 5 and 10Mi respectively, so one container can produce max 5 log files, 3 of which will be gzipped to be smaller size, so max total size should not exceed 30-40 Mi. |
Beta Was this translation helpful? Give feedback.
-
Is it possible to configure the rotation of kubelet's log itself? Also for containerd |
Beta Was this translation helpful? Give feedback.
use this option in the /etc/rancher/rke2/config.yaml file:
defaults for these options are 5 and 10Mi respectively, so one container can produce max 5 log files, 3 of which will be gzipped to be smaller size, so max total size should not exceed 30-40 Mi.