Creating a storage class for GlusterFS

Create a storage class to provision GlusterFS storage.

Required user type or access level: Cluster administrator

To create a storage class for GlusterFS, specify the following field values in the storage class definition:

To create a storage class for GlusterFS, you must complete the steps that are shown in the following example:

  1. Create a YAML file that is named glusterfs.yaml and contains the following storage class definitions:

    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: glusterfs
    provisioner: kubernetes.io/glusterfs
    parameters:
      resturl: "https://10.0.0.185:8080"
      restuser: "admin"
      secretName: "heketi-secret"
      secretNamespace: "kube-system"
      volumetype: replicate:3
      volumenameprefix: "icp"
    

    Note: If your GlusterFS cluster is in an IBM® Cloud Private environment, you must use the following parameter values:

    • restuser must be "admin"
    • secretName is the same secret that you used for Heketi authentication during GlusterFS installation
    • secretNamespace must be "kube-system"

    To make this your default storage class, add the annotation storageclass.kubernetes.io/is-default-class and set it to true.

  2. Create the storage class:

    kubectl create -f glusterfs.yaml
    

    The output resembles the following code:

    storageclass "glusterfs" created
    
  3. Verify that the storage class is created:

    kubectl describe sc glusterfs