the nfs share is created on the client
I am getting the error when deploying the nomad job “volumes are not enabled cannot mount host paths.”
what could be the reason for this? appreciate your help
You can allow mounting host paths outside of the allocation working directory on individual clients by setting the docker.volumes.enabled option to true in the client’s configuration.
First, @pphysch is correct, you can enable volumes for the docker driver and mount arbitrary paths outside of the allocation sandbox into Docker tasks. However, if you are using existing NFS mounts on a host running a Nomad client, you could instead define them as Nomad host volumes. Nomad host volumes can be mounted into running workload without having to resort to enabling Docker volumes wholesale.
So for your example, I would have a host volume configured for prometheus like so:
(You can either add this to your configuration file, or (if you are pointing to a directory for configuration files) create a specific configuration file just for this host-volume.
Restart the node once you have it configured. You should be able to see the host volume listed in the output of nomad node status -self and nomad node status -self -verbose on the client hosting the volume.
Using host volumes will work in the same way between the exec, java, and docker task drivers. Switching from the volume attribute to the more expressive mount syntax is also preferred for docker bind mounts.
thanks @angrycub
I can now see the host volume which is the nfs share in nomad node status -self -verbose however when i run the job i am getting an error failed to create container API error (400) invalid mount config for type bind invalid mount path prometheus mount path must be absolute
Darn I forgot about this, and you will run into an interpolation issue if you try and interpolate the alloc_dir path into the source attribute. For now, the volume syntax for binding in your configuration should do the trick. Scratch the mount stanza and put back in
Hi @angrycub
getting similar error failed to create container API error (400) invalid mount config for type bind invalid mount path prometheus mount path must be absolute