Working with GlusterFS storage (IBM Cloud Private)

Brian Venn
IBM Cloud
Published in
4 min readNov 21, 2017

When deploying a Kubernetes application, it often needs provisioned storage to hold data.

One of the many supported storage types in IBM Cloud Private (ICP) is GlusterFS. For more information about the persistent volume types supported by Kubernetes, See https://kubernetes.io/docs/user-guide/persistent-volumes/ .

This blog will show you how to:

  1. Create a persistent volume that uses GlusterFS
  2. Create a persistent volume claim that can be used to make request from the GlusterFS persistent volume.

Part 1: Set up GlusterFS

Pre-reqs.

For this walkthrough, the following is required

  • A GlusterFS server cluster must be available with two or more GlusterFS servers
  • A GlusterFS storage must be created
  • GlusterFS client must be installed on all IBM Cloud Private nodes

The following article provides a walkthough of how to setup GlusterFS.

http://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/install-and-configure-glusterfs-on-ubuntu-16-04-debian-8.html

For the purposes of this walkthrough, we will assume that a GlusterFS cluster has been created with 5GB of available space and a volume name of gvol0, and the glusterfs-client has been installed on the ICP Nodes

Part 2: Create an endpoint for the GlusterFS server cluster

This is done by using kubectl and a yaml file.

1. Using the following as a template

--- kind: Endpoints apiVersion: v1 metadata: name: glusterfs-demo subsets: - addresses: - ip: 9.12.34.56 ports: - port: 1729 - addresses: - ip: 9.98.76.54 ports: - port: 1729

Note: Change the IP addresses to those of the nodes in the GlusterFS cluster created in Part 1.

Save the content in a file on the master node.

2. Ensure that the kubectl CLI is configured. (See https://www.ibm.com/support/knowledgecenter/en/SSBS6K_2.1.0/manage_cluster/cfc_cli.html)

3. Create the endpoint, by running the following command:

kubectl create -f <filename-from-step1>.yaml

4. Check that the endpoints are successfully created.

kubectl get endpoints

If the endpoint is successfully created, the output resembles the following code:

NAME ENDPOINTS glusterfs- glusterfs-demo 9.12.34.56:1729,9.98.76.54:1729

Part 3: Create the Persistent Volume

In order to provision the GlusterFS storage in your cluster. First create the persistent volume. To create the persistent volume:

1. Log into the IBM Cloud Private console.

2. From the menu , select Platform > Storage.

3. Click on Create PersistentVolume.

4. Create a GlusterFS Persistent Volume by entering the following parameters:

In the general tab, provide values for the following parameters:

  • Name : <Enter a valid name>
  • Volume capacity : <Enter a value that can be accommodated by the GlusterFS cluster created in part 1)
  • Select the persistent volume type as Gluster FS

In the parameters tab, provide these values:

  • endpoints — The name of the endpoints created in the script in part 2. In the example, it was glusterfs-demo
  • path — The name of the GlusterFS volume. Ensure that you enter the Volume Name of the GlusterFS you created in part 1, NOT the path

5. Click Create.

6. Check the status of the storage. It must have a status of Available

The persistent volume is now ready to service persistent volume claims. Note that currently there are no claims against this persistent volume (see the Claim column).

Part 4: Create the Persistent Volume Claim

1. Log into the IBM Cloud Private console.
2. From the menu, select Platform > Storage
3. Click the PersistentVolumeClaim tab, then click Create PersistentVolumeClaim

4. Enter a name for the volume and a storage request amount. Ensure that you enter storage request amount that can be contained by the GlusterFS file system you created in part 1.

5. Click Create.
6. Check the status of the Persistent Volume Claim . The persistent volume claim will have a status of Bound, and the persistent volume column showing it bound to the persistent volume created in step 3.

The persistent volume claim is now ready to be used by an application.

Part 5: Deploy an application

The created storage can now be used with any application that requires it. Try this now with any application you by using the Workloads->Deployments->Create Deployment option in the IBM Cloud Private console.

When setting up your application deployment, from the Volumes tab, enter the name of the bound Persistent Volume claim that was created in step 4. For example,

Once the application has been successfully deployed, check the status of the storage from the Deployments->AppName->Pod Name->Events page.

If successful, the output resembles the following, and reports a SuccessfulMountVolume.

Originally published at www.ibm.com.

--

--