2021 Call for Code Awards: Live from New York, with SNL’s Colin Jost! Learn more

How to use Red Hat OpenShift Data Foundation on IBM Power Systems

Introduction

Red Hat OpenShift Data Foundation—previously Red Hat OpenShift Container Storage—is software-defined storage for containers.

The previous two tutorials in this series explained how to deploy Red Hat OpenShift Data Foundation on IBM Power Systems and to validate it. This tutorial shows how to use Ceph’s block and file storage in your application workload pods.

Prerequisites

To use Ceph’s block and file storage in your application workload pods, you need a functioning and validated OpenShift Container Platform and OpenShift Data Foundation.

Estimated time

It takes around 1 hour to complete the steps outlined in this tutorial to use Ceph block and file storage in your application workload pods.

Steps

To use Ceph’s block or file storage, you need to know the corresponding storage classes. These storage classes are pre-created for your convenience during the OpenShift Data Foundation deployment step.

Storage class name Provisioner
ocs-storagecluster-ceph-rbd openshift-storage.rbd.csi.ceph.com
ocs-storagecluster-cephfs opensift-storage.cephfs.csi.ceph.com

Perform the following steps to use Ceph’s block and file storage in your application workload pods:

  1. Using these storage classes, create persistent volume claims (PVCs). But for convenience let us refer to something that is already done and available.
  2. While going through the Verify Red Hat OpenShift Data Foundation deployment on IBM Power Systems tutorial in this series, you would have cloned the rook example repository using the following command:

    git clone https://github.com/rook/rook.git

    In the cloned repository, find the mysql.yaml file in the rook/cluster/examples/Kubernetes directory. The mysql.yaml filehas the definitions for a PVC and deployment. There will be no reference to namespaces in this YAML file. So, create them in your current namespace. In this file, you need to update the storage class name for the PVC definition.

    1. Change the storage class name as:

      storageClassName: ocs-storagecluster-ceph-rbd

    2. Update the deployment image as:

      image: registry.redhat.io/rhel8/mysql-80

    3. Install the mysql workload pod:

      # oc create -f rook/cluster/examples/kubernetes/mysql.yaml 
      service/wordpress-mysql created
      persistentvolumeclaim/mysql-pv-claim created
      deployment.apps/wordpress-mysql created
      
  3. After a few minutes, run the following commands and notice that both PVC and the pods are up and running:

    # oc get pvc
    NAME             STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS                  AGE
    mysql-pv-claim   Bound    pvc-2b454afe-d12c-42e7-b8da-4e91eb6384a5   20Gi       RWO            ocs-storagecluster-ceph-rbd   82s
    
  4. In the output, notice that the Status shows Bound indicating that the PVC is bound to the underlying persistent volume successfully.

    # oc get pod
    NAME                               READY   STATUS    RESTARTS   AGE
    wordpress-mysql-77c9dffd88-b4rcm   1/1     Running   0          85s
    
  5. According to the definition of deployment in mysql.yaml, the Ceph block volume is mounted under the /var/lib/mysql directory. verify the same using the following commands:

    # oc rsh wordpress-mysql-77c9dffd88-b4rcm sh
    sh-4.4$ cd /var/lib/mysql
    sh-4.4$ ls -la
    total 32
    drwxrwxrwx. 4 root  root   4096 May 22 23:09 .
    drwxr-xr-x. 1 root  root    108 May  5 16:57 ..
    drwxr-x---. 6 mysql mysql  4096 May 22 23:09 data
    drwx------. 2 root  root  16384 May 22 23:08 lost+found
    srwxrwxrwx. 1 mysql mysql     0 May 22 23:09 mysql.sock
    -rw-------. 1 mysql mysql     2 May 22 23:09 mysql.sock.lock
    srwxrwxrwx. 1 mysql mysql     0 May 22 23:09 mysqlx.sock
    -rw-------. 1 mysql mysql     3 May 22 23:09 mysqlx.sock.lock
    sh-4.4$ exit
    exit
    
  6. Ensure that mysql and the corresponding persistent volume are created and are available.

    # oc get pv | grep mysql
    pvc-2b454afe-d12c-42e7-b8da-4e91eb6384a5   20Gi       RWO            Delete           Bound       default/mysql-pv-claim                                     ocs-storagecluster-ceph-rbd            5m47s
    

This demonstrates that a persistent volume claim is carved out of Ceph’s block storage, and it is allocated and mounted successfully in a pod.

Summary

After deploying OpenShift Data Foundation on OpenShift Container Platform on IBM Power Systems, you can follow the steps in this tutorial to use Ceph’s block and file storage in your application workload pods.

Refer to the following tutorials for more information: