Daehwan Bae

I added Fluentd as sidecar to handle multi-line log message.
I used emptyDir of Kubernetes to share file between containers
But emptyDir was created on Kubelete’s root directory.

Kubeletes’s default root directory is /var/lib/kubelet.
I only have 15GB on root(/) volume.

So I have to change Kubelet’s path

This worked well. (Symbolic link was not work)

mkdir -p /data/kubelet /var/lib/kubelet
mount --bind /data/kubelet /var/lib/kubelet

I found other guides for Ranchers. But I din’t try this.

services:
kubelet:
extra_args:
root-dir: /data/kubelet
extra_binds:
- '/data/kubelet:/data/kubelet:shared,z'

https://github.com/rancher/rke/issues/1667
https://rancher.com/docs/rke/latest/en/example-yamls/

logrotate is also needed.

vi /etc/logrotate.d/app-log/var/lib/kubelet/pods/*/volumes/kubernetes.io~empty-dir/*/*.log /var/lib/kubelet/pods/*/volumes/kubernetes.io~empty-dir/*/*/*.log
{
su root root
daily
rotate 5
size 10M
dateext
dateformat -%Y%m%d-%s
nocompress
copytruncate
missingok
notifempty
create 644 root root
}
-----vi /etc/cron.hourly/logrotate/usr/sbin/logrotate /etc/logrotate.conf

--

--