smartxworks / virtink

Lightweight Virtualization Add-on for Kubernetes
Apache License 2.0
492 stars 41 forks source link

Does virtink support mount a PVC into some path in vm? #32

Closed weixiao-huang closed 2 years ago

weixiao-huang commented 2 years ago

Sometimes, we want to mount a PVC into the VM to persistent some data. For example, we have a PVC called my-data and we want to mount it into /data path into vm. So does virtink support it? To do this thing, I think there're two hands:

  1. mount volume from host machine into VM (hostPath or local-path-provisioner)
  2. mount volume from network (directly mount ceph rbd from network into VM) So does virtink support one of the two method above?
scuzhanglei commented 2 years ago

yes, virtink already support PVC, 1) for Block PVC you can use it directly, 2) for filesystem PVC, need make sure a disk image file named asdisk.img in PVC root path. a better way is use DataVolume, which will create disk.img for filesystem PVC root path automatically. this is an example VM with Datavolume.

weixiao-huang commented 2 years ago

But how to specify the volume's mount path in the VM? I've seen the docs about the DataVolume but it seems that I didn't find some examples about specifying the volume mount path

fengye87 commented 2 years ago

@weixiao-huang To mount a disk to a path inside a VM, you have several options:

All Virtink could do is provide a volume as a VM disk to the VM, but the mounting part should be taken care of inside the VM.

fengye87 commented 2 years ago

@weixiao-huang I'm closing this issue, feel free to reopen it if you want.