Kubernetes Volume Plugin for Nutanix ABS

So today I’ll show how install and use the Kubernetes Volume Plugin for Nutanix ABS (Acropolis Block Services).

I already have my setup up-and-running. As I describe in my previous post How Install Kubernetes on CentOS 7. If you haven’t seen this, please check this one out.

The only thing what I’ve added to my setup is a single node Nutanix Community Edition cluster.
If you want to know how to run Nutanix CE checkout this website. https://www.nutanix.com/products/community-edition/

So let’s get started!

Prerequisites
I’ll start by creating a local Nutanix user.
Login into my Nutanix cluster, open up Local User Management and create a new user

Now that the user is create let’s hop to both of our worker node and install the iSCSI initiator utilities

Once the iSCSI utils are installed we need to make sure that the InitiatorName is the same on all worker node. This name will be used to connect to the Nutanix cluster. This is also the default name.

Since I’ve had connectivity issues between the workers and the Nutanix cluster, cause it didn’t accept the InitiatorName after I changed it. I rebooted both worker nodes.

Now that the worker nodes are rebooting, let’s login into our Master node

Create a base64 hash with the Nutanix login credentials that we will use to connect Kubernetes with the Nutanix cluster.
Note: Keep in mind that your values may differ from those below.

Copy the hash to you clipboard or save it in a different location.

Installation
To install the volume plugin, we need to download it first.
You can use wget or you can download the file right here

Next, we need to edit 3 sections within the plugin-file.

The first section is ### StorageClass ###
Change for both gold and silver the following attributes.
Please don’t touch user, password or secretName unless you know what you’re doing.
* prism_ip_address
* data_service_ip_address
* storage_container

Additional options are optional
* fsType
* chapAuthEnabled
* iscsiSecretName
* defaultIqn

The second is ### Secret Credentials ###
Replace the hash “AABBCCDDEEFFGG==” with the one we created earlier.

The last section is ### iSCSI CHAP Authentication ###
If you use iSCSI CHAP you need add your base64 password, but in our case I will delete these lines, since I’m not using iSCSI CHAP.

Now that we’ve edited the plugin-file we can install the Kubernetes Volume Plugin for Nutanix ABS

Check if the plugin is installed and if its working. This could take a few minutes

Next, we need to create a Persistent Volume Claim to test of our plugin is working.
Create a file with the following content and install this file.

Verify if the pvc is created and if its automatically bounded.

Login in the Nutanix cluster to see if the volume group is created.

Yes it is!

Delete the pvc and check if the volume is deleted in Kubernetes and Nutanix

And it’s gone…..

NGINX with Persistent Storage
Now that we know we can create a pvc on Nutanix let’s deploy a NGINX with persistent storage,
so when the NGINX pod is recreated/deleted the content still exist.

Create 2 new files with the following content and install both files

Verify if both are up-and-running. This could take a few minutes

Get inside the NGINX container.

Create a simple HTML file

Exit the container

Make the NGINX container available to the network

Check if the NGINX is listing

Let’s test with a curl command if can display the NGINX index.html page we created.

If you have the same output, we can delete the NGINX pod to check if our persistent storage works.

If we’re quick and execute the get pods command fast, we can see that our first NGINX container is Terminating and a new one is created.

After a couple of seconds the new NGINX container is up-and-running and should host the same index.html. Use curl once again to check if I’m right

If you see the same output as above or you own text, congratulations, your NGINX container has been deployed with the help of the Kubernetes Volume Plugin for Nutanix ABS.

If you have some suggestions or tips, just leave a comment below.

Thanks for reading.

Leave a Reply

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