问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/54073794/kubernetes-persistent-volume-on-docker-desktop-windows