How to use host storage in kubernetes
Expected behavior
Able to mount shared drive in containers running in kubernetes
Actual behavior
Could not find any way to configure this
Information
I am using Docker for Windows Edge with the built in Kubernetes configuration and trying to mount a persistent volume of some kind from the host. I am running Windows 10 Enterprise. I thought I would be able to use the local volumes that were added as alpha in Kubernetes, but they are behind feature gates and I do not see any way to enable them so I can use that.
Steps to reproduce the behavior
- Install Docker for Windows Edge
- Make sure you are using Linux Containers
- Open Docker settings, go to kubernetes tab and check the boxes and click apply
- Go to shared drives tab and share drive
- Ponder the possible ways this share could get passed into kubernetes.
Hello,
In the 18.03-rc1 edge version (due this week), you will be able to use hostPath type volume to mount volumes shared from the host. Just use a hostPath volume. VM-side, the shared drive are in the /host_mnt folder. I.E: "/host_mnt/c/path/to/my/folder for a folder in the C drive.
That does not seem to work, gives me an error saying something about failing test for directory.
On Mon, Feb 19, 2018, 08:01 Pierre Gayvallet [email protected] wrote:
Hello,
In the 18.03-rc1 edge version (due this week), you will be able to use hostPath type volume to mount volumes shared from the host. Just use a hostPath volume. VM-side, the shared drive are in the /host_mnt folder. I.E: "/host_mnt/c/path/to/my/folder for a folder in the C drive.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/docker/for-win/issues/1703#issuecomment-366701358, or mute the thread https://github.com/notifications/unsubscribe-auth/AHS44Bzp4vxWftfI6zoCgCbKituAPvzYks5tWX6vgaJpZM4SGBRc .
OK, it works when I do not specify a type, but if I speficy type: Directory I get the error "MountVolume.SetUp failed for volume "host" : hostPath type check failed: /host_mnt/e/mysql_data is not a directory" on anything other than the root.
On Mon, Feb 19, 2018 at 8:13 AM, Jeffrey Parker [email protected] wrote:
That does not seem to work, gives me an error saying something about failing test for directory.
On Mon, Feb 19, 2018, 08:01 Pierre Gayvallet [email protected] wrote:
Hello,
In the 18.03-rc1 edge version (due this week), you will be able to use hostPath type volume to mount volumes shared from the host. Just use a hostPath volume. VM-side, the shared drive are in the /host_mnt folder. I.E: "/host_mnt/c/path/to/my/folder for a folder in the C drive.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/docker/for-win/issues/1703#issuecomment-366701358, or mute the thread https://github.com/notifications/unsubscribe-auth/AHS44Bzp4vxWftfI6zoCgCbKituAPvzYks5tWX6vgaJpZM4SGBRc .
Running docker version 18.03.0-ce-rc1 on windows 10 Failed to mount volume from persistentvolumeclaim, it shows error under Events Error: Error response from daemon: invalid mode:

+1
+1
Do you need to have shared drives set up to enable k8s persistent volumes? It asks me to share the c:\ drive whenever I try to create a PVC.
Seeing the same behavior as in #77 and I am not having success with setting up shared drives in Docker for Windows. Tried suggestions here: http://peterjohnlightfoot.com/docker-for-windows-on-hyper-v-fix-the-host-volume-sharing-issue/ and here: https://blogs.msdn.microsoft.com/stevelasker/2016/06/14/configuring-docker-for-windows-volumes/
Neither work.
Invalid mode issue can be solved for me by replacing
C:/WhateverPath
with
/C/WhateverPath
Misleading error message, but there's an issue for that already here:
https://github.com/kubernetes/kubernetes/issues/59876
@pgayvallet Thank you for your comment, it totally works, how... do you know this? :)
I'm trying to figure out where the documentation is for this, but the only thing I can find is a reference in Docker for Windows Stable Release notes under Docker Community Edition 17.12.0-ce-win47 2018-01-12:
Fix Mount compatibility when mounting drives with -v //c/..., now mounted in /host_mnt/c in the LinuxKit VM. Fixes docker/for-win#1509, docker/for-win#1516, docker/for-win#1497
Thank you! (I'm only commenting here because the issue is still open.)
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30d of inactivity.
Prevent issues from auto-closing with an /lifecycle frozen comment.
If this issue is safe to close now please do so.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale
Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.
If you have found a problem that seems similar to this, please open a new issue.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked