Glusterfs

Install glusterfs

Add gluster repo

Create the repo file "/etc/yum.repos.d/glusterfs.repo":

[gluster312]
name=Gluster 3.12
baseurl=http://mirror.centos.org/centos/7/storage/$basearch/gluster-3.12/
gpgcheck=0
enabled=1

Install packages

Start services

Connect peers

Peers need to trust eachother. To do that run the following command on all nodes with all hostnames in tje cluster.

Add storage

First add the disk to every system and mount it under a fixed location. This location is going to be used as "Brick" for the glusterfs. In case you use vSphere to prvision the volumes make sure to mount the disk based on id and not on name. The name can easely change but the id stays the same (make sure to "set disk.enableUUID=1" on the vSphere machine).

For example:

Add bricks

Integrate with Kubernetes

Links

Debugging

Files

gluster-service.yml

apiVersion: v1
kind: Service
metadata:
  name: glusterfs-cluster 
spec:
  ports:
  - port: 1

gluster-endpoint.yml

apiVersion: v1
kind: Endpoints
metadata:
  name: glusterfs-cluster 
subsets:
- addresses:
  - ip: 
  ports:
  - port: 1
- addresses: - ip:
ports:
- port: 1
- addresses: - ip:
ports:
- port: 1

persistentvolume.yml

apiVersion: v1
kind: PersistentVolume
metadata:
  name: gluster-pv 
spec:
  capacity:
    storage: 2Gi 
  accessModes: 
    - ReadWriteMany
  glusterfs: 
    endpoints: glusterfs-cluster 
    path: gluster
    readOnly: false
  persistentVolumeReclaimPolicy: Retain

persistentvolumeclaim.yml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: gluster-pvc
spec:
  accessModes:
  - ReadWriteMany 
  resources:
     requests:
       storage: 2Gi