for-win icon indicating copy to clipboard operation
for-win copied to clipboard

How to use host storage in kubernetes

Open thexder1 opened this issue 8 years ago • 11 comments

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

  1. Install Docker for Windows Edge
  2. Make sure you are using Linux Containers
  3. Open Docker settings, go to kubernetes tab and check the boxes and click apply
  4. Go to shared drives tab and share drive
  5. Ponder the possible ways this share could get passed into kubernetes.

thexder1 avatar Feb 14 '18 21:02 thexder1

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.

pgayvallet avatar Feb 19 '18 14:02 pgayvallet

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 .

thexder1 avatar Feb 19 '18 14:02 thexder1

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 .

thexder1 avatar Feb 19 '18 14:02 thexder1

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:

image

creativearmenia avatar Feb 28 '18 07:02 creativearmenia

+1

gpassero avatar Mar 28 '18 14:03 gpassero

+1

seanturner83 avatar Apr 13 '18 10:04 seanturner83

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.

kalexmills avatar Jul 07 '18 19:07 kalexmills

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

ghost avatar Jul 12 '18 13:07 ghost

@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.)

figaw avatar Oct 19 '18 09:10 figaw

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

docker-robott avatar Jan 17 '19 10:01 docker-robott

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

docker-robott avatar Jun 26 '20 03:06 docker-robott