I'm trying to manage ephemeral storage for my Kubernetes pods. Currently, the kubelet is set up with the default root directory at "/var/lib/kubelet" and my host has limited space under that volume, which is also being used by the OS. I've mounted an additional large volume at "/disk1" and I want to utilize this for ephemeral storage that will be deleted when the pods terminate.
I've considered a few options, but I'm not sure they're ideal:
1. Changing the kubelet root directory to "/data1/kubelet" seems like a straightforward solution, but I've read this can cause compatibility issues with some CSI/CNI plugins that expect the default location.
2. Mounting a `hostPath` could work, but I believe I'd need a custom controller to manage cleanup after pods are deleted or evicted.
I came across the concept of CSI/generic ephemeral storage, but it appears they require some sort of provisioner that can work with local disks. Rancher's local-path-provisioner might be a solution, but it seems it doesn't support dynamic provisioning, which might be necessary for this to function correctly.
Any advice on how I can provision ephemeral storage for my pods from a host location that's different from the kubelet's root directory?
3 Answers
Have you considered using `hostPath` volumes? Just keep in mind that they lack a built-in cleanup mechanism. You'll possibly need a custom controller to manage deletion after your pods are done.
You might want to check out Rancher's local-path-provisioner. It allows you to set a custom storage location, which could work for your needs. The only drawback is that it doesn't support ephemeral storage limits, but it should handle dynamic provisioning without issues.
Could you bind mount `'/var/'` to `'/disk1/var'`? Just be cautious about having `'/var/lib/kubelet'` and `'/var/log/pods'` on different filesystems, as this can lead to some complications.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures