logging: tune kubelet image GC on rpi5

This commit is contained in:
Brad Stein 2026-01-10 06:22:56 -03:00
parent 753cc5900a
commit 6f8696eb0d

View File

@ -17,6 +17,8 @@ data:
journald_dropin="/host/etc/systemd/journald.conf.d/99-logging.conf"
k3s_dropin="/host/etc/systemd/system/k3s.service.d/99-logging.conf"
k3s_agent_dropin="/host/etc/systemd/system/k3s-agent.service.d/99-logging.conf"
k3s_image_gc_dropin="/host/etc/systemd/system/k3s.service.d/98-image-gc.conf"
k3s_agent_image_gc_dropin="/host/etc/systemd/system/k3s-agent.service.d/98-image-gc.conf"
if [ ! -f "${journald_dropin}" ]; then
mkdir -p "$(dirname "${journald_dropin}")"
@ -32,6 +34,13 @@ data:
k3s_changed=1
fi
if [ -f "/host/etc/systemd/system/k3s.service" ] && [ ! -f "${k3s_image_gc_dropin}" ]; then
mkdir -p "$(dirname "${k3s_image_gc_dropin}")"
printf "[Service]\nEnvironment=\"K3S_KUBELET_ARG=image-gc-high-threshold=70\"\nEnvironment=\"K3S_KUBELET_ARG=image-gc-low-threshold=60\"\nEnvironment=\"K3S_KUBELET_ARG=image-gc-minimum-available=5Gi\"\n" > "${k3s_image_gc_dropin}"
changed=1
k3s_changed=1
fi
if [ -f "/host/etc/systemd/system/k3s-agent.service" ] && [ ! -f "${k3s_agent_dropin}" ]; then
mkdir -p "$(dirname "${k3s_agent_dropin}")"
printf "[Service]\nEnvironment=\"K3S_KUBELET_ARG=container-log-max-size=10Mi\"\nEnvironment=\"K3S_KUBELET_ARG=container-log-max-files=2\"\n" > "${k3s_agent_dropin}"
@ -39,6 +48,13 @@ data:
k3s_agent_changed=1
fi
if [ -f "/host/etc/systemd/system/k3s-agent.service" ] && [ ! -f "${k3s_agent_image_gc_dropin}" ]; then
mkdir -p "$(dirname "${k3s_agent_image_gc_dropin}")"
printf "[Service]\nEnvironment=\"K3S_KUBELET_ARG=image-gc-high-threshold=70\"\nEnvironment=\"K3S_KUBELET_ARG=image-gc-low-threshold=60\"\nEnvironment=\"K3S_KUBELET_ARG=image-gc-minimum-available=5Gi\"\n" > "${k3s_agent_image_gc_dropin}"
changed=1
k3s_agent_changed=1
fi
if [ "${changed}" -eq 1 ]; then
sleep "$(( (RANDOM % 300) + 10 ))"
chroot /host /bin/systemctl daemon-reload