Kubernetes persistent volume on Docker Desktop (Windows) - Stack Overflow
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
The folder mount for /run/desktop/mnt/host/c
does not exist on the distro you installed in WSL2 - on that WSL2 distro, the mount point to your C:\ drive is the more obvious /mnt/c
.
Realize that Kubernetes and Docker are not installed in your installed WSL2 distro. Instead, Docker Desktop for Windows creates its own WSL2 VM called docker-desktop
and installs Docker and Kubernetes on that VM. Then Docker Desktop for Windows installs the docker
and kubectl
CLIs on your WSL2 distro (and also on your Windows machine) and configures them all to point to the Docker and Kubernetes instances it created on the docker-desktop
VM. This docker-desktop VM is hosting Docker and Kubernetes and also contains the /run/desktop/mnt/host/c
mount point to your Windows C:\ drive and that can be used by your containers to persist data.