Is there any way to change default folder of kubelet pods overlay?

8/7/2019

In my kubernetes cluster, master nodes have often DiskPressure problem due to /var partition usage. I noticed that the /var/lib/kubelet folder takes up a lot of space and I was going to change this folder as a kubelet overlay pointing to one in a larger partition. I've already done this with docker and etcd, but I can't figure out how to do this change of kubelet pointing, has anyone done it yet?

-- gcalenzo
docker
kubernetes
overlay

1 Answer

8/7/2019

Here is the documentation of kubelet flags. In that page search for root-dir

if you are using CentOs system then follow below:

Step 1.a: edit (for older k8s version) /etc/systemd/system/kubelet.service.d/10-kubeadm.conf as shown over here
Step 1.b: edit (for newer k8s version) /etc/sysconfig/kubelet as shown over here
Step 2:
systemctl daemon-reload
systemctl restart kubelet

Explanation: --root-dir flag is what you need to specify your new directory. This flag needs to mentioned as an extra args in the kubelet drop-in file but the structure of the drop-in file changed in the new kubelet versions as shown in step 1.a and 1.b.

-- garlicFrancium
Source: StackOverflow