Kubernetes persistent volume on Docker Desktop (Windows)

1/7/2019

I'm using Docker Desktop on Windows 10. For the purposes of development, I want to expose a local folder to a container. When running the container in Docker, I do this by specifying the volume flag (-v).

How do I achieve the same when running the container in Kubernetes?

-- Røye
docker
kubernetes
persistent-volumes

1 Answer

1/7/2019

You should use hostpath Volume type in your pod`s spec to mount a file or directory from the host node’s filesystem, where hostPath.path field should be of following format to accept Windows like paths:

  • /W/fooapp/influxdb
  • //W/fooapp/influxdb
  • /////W/fooapp/influxdb

Please check this github issue explaining peculiarities of Kubernetes Volumes on Windows. I assume also that you have enabled Shared Drives feature in your Docker for Windows installation.

-- Nepomucen
Source: StackOverflow