Complete Example Using GlusterFS

Overview

This topic provides an end-to-end example of how to use an existing Gluster
cluster as an OpenShift Enterprise persistent store. It is assumed that a working
Gluster cluster is already set up. If not, consult the
Red
Hat Gluster Storage Administration Guide.

Creating the Persistent Volume Claim

A persistent volume claim (PVC) specifies the desired access mode and storage
capacity. Currently, based on only these two attributes, a PVC is bound to a
single PV. Once a PV is bound to a PVC, that PV is essentially tied to the PVC’s
project and cannot be bound to by another PVC. There is a one-to-one mapping of
PVs and PVCs. However, multiple pods in the same project can use the same PVC.

In order to access the HadoopVol volume, the container must match the SELinux
label, and either run with a UID of 592, or with 590 in its supplemental groups.
It is recommended to gain access to the volume by matching the Gluster mount’s
groups, which is defined in the pod definition below.

By default, SELinux does not allow writing from a pod to a remote Gluster
server. To enable writing to GlusterFS volumes with SELinux enforcing on each
node, run:

# setsebool -P virt_sandbox_use_fusefs on

The virt_sandbox_use_fusefs boolean is defined by the docker-selinux
package. If you get an error saying it is not defined, ensure that this package
is installed.

Creating the Pod

A pod definition file or a template file can be used to define a pod. Below is a
pod specification that creates a single container and mounts the Gluster volume
for read-write access: