local-path-provisioner icon indicating copy to clipboard operation
local-path-provisioner copied to clipboard

Unmounted storage protection

Open kvaps opened this issue 5 years ago • 7 comments

Hi the created volumes are having type: DirectoryOrCreate property. But it might be unsafe in case if data storage is unmounted for some reason, because application can be started with the empty directory created in different place.

I'm sure that using type: Directory will solve this problem

https://github.com/rancher/local-path-provisioner/blob/b44b2c3b5d18772aa306d3fb1210b202c353ef09/provisioner.go#L205

kvaps avatar Sep 21 '20 15:09 kvaps

Sorry @kvaps I need to revert this change for now. Somehow it doesn't work with my RKE cluster. I always get the error when trying to start the pod:

MountVolume.SetUp failed for volume "pvc-xxxx" : hostPath type check failed: /opt/local-path-provisioner/pvc-xxxxx is not a directory

yasker avatar Oct 15 '20 23:10 yasker

But is it directory? :)

kvaps avatar Oct 16 '20 06:10 kvaps

Yes it is…

yasker avatar Oct 16 '20 07:10 yasker

Weird, what kubelet version do you have?

kvaps avatar Oct 16 '20 08:10 kvaps

I am using Rancher Kubernetes Engine (RKE), which is a containerized kubelet.

yasker avatar Oct 16 '20 23:10 yasker

@yasker I'm out of context, but most likely if you're using RKE, you will need to specify somewhere in your cluster.yml something along the lines of

kubelet:
  extra_binds:
  - /opt/local-path-provisioner

refer to the RKE docs to get everything right.

lllamnyp avatar Oct 17 '20 11:10 lllamnyp

Okay I prepared a new PR https://github.com/rancher/local-path-provisioner/pull/224

kvaps avatar Dec 22 '21 20:12 kvaps