-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persistent Volumes Clarification #13038
Comments
There is a persistent directory mounted on that The files are not (supposed to be) stored in the temporary directory. |
The default settings of minikube with driver |
It was hardcoded in the original driver (the mount point). If you do you your own VM, you can use bind mounts. This was supposed to be documented and eventually changed.
In the default minikube images everything is ephemeral, not only /tmp. So it didn't really matter. Wherever the mountpoints lived, it still had to be persisted to real storage (data disk or docker volume) |
So the only real solution to have something persistent is to create my own PVs and PCVs and use those claims? |
Minikube uses If you only use one device, you can use symlinks or bindmounts... e.g.
|
I do not get this. When I install minikube with no driver, the dynamic volume provisioner stores the data of my volume claims requested by the k8s resources in the I am not sure what my problem of understanding is here. Do I correctly understand that the volume claims for a pod triggers the provisioner to provide a volume |
On your VM/host, you need to mount some persistent storage on the mount points. They were not supposed to be used as-is. I meant all three of them, /data was just shorter to type than /tmp/hostpath... (sorry about that) It should be documented better. $ findmnt /tmp/hostpath-provisioner
TARGET SOURCE FSTYPE OPTIONS
/tmp/hostpath-provisioner /dev/vda1[/hostpath-provisioner] ext4 rw,relatime docker@docker:~$ findmnt --notrunc /tmp/hostpath-provisioner
TARGET SOURCE FSTYPE OPTIONS
/tmp/hostpath-provisioner
/dev/nvme0n1p2[/var/lib/docker/volumes/docker/_data/hostpath-provisioner]
ext4 rw,relatime,errors=remount-ro Assuming mkdir -p /mnt/$PARTNAME/data
mkdir /data
mount --bind /mnt/$PARTNAME/data /data
mkdir -p /mnt/$PARTNAME/hostpath_pv
mkdir /tmp/hostpath_pv
mount --bind /mnt/$PARTNAME/hostpath_pv /tmp/hostpath_pv
mkdir -p /mnt/$PARTNAME/hostpath-provisioner
mkdir /tmp/hostpath-provisioner
mount --bind /mnt/$PARTNAME/hostpath-provisioner /tmp/hostpath-provisioner $ findmnt /mnt/vda1
TARGET SOURCE FSTYPE OPTIONS
/mnt/vda1 /dev/vda1 ext4 rw,relatime You could also use see https://github.com/kubernetes/minikube/tree/master/deploy/kicbase/automount |
The issue as I understand is pretty simple -- when linux is restarted, it removes 'hostpath-provisioner' directory, and users loose all data without warning. Also, your suggestion should be updated with |
As long as the data is being stored in a persistent location, there should be no data loss with the regular drivers ? The empty directories in It could have been fixed sooner for the docker driver, and it could have been documented better for the none driver. |
I'm using driver=none because of Nvidia GPU. Also using Bitnami/Mariadb which installs 'persistent volume' on /tmp/hostpath-provisioner, which then gets deleted on machine reboot. Is there a way to start minikube cluster with a different hostpath-provisioner location? |
There should have been, but for now you will have to set up the symlinks or bind mounts. For the minikube OS, we do this with a service that is started at launch. (the automount) Added some minimal docs: https://minikube.sigs.k8s.io/docs/drivers/none/#persistent-storage |
I symlinked /tmp/hostpath-provider to /data/hostpath-provider , where data is a non temporary dir. 0 lrwxrwxrwx 1 sk sk 26 Dec 29 12:22 hostpath-provisioner -> /data/hostpath-provisioner When I try 'helm install mdb bitnami/mariadb I observe this in minikube logs
What should I do? Also, I'm loosing all my custom deployments on host reboot -- cluster is recreated as if it didn't exist. /mnt is empty on my machine, no directories are actually mounted there. Running findmnt /tmp/hostpath-provisioner -- nothing found. The 'hostpath-provisioner' is created only after I run 'helm install mdb bitnami/mariadb' |
Anyway, I switched to microk8s, and it seems to be working as needed. |
I think the regular automount scripts are using bind mounts, but glad you find a way to run Kubernetes. |
You can't make links. Because hostpath try to make mkdir /tmp/hostpath-provider (if dir not exist) and if a link exist fails. Link is not a dir. |
The shell command
Actually it is both. |
I'm speaking about provisioner, not about shell. With minikube driver=none the vols are stored under /tmp (the mount point and its data). It is not possible to create links to move its content to another path and it seems that neither binds (or at least in my case, with surprising behavior). In addition, the minikube doc is wrong in this regard: https://minikube.sigs.k8s.io/docs/handbook/persistent_volumes/ since it does not indicate the scenario that one encounters with minikube driver=none and nothing to change is indicated about OS clear config over tmp for those directories. So you will find (if you forget consider that) after 10 days of inactivity that your vols have been deleted (issue 9926). There are some threds about tis: The SOLUTION we have found (great Fran) is to change the minikube's hostpath provisioner and use rancher's local-path-provisioner: https://github.com/rancher/local-path-provisioner changing "paths": ["/opt /local-path-provisioner"]. |
I am using minikube to run my cluster and ran across a problem. I am not sure wheter it belongs to the docs or source code.
The documentation gives an example for
PVs
and how to define that here. Using the persistant volume claims, you do not have to specify thehost path
and a generic one gets generated. BUT, why do you choose thetmp
folder per default?! Please please put a warning in the docs that usingPVCs
and the default minikube provisioner does, in fact, only store your data for a limited time.Alternatively change the default location to somewhere really persistant!
The text was updated successfully, but these errors were encountered: