Working with iSCSI Target and Initiator to Mount on Clients
Senior Vice President of Content
Being able to work with iSCSI block storage on servers and clients is becoming a common skill in today's distributed IT organizations. This activity will allow you to get hands on with setting up both an iSCSI initator and target (client and server) in order to mount that block storage on a system. Once you have completed this activity, you will understand how to make iSCSI storage available and then consume it on a system.
During your team's support of the development team in charge of creating the company's new web-based API, the team is ready to begin working on some clustering with containers. In order to conserve resources, they will be using shared volumes on their container servers, so they want to take advantage of some of the space already allocated to one of their development servers in order to mount on each node in the cluster. iSCSI was determined to be supported for shared volumes in container clusters, so you have been asked to assist.
You will be provided access credentials to a CentOS 7 system. Once logged in, you will find that in addition to the already configured storage available for the operating system, there are three additional block devices of 20gb each that are unconfigured (not partitioned yet). You will be using one of these 20gb partitions to create an iSCSI target that can be accessed by other systems. Choose the first 20gb device for your target and begin the iSCSI setup to make that 20gb available.
In order to complete the server configuration, you will need to:
- Install the iSCSI server utilities
- Use the command line iSCSI utilities to
- create a block backstore using the devicename (/dev/xvdj for instance - yours may differ)
- create the iSCSI Qualified Name called iqn.2018-11.com.example with a target named 't1' and get an associated Target Portal Group
- create the ACL for the client machine
- change to that IQN just created, and create a lun from that backstore
- Save the configuration
- Enable and Start the iSCSI service
For the client configuration (in this case, the same system for verification only), you will need to:
- Install the iSCSI initiator utilities
- Edit the /etc/iscsi/initiatorname.iscsi and add the IQN name from the ACL above for the client
- Run the command to discover the target
- Restart the service
- Login to the discovered target
Once you discover the target and can verify a connection (so that the target is able to be seen with an appropriate client configuration), you can turn over the system to your development team.