Creating a GlusterFS PersistentVolume
Containers in your application can use the GlusterFS PersistentVolume for data persistence.
You can dynamically provision GlusterFS volume by using a storage class. For more information, see Creating a storage class for GlusterFS.
Or, you can manually create a GlusterFS PersistentVolume in your cluster by completing the steps in the following sections.
To view a list of PersistentVolumes in your cluster, from the navigation menu, click Platform > Storage.
Required user type or access level: Cluster administrator
Creating an endpoint and a service
Create an endpoint and a service only if you are using a GlusterFS server that is configured outside the IBM Cloud Private environment.
The following are required before you can complete this task:
- GlusterFS server cluster with two or more GlusterFS servers must be available for access from your IBM Cloud Private cluster.
- A GlusterFS storage must be created.
-
GlusterFS client must be installed on all IBM Cloud Private nodes:
-
On Ubuntu, run the following commands:
sudo apt-get update
sudo apt-get install glusterfs-client
-
On Red Hat Enterprise Linux (RHEL), run the following command:
sudo yum install glusterfs-client
-
On RHEL Linux® on Power® (ppc64le), first create a repository, then install GlusterFS client:
-
Create a repository:
[centos-gluster40] name=CentOS-$releasever - Gluster 4.0 baseurl=https://buildlogs.centos.org/centos/7/storage/$basearch/gluster-4.0/ gpgcheck=0 enabled=1
-
Install GlusterFS client:
sudo yum install glusterfs-client
-
-
-
Create an endpoint for your GlusterFS server cluster.
Sample YAML
--- kind: Endpoints apiVersion: v1 metadata: name: glusterfs-cluster subsets: - addresses: - ip: 9.111.249.161 ports: - port: 1729 - addresses: - ip: 9.111.249.162 ports: - port: 1729
The
IP
address that you specify must be the address of a node in the GlusterFS server cluster. -
Create the endpoint in Kubernetes:
kubectl create -f glusterfs-endpoints.yaml
-
Verify that the endpoints are successfully created:
kubectl get endpoints
Sample result:
NAME ENDPOINTS glusterfs- glusterfs-cluster 9.111.249.161:1729,9.111.249.162:1729 1h
-
Create a service for the endpoint. Creating a service for the endpoint allows the endpoint to persist. Adding a service without a selector informs Kubernetes that the endpoints are added manually.
Sample YAML
--- kind: Service apiVersion: v1 metadata: name: glusterfs-cluster spec: ports: - port: 1729
-
Create the service in Kubernetes.
kubectl create -f glusterfs-service.yaml
Creating a GlusterFS PersistentVolume by using the Create PersistentVolume dialog box
- Log in to the IBM Cloud Private management console.
- From the navigation menu, click Platform > Storage.
- Click Create PersistentVolume.
-
Enter the PersistentVolume details. The details can be provided either in a JSON format or by completing the fields in the Create PersistentVolume dialog box.
To create a PersistentVolume, the following parameters are required:
General tab
- Name - provide a name for the PersistentVolume.
- Capacity
- Access mode
- Reclaim policy
-
Type of storage - select Glusterfs
Parameters tab
- Parameters for storage. Parameters are supplied as key and value pairs. You must specify:
- An endpoint
- Key: - endpoints
- Value: - the name of the endpoint that was created in step 1 .
- A path
- Key: - path
- Value: - the GlusterFS storage name.
- An endpoint
-
Click Create.
A new GlusterFS PersistentVolume is displayed in the PersistentVolume list. Review the status of the PersistentVolume. The PersistentVolume must have a status of Available
.
Creating a GlusterFS PersistentVolume by using the "Create resource" window
- Log in to the IBM Cloud Private management console.
- From the dashboard, click Create resource.
- Copy and paste a YAML or JSON file into the "Create resource" window. For more information about creating a PersistentVolume by using a YAML file, see https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistent-volumes .
- Click Create.
After the deployment completes, a new PersistentVolume is displayed in the list. Review the status of the PersistentVolume. The volume must be in Available
state.