iscsi configuration on Centos 7 / RHEL7/ Kali

  There are 2 different ways of doing iSCSI target and initiator configuration.
In below example I have done it using "tgtd" on the Server and "open-iscsi" on the clients side.
I have used Centos7 as the "Target" and in the Centos7 I have used KVM and created a "Kali Linux" as a VM. So kali linux VM I have used as iScsi Initiator.

Centos7 Server side output:

  167  yum install scsi-target-utils
  168  systemctl tgtd start
  169  systemctl start tgtd
  170  systemctl status tgtd
  171  systemctl enable tgtd
  172  df -h
  173  fdisk
  174  fdisk -l
  175  vgs
  502  yum provides gnome-disk-utility
  503  yum install gnome-disk-utility-3.14.0-2.el7.x86_64
  504  gnome-disks
  505   cat /etc/tgt/targets.conf
  506  vi /etc/tgt/targets.conf
  507   cat /etc/tgt/targets.conf
  508  systemctl restart tgtd
  509  journalctl -xe
  510  hostname
  511  cd /var/log/
  512  ls
  513  more secure
  514                               
  515  date
  516  ps -ef |grep 16522
  517  systemctl restart tgtd
  518  systemctl status tgtd.service
  519   cat /etc/tgt/targets.conf
  520  vi /etc/tgt/tgtd.conf
  521  vi /etc/tgt/tgtd.conf
  522   cat /etc/tgt/targets.conf
  523  vi /etc/tgt/tgtd.conf
  524  systemctl restart tgtd
  525  systemctl status tgtd
  526  df -k
  527  tgt-admin --show
  528  lvdisplay
  529  tgt-admin --show
530  tgtadm --lld isci --op bind --mode target --tid 1 -I ALL
  531  history

[root@myPC log]# ps -ef |grep 16522
root     16834 13494  0 22:15 pts/1    00:00:00 grep --color=auto 16522
[root@myPC log]# systemctl restart tgtd
Job for tgtd.service failed because the control process exited with error code. See "systemctl statu
s tgtd.service" and "journalctl -xe" for details.
[root@myPC log]# systemctl status tgtd.service
● tgtd.service - tgtd iSCSI target daemon
   Loaded: loaded (/usr/lib/systemd/system/tgtd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2017-01-11 22:17:50 EST; 40s ago
  Process: 16944 ExecStop=/usr/sbin/tgtadm --op delete --mode system (code=exited, status=0/SUCCESS)
  Process: 16940 ExecStop=/usr/sbin/tgt-admin --update ALL -c /dev/null (code=exited, status=0/SUCCE
SS)
  Process: 16938 ExecStop=/usr/sbin/tgtadm --op update --mode sys --name State -v offline (code=exit
ed, status=0/SUCCESS)
  Process: 3189 ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v ready (code=ex
ited, status=0/SUCCESS)
  Process: 16934 ExecStartPost=/usr/sbin/tgt-admin -e -c $TGTD_CONFIG (code=exited, status=1/FAILURE
)
  Process: 16932 ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v offline (code
=exited, status=0/SUCCESS)
  Process: 16928 ExecStartPost=/bin/sleep 5 (code=exited, status=0/SUCCESS)
  Process: 16926 ExecStart=/usr/sbin/tgtd -f $TGTD_OPTS (code=exited, status=0/SUCCESS)
 Main PID: 16926 (code=exited, status=0/SUCCESS)

Jan 11 22:17:45 myPC tgtd[16926]: tgtd: iser_ib_init(3436) Failed to initialize RDMA; load kernel mo
dules?
Jan 11 22:17:45 myPC tgtd[16926]: tgtd: work_timer_start(146) use timer_fd based scheduler
Jan 11 22:17:45 myPC tgtd[16926]: tgtd: bs_init_signalfd(267) could not open backing-store module di
rectory /usr/l...-store
Jan 11 22:17:45 myPC tgtd[16926]: tgtd: bs_init(386) use signalfd notification
Jan 11 22:17:50 myPC tgt-admin[16934]: Multiple default-driver definitions are not allowed!
Jan 11 22:17:50 myPC tgt-admin[16934]: Check your config file for errors.
Jan 11 22:17:50 myPC systemd[1]: tgtd.service: control process exited, code=exited status=1
Jan 11 22:17:50 myPC systemd[1]: Failed to start tgtd iSCSI target daemon.
Jan 11 22:17:50 myPC systemd[1]: Unit tgtd.service entered failed state.
Jan 11 22:17:50 myPC systemd[1]: tgtd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[root@myPC log]#  cat /etc/tgt/targets.conf
# This is a sample config file for tgt-admin.
#
# The "#" symbol disables the processing of a line.

# Set the driver. If not specified, defaults to "iscsi".
default-driver iscsi

# Set iSNS parameters, if needed
#iSNSServerIP 192.168.111.222
#iSNSServerPort 3205
#iSNSAccessControl On
#iSNS On

# Continue if tgtadm exits with non-zero code (equivalent of
# --ignore-errors command line option)
#ignore-errors yes
default-driver iscsi

        backing-store /dev/sda3
        initiator-address 192.168.122.1


[root@myPC log]# vi /etc/tgt/tgtd.conf
[root@myPC log]# vi /etc/tgt/tgtd.conf
[root@myPC log]#  cat /etc/tgt/targets.conf
# This is a sample config file for tgt-admin.
#
# The "#" symbol disables the processing of a line.

# Set the driver. If not specified, defaults to "iscsi".
default-driver iscsi

# Set iSNS parameters, if needed
#iSNSServerIP 192.168.111.222
Jan 11 22:17:50 myPC systemd[1]: Unit tgtd.service entered failed state.
Jan 11 22:17:50 myPC systemd[1]: tgtd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[root@myPC log]#  cat /etc/tgt/targets.conf
# This is a sample config file for tgt-admin.
#
# The "#" symbol disables the processing of a line.

# Set the driver. If not specified, defaults to "iscsi".
default-driver iscsi

# Set iSNS parameters, if needed
#iSNSServerIP 192.168.111.222
#iSNSServerPort 3205
#iSNSAccessControl On
#iSNS On

# Continue if tgtadm exits with non-zero code (equivalent of
# --ignore-errors command line option)
#ignore-errors yes
default-driver iscsi

        backing-store /dev/sda3
        initiator-address 192.168.122.1


[root@myPC log]# vi /etc/tgt/tgtd.conf
[root@myPC log]# vi /etc/tgt/tgtd.conf
[root@myPC log]#  cat /etc/tgt/targets.conf
# This is a sample config file for tgt-admin.
#
# The "#" symbol disables the processing of a line.

# Set the driver. If not specified, defaults to "iscsi".
default-driver iscsi

# Set iSNS parameters, if needed
#iSNSServerIP 192.168.111.222
 Set iSNS parameters, if needed
#iSNSServerIP 192.168.111.222
#iSNSServerPort 3205
#iSNSAccessControl On
#iSNS On

# Continue if tgtadm exits with non-zero code (equivalent of
# --ignore-errors command line option)
#ignore-errors yes
default-driver iscsi

        backing-store /dev/sda3
        initiator-address 192.168.122.1


[root@myPC log]# vi /etc/tgt/tgtd.conf
[root@myPC log]#
[root@myPC log]#
[root@myPC log]# systemctl restart tgtd
[root@myPC log]# systemctl status tgtd
● tgtd.service - tgtd iSCSI target daemon
   Loaded: loaded (/usr/lib/systemd/system/tgtd.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2017-01-11 22:31:39 EST; 14s ago
  Process: 16944 ExecStop=/usr/sbin/tgtadm --op delete --mode system (code=exited, status=0/SUCCESS)
  Process: 16940 ExecStop=/usr/sbin/tgt-admin --update ALL -c /dev/null (code=exited, status=0/SUCCE
SS)
  Process: 16938 ExecStop=/usr/sbin/tgtadm --op update --mode sys --name State -v offline (code=exit
ed, status=0/SUCCESS)
  Process: 17769 ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v ready (code=e
xited, status=0/SUCCESS)
  Process: 17741 ExecStartPost=/usr/sbin/tgt-admin -e -c $TGTD_CONFIG (code=exited, status=0/SUCCESS
)
  Process: 17739 ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v offline (code
=exited, status=0/SUCCESS)
  Process: 17737 ExecStartPost=/bin/sleep 5 (code=exited, status=0/SUCCESS)
 Main PID: 17735 (tgtd)
   CGroup: /system.slice/tgtd.service
           └─17735 /usr/sbin/tgtd -f
Process: 17737 ExecStartPost=/bin/sleep 5 (code=exited, status=0/SUCCESS)
 Main PID: 17735 (tgtd)
   CGroup: /system.slice/tgtd.service
           └─17735 /usr/sbin/tgtd -f

Jan 11 22:31:34 myPC tgtd[17735]: librdmacm: Warning: couldn't read ABI version.
Jan 11 22:31:34 myPC tgtd[17735]: librdmacm: Warning: assuming: 4
Jan 11 22:31:34 myPC tgtd[17735]: librdmacm: Fatal: unable to get RDMA device list
Jan 11 22:31:34 myPC tgtd[17735]: tgtd: iser_ib_init(3436) Failed to initialize RDMA; load kernel mo
dules?
Jan 11 22:31:34 myPC tgtd[17735]: tgtd: work_timer_start(146) use timer_fd based scheduler
Jan 11 22:31:34 myPC tgtd[17735]: tgtd: bs_init_signalfd(267) could not open backing-store module di
rectory /usr/l...-store
Jan 11 22:31:34 myPC tgtd[17735]: tgtd: bs_init(386) use signalfd notification
Jan 11 22:31:39 myPC tgtd[17735]: tgtd: device_mgmt(246) sz:15 params:path=/dev/sda3
Jan 11 22:31:39 myPC tgtd[17735]: tgtd: bs_thread_open(408) 16
Jan 11 22:31:39 myPC systemd[1]: Started tgtd iSCSI target daemon.
Hint: Some lines were ellipsized, use -l to show in full.
[root@myPC log]#
[root@myPC log]#
[root@myPC log]# df -k
Filesystem              1K-blocks     Used Available Use% Mounted on
/dev/mapper/centos-root  52403200 32285408  20117792  62% /
devtmpfs                  1869656        0   1869656   0% /dev
tmpfs                     1879784   624300   1255484  34% /dev/shm
tmpfs                     1879784     9256   1870528   1% /run
tmpfs                     1879784        0   1879784   0% /sys/fs/cgroup
/dev/mapper/centos-home  61410000 26627544  34782456  44% /home
/dev/sda1                  508588   127596    380992  26% /boot
tmpfs                      375960        0    375960   0% /run/user/1001
tmpfs                      375960       16    375944   1% /run/user/1000

[root@myPC log]# tgt-admin --show
Target 1: iqn.2017-01.home.myiPC:target1
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00010000
            SCSI SN: beaf10
            Size: 0 MB, Block size: 1
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            SWP: No
            Thin-provisioning: No
            Backing store type: null
            Backing store path: None
            Backing store flags:
        LUN: 1
            Type: disk
            SCSI ID: IET     00010001
            SCSI SN: beaf11
            Size: 0 MB, Block size: 512
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            SWP: No
            Thin-provisioning: No
            Backing store type: rdwr
            Backing store path: /dev/sda3
            Backing store flags:
    Account information:
    ACL information:
        192.168.122.1
[root@myPC log]#
vi /etc/tgt/targets.conf
default-driver iscsi

        backing-store /dev/sda3
        initiator-address 192.168.122.166

Note:
The initiator address in the file above needs to be the "Client's" IP address not the iscsi target IP..
The firewall to be enabled for port 3260.
Command - # firewall-cmd --add port=3260/tcp

Installing Ingress Controller - Kubernetes

Installing the Ingress Controller Prerequisites Make sure you have access to the Ingress controller image: For NGINX Ingress controll...