block-volume-attacher provides an image which performs the attach of block volumes on any desired node. It also does the detach of the volumes which are no longer needed.
- Ensure the following
environment
variables are set:- SL_API_KEY
- SL_USERNAME
- BM_API_KEY
- Ensure that the Python
Softlayer
package has been installed:See : http://softlayer-api-python-client.readthedocs.io/en/latest/install/pip install softlayer
- Login to cluster by using
bx login
command - Initialise the
bx sl
to your account used in cluster.bx sl init
- Create a parameter file of the following form, called
yamlgen.yaml
in the current working directoryFor this parameter file, the# # Can only specify 'performance' OR 'endurance' and associated clause # cluster: mypxcluster # name of IKS cluster region: us-east # cluster region type: endurance # performance | endurance offering: storage_as_a_service # storage_as_a_service | enterprise | performance # performance: # - iops: 100 # INTEGER between 100 and 1000 in multiples of 100 endurance: - tier: 0.25 # [0.25|2|4|10] size: [ 20 ] # list: number of disks per worker node to be created, of a given size
size
array indicated the number and size of remote block devices that will be created for each worker node in the cluster. The 'size' array takes volume size as a comma-separated list input. A volume will then be created for each of the sizes given in the array and for every worker node in the cluster. Ensure that the length of thesize
array corresponds to the number of desired remote block devices per worker node. For example:size: [ 20, 50 ]
will create 2 disks per worker node, with corresponding sizes 20Gi and 50Gi. Please ensure that theregion
corresponds to the region where your existing IKS cluster resides. - Run the block volume creation script
chmod +x mkpvyaml ./mkpvyaml
- Order a new block volume using the command
bx sl block volume-order -h
bx sl block volume-order -t endurance -s 20 -e 2 -o LINUX -d dal09
- Authorise the worker node with the volume ID where this volume needs to be attached using command
bx sl block access-authorize -h
.bx sl block access-authorize 12345678 -p 10.171.236.248
- Confirm if the worker node is successfully authorised to the volume using command
bx sl block access-list <VOLUME ID>
. If its authorised then the IQN, username and password of the worker can be seen which needs to be used later.bx sl block access-list 12345678
- Run the
bx sl block volume-detail <VOLUME ID>
to see the volume details such as Target portal IP which needs to be used later.bx sl block volume-detail 12345678
- Provide the block volume details IQN, username, password, target portal IP and Lun ID in the
pv.yaml
file. - Provide the worker node IP address in the
ibm.io/nodeip
annotation of thepv.yaml
file. This should be the node where the volume is authorised and has to be attached.
- Download the docker image file
block-volume-attacher.tar
. - Use command
docker load
to load it locally on your system.docker load < block-volume-attacher.tar docker images REPOSITORY TAG IMAGE ID CREATED SIZE registry.ng.bluemix.net/akgunjal/armada-block-volume-attacher latest 7b0ba7a4151c 2 hours ago 88.7MB
- Perform the
bx login
with your Bluemix account. - After bx login, run the command
bx cr login
to login into the registry. - Use an existing namespace from the
bx cr namespaces
command or create a new namespace usingbx cr namespace-add
command. This namespace is needed to store images in the IBM Cloud Container Registry. - Tag the docker image loaded in
STEP 2
with the registry and using your namespace where you want to store the image.docker images REPOSITORY TAG IMAGE ID CREATED SIZE registry.ng.bluemix.net/akgunjal/armada-block-volume-attacher latest 7b0ba7a4151c 2 hours ago 88.7MB docker tag registry.ng.bluemix.net/akgunjal/armada-block-volume-attacher registry.ng.bluemix.net/<YOUR NAMESPACE>/armada-block-volume-attacher
- Push the docker image to the registry onto your namespace.
docker push registry.ng.bluemix.net/<YOUR NAMESPACE>/armada-block-volume-attacher
- You will now see the image in
bx cr images
. - Deploy IBM Cloud Block Storage Attacher using the helm chart.
- Create the persistent volume using the
pv-<clustername>.yaml
file, which was generated either using the automated scriptmkpvyaml
or through manual steps above. This will attach the block volume on the worker node.kubectl describe pv
command will show the status asattached
and the annotations will also contain the device path (Example:/dev/dm-0
) which indicates the successful attach of the volume. - Verify that a
/dev/dm-X
device has been created for all the PV's before proceeding.Make note of all the$ kubectl describe pv kube-wdc07-cr43d37fc1fc5a4801acb7404054baa3aa-w2-pv1 | grep dm ibm.io/dm=/dev/dm-0
/dev/dm-X
devices that are attached.
- Delete the persistent volume to detach the block volume from the worker node.
- Unauthorise the worker node for the volume ID where it was attached. This will prevent this volume from getting attached again during the rescan of iSCSI session.
bx sl block access-revoke 12345678 -p 10.171.236.248
- Optional: If you do not want this block volume any further, then it can be deleted from SoftLayer using the command
bx sl block volume-cancel -h
.bx sl block volume-cancel -f 12345678
- If the
kubectl describe pv
output does not show the status asattached
or the device path is not seen after performing remote volume attach then retrieve the logs of the daemon set pod for the worker where attach did not happen.kubectl -n kube-system logs ibmcloud-block-storage-attacher-hwtpz
- Retrieve the attacher service logs from inside the daemon set pod for the worker where attach has failed.
kubectl -n kube-system exec ibmcloud-block-storage-attacher-hwtpz -- cat /host/var/log/ibmc-portworx-service.log