- Power-off lb-02
- Add a new disk with size 100GB
- Creata a VG using the new disk
pvcreate /dev/sdb
vgcreate vg-targetd /dev/sdb
- Install python build tools and targetd dependancies
sudo apt-get install zip python python-setuptools python-gi python-setproctitle python-yaml python-lvm2
- Download and build targcli , targetd and its dependancies
wget https://github.com/open-iscsi/rtslib-fb/archive/master.zip -O rtslib-fb.zip
wget https://github.com/open-iscsi/targetcli-fb/archive/master.zip -O targetcli-fb.zip
wget https://github.com/open-iscsi/configshell-fb/archive/master.zip -O configshell-fb.zip
wget https://github.com/open-iscsi/targetd/archive/master.zip -O targetd.zip
- Extract all downloaded zip files
unzip rtslib-fb.zip
unzip targetcli-fb.zip
unzip configshell-fb.zip
unzip targetd.zip
- Build and install all packages
cd rtslib-fb-master
./setup.py build
sudo ./setup.py install
cd
cd configshell-fb-master
./setup.py build
sudo ./setup.py install
cd
cd targetcli-fb-master
./setup.py build
sudo ./setup.py install
cd
cd targetd-master
./setup.py build
sudo ./setup.py install
- Create a untit file for targetd
vi targetd.service
[Unit]
Description=targetd storage array API daemon
[Service]
ExecStartPre=-/sbin/modprobe configfs
ExecStart=/usr/local/bin/targetd
[Install]
WantedBy=multi-user.target
- Move unit file to systemd path
sudo mv targetd.service /etc/systemd/system/
- Edit targetd configuration
sudo mkdir /etc/target/
sudo vi /etc/target/targetd.yaml
password: nutanix
# defaults below; uncomment and edit
# if using a thin pool, use <volume group name>/<thin pool name>
# e.g vg-targetd/pool
pool_name: vg-targetd
user: admin
ssl: false
target_name: iqn.2003-01.org.linux-iscsi.linxlabs:targetd
- Start targetd API service
{
sudo systemctl daemon-reload
sudo systemctl enable targetd
sudo systemctl start targetd
}
- Execute below commands from lb-01
- Create secret
kubectl create secret generic targetd-account --from-literal=username=admin --from-literal=password=nutanix
- Create Provisioner
kubectl apply -f https://github.com/ansilh/kubernetes-the-hardway-virtualbox/master/config/iscsi-provisioner-d.yaml
- Create Persistent Volume Claim
kubectl apply -f https://github.com/ansilh/kubernetes-the-hardway-virtualbox/master/config/iscsi-provisioner-pvc.yaml
- Create Storage Class
kubectl create -f https://github.com/ansilh/kubernetes-the-hardway-virtualbox/master/config/iscsi-provisioner-class.yaml
- Verify volume created by provisioner
kubectl get pvc
- Output
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
myclaim Bound pvc-6a727bf8-c66d-11e8-b143-0800276d1e86 100Mi RWO iscsi-targetd-vg-targetd 142m
sudo targetcli ls
- Output
o- / ......................................................................................................................... [...]
o- backstores .............................................................................................................. [...]
| o- block .................................................................................................. [Storage Objects: 1]
| | o- vg-targetd:pvc-6a727bf8-c66d-11e8-b143-0800276d1e86 [/dev/vg-targetd/pvc-6a727bf8-c66d-11e8-b143-0800276d1e86 (100.0MiB) write-thru activated]
| | o- alua ................................................................................................... [ALUA Groups: 1]
| | o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
| o- fileio ................................................................................................. [Storage Objects: 0]
| o- pscsi .................................................................................................. [Storage Objects: 0]
| o- ramdisk ................................................................................................ [Storage Objects: 0]
o- iscsi ............................................................................................................ [Targets: 1]
| o- iqn.2003-01.org.linux-iscsi.linxlabs:targetd ...................................................................... [TPGs: 1]
| o- tpg1 ............................................................................................... [no-gen-acls, no-auth]
| o- acls .......................................................................................................... [ACLs: 3]
| | o- iqn.1993-08.org.debian:01:worker-01 .................................................................. [Mapped LUNs: 1]
| | | o- mapped_lun0 ................................... [lun0 block/vg-targetd:pvc-6a727bf8-c66d-11e8-b143-0800276d1e86 (rw)]
| | o- iqn.1993-08.org.debian:01:worker-02 .................................................................. [Mapped LUNs: 1]
| | | o- mapped_lun0 ................................... [lun0 block/vg-targetd:pvc-6a727bf8-c66d-11e8-b143-0800276d1e86 (rw)]
| | o- iqn.1993-08.org.debian:01:worker-03 .................................................................. [Mapped LUNs: 1]
| | o- mapped_lun0 ................................... [lun0 block/vg-targetd:pvc-6a727bf8-c66d-11e8-b143-0800276d1e86 (rw)]
| o- luns .......................................................................................................... [LUNs: 1]
| | o- lun0 [block/vg-targetd:pvc-6a727bf8-c66d-11e8-b143-0800276d1e86 (/dev/vg-targetd/pvc-6a727bf8-c66d-11e8-b143-0800276d1e86) (default_tg_pt_gp)]
| o- portals .................................................................................................... [Portals: 1]
| o- 0.0.0.0:3260 ..................................................................................................... [OK]
o- loopback ......................................................................................................... [Targets: 0]
o- vhost ............................................................................................................ [Targets: 0]
o- xen-pvscsi ....................................................................................................... [Targets: 0]
Part 18 - Ingress Controller using NIGIX