Change Kubelet directory in Rancher

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

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store