Fabian Deutsch: Containerized iSCSI Demo target

If you want to boot a VM of a disk, then you obviously need a disk.

And as I’m currently playing with launching VMs of iSCSI target’s I took this as an excercise to come up with a nice setup to easily deploy iSCSI targets on a Kubernetes cluster to provide demo images for booting VMs.

Initially I went with writing up a small docker image to add LIO iSCSI targets. But this solution was not really portable (i.e. not running on minikube), because it requires Kernel support (LIO is an in-Kernel target).

But luckily there are some other iSCSI target implementations which provide user-space iSCSI targets – like tgtd.
Alpine – which I initially used – did not offer tgtd, thus I switched over to use Debian, which provides – at least it feels like it – every single project which exists since the beginning of unix timestamp 0.

Anyhow, long story short.
With tgtd it was easy to create an image which contains Alpine and CirrOS as demo images, and export them in a tgt target.

The result is now a simple docker image which you can launch, and if you export the right port, then you got a ready to use iSCSI target which serves Alpine, CirrOS, and an empty LUN.
All of those are inside the contianer, thus the data is not persisted.

Feel free to try it out:

$ docker run 
  -p 3260:3260 
  -it fabiand/iscsi-demo-target-tgtd


# To test:
# In another terminal
$ qemu-system-x86_64 
  -snapshot 
  -serial stdio 
  -drive file=iscsi://127.0.0.1/iqn.2017-01.io.kubevirt:sn.42/2

# Or just to discover
$ iscsiadm --mode discovery -t sendtargets --portal 127.0.0.1


Source From: fedoraplanet.org.
Original article title: Fabian Deutsch: Containerized iSCSI Demo target.
This full article can be read at: Fabian Deutsch: Containerized iSCSI Demo target.

Advertisement


Random Article You May Like

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*