I’d like to mount an NFS location onto my rancher hosts to provide external storage/backup/etc. I’ve seen suggestions on how to do this on CoreOS (a systemd/fleet unit to start statd, another to mount the volume). However, any manual mount commands I run on the rancher node as a test seem to get permutations on “file not found” and the lack of the standard nfs client tools (rpcinfo etc) in rancheros suggest I’m doing something that was really not meant to be.
I can mount the NFS share inside a docker container running with --cap-admin=SYS_ADMIN and the nfs-common packages installed, but I can’t work out how to make the mount visible to other containers (let alone the host) without just making every container an NFS client.
Any thoughts from anyone on how to do this well? Or should I take from my googling the message that, if you can’t do it on the host OS, don’t do it at all?
you can use privileged containers to mount NFS filesystems and export them as docker volumes for use by other containers. This compose YML template example might give an idea:
Here worker1 and worker2 don’t have to be NFS clients themselves: they just use the data volumes from nfs-volumes container, which is responsible for mounting NFS shares from NFS_MOUNT_* env vars.
Thanks for that! I will test tonight. I thought I had tried that but, on consideration, I think I had the volumes defined on the next-path-up - ie, on /opt/data, rather than /opt/data/datavol1 - which only showed the underlying /opt/data content through to the worker1/2 containers, not the NFS mount.
FYI - I can’t get this test case to work. The contents of the underlying “/opt/data/datavol1” volume in the “nfs-volumes” container shows through to the “worker1” container run with “–volumes-from nfs-volumes”. The NFS mount contents is visible mounted on “/opt/data/datavol1” in the nfs-volume container before and after the creation of the worker container.
However, if I then umount /opt/data/datavol1 in the nfs-volume container, and “touch /opt/data/datavol1/hello_world.txt”, the “hello_world.txt” file is immediately visible in the worker1 container.
Has anyone got the @imikushin’s example to work on the docker versions on rancherOS 0.3.3?
[rancher@rancher03 ~]$ uname -a
Linux rancher03 3.19.8-ckt1-rancher #1 SMP Thu Jun 25 12:46:25 UTC 2015 x86_64 GNU/Linux
Yes, I have moved on to those docs in your recent links, but I am a bit confused on the “Custom Storage Container”. I see it requires an image. What do I put in that image? Do I mount the shares in that image as was done via console in “Modifying Console”?
I would like some help in understanding what needs to be in this image:
image: example/custom-nfs-image
Can someone add some more info to the NFS storage documentation on exactly how the NFS server is mapped for a Custom Storage Container, is it fstab, netshare plugin, etc.???
I made https://github.com/flaccid/docker-nfs-client so you would add some environment variables to the yaml for the server and share but I’m trying to test this with rancheros v0.4.0. Seems to be some issue with the vagrant image. @imikushin should be able to help when next available (system-docker returns FATA[0000] no such file or directory).
OK, I’m stuck on this NFS thing. It appears on boot up, RancherOS cannot get the custom nfs client image from Docker Hub or any other registry.
` # Your custom image
image: 2devnull/nfs-client
time=“2015-11-19T22:28:33.119924095Z” level=error msg="Handler for POST /v1.15/containers/create returned error: No such image: 2devnull/nfs-client:latest"
time=“2015-11-19T22:28:33.119952683Z” level=error msg=“HTTP Error” err=“No such image: 2devnull/nfs-client:latest” statusCode=404 `
Hi, I’m on v1.0.2 and interested in NFS mount on the RancherOS host.
The use case:
I have Rancher Server running in the cloud. Some of the connected hosts are running on premise and some in the cloud. I have NFS server that is running on prem and I want my hosts that are running on prem to be able to mount NFS shares.
I can’t use the Rancher NFS storage stack from catalog because Rancher Server can’t see the NFS server. I have CentOS and RancherOS hosts running on prem.
So, what exactly needs to be done to make it (NFS shares mounted to the RancherOS host) work?