Use case: If someone were to checkout a git repo and run the service on a local cluster it would the same directory regardless of where they store their filesĬurrent Solution: In the yaml file I have the words 'FULLPATH' similar to - hostPath: FULLPATH/service-name/src, and a script that uses sed to replace the FULLPATH with pwd. I am running cassandra in a docker container with a mounted volume (mac docker with VirtuelBox/boot2docker latest docker-machine).
![docker for mac kubernetes mount local volume docker for mac kubernetes mount local volume](https://cdn.thenewstack.io/media/2019/08/e8f064b6-docker_desktop_b.jpg)
Issue 1) Mounting a local volume requires a hostPath variable that is an absolute url, I'd like it to be relative I'm trying to avoid external tools or extensions.
#Docker for mac kubernetes mount local volume how to#
I've hit two issues and I'd like to see if anyone has opinions on how to work around them, or completely different paths that would solve my issue. Once you define the volumes, you can mount them in the volumeMounts section in the container and volumeMounts.mountPath are required, which indicate the name of the volumes you defined and the mount path inside the container. Each type of volume has a different configuration to be set. Add a hostPath volume to the worker Deployment file and mount the volume to the worker container. Volumes are defined in the volumes section of the pod definition with unique names.
![docker for mac kubernetes mount local volume docker for mac kubernetes mount local volume](https://d2908q01vomqb2.cloudfront.net/fe2ef495a1152561572949784c16bf23abb28057/2020/11/18/image-78.png)
![docker for mac kubernetes mount local volume docker for mac kubernetes mount local volume](https://img2020.cnblogs.com/q/115511/202005/115511-20200507231514613-1834257951.png)
There will be less to maintain and the cluster autoscaler might even work automatically when there is more load Accessing the Docker Socket. Hello, I'm working on allowing a locally developed service to mount a directory and refresh the internal application when files in that directory change. It would be nice to use the Docker instance that is already running on the Kubernetes nodes.