How to Use a Different Host Location for Ephemeral Storage in Kubernetes?

0
10
Asked By CuriousCat42 On

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

Answered By TechWhiz007 On

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.

Answered By KubeGuru88 On

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.

Answered By DiskDude22 On

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.