Galera Cluster with Rook-Ceph in Kubernetes

Alex Punnen
2 min readSep 25, 2019

--

Follow the guide here

https://severalnines.com/database-blog/running-galera-cluster-kubernetes

Only change for PV rook-ceph. Note first install rook-ceph in your cluster via the templates in rook-ceph github

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: mysql-datadir-galera-ss-0
spec:
storageClassName: rook-ceph-block
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: mysql-datadir-galera-ss-1
spec:
storageClassName: rook-ceph-block
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: mysql-datadir-galera-ss-2
spec:
storageClassName: rook-ceph-block
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi

Kubectl get pvc will give

mysql-datadir-galera-ss-0                 Bound     pvc-b3ae532e-317f-4d74-b63c-c04885ef6c8d   10Gi       RWO            rook-ceph-block   12d
mysql-datadir-galera-ss-1 Bound pvc-7861469f-b56f-42f8-8b20-7ca26b5aedf4 10Gi RWO rook-ceph-block 12d
mysql-datadir-galera-ss-2 Bound pvc-cce0477e-11ca-4d9f-8ceb-8653fb2fb05d 10Gi RWO rook-ceph-block 12d

kubectl get pvc in namespace rook-ceph will give

core@alex-k8s-1 ~ $ kubectl get pvc -n rook-ceph
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
galera-pv-claim Bound pvc-b1092630-a7ea-440d-83af-31bcdf815daa 20Gi RWO rook-ceph-block 12d

and get persistant volumes will be

kubectl get pv -n rook-ceph

pvc-7861469f-b56f-42f8-8b20-7ca26b5aedf4   10Gi       RWO            Delete           Bound    default/mysql-datadir-galera-ss-1   rook-ceph-block            12dpvc-b3ae532e-317f-4d74-b63c-c04885ef6c8d   10Gi       RWO            Delete           Bound    default/mysql-datadir-galera-ss-0   rook-ceph-block            12dpvc-cce0477e-11ca-4d9f-8ceb-8653fb2fb05d   10Gi       RWO            Delete           Bound    default/mysql-datadir-galera-ss-2   rook-ceph-block            12d
core@alex-k8s-1 ~/charts/stable/prometheus $ cat ~/storageclass.yaml 
apiVersion: ceph.rook.io/v1
kind: CephBlockPool
metadata:
name: replicapool
namespace: rook-ceph
spec:
failureDomain: host
replicated:
size: 3
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: rook-ceph-block
# Change "rook-ceph" provisioner prefix to match the operator namespace if needed
provisioner: rook-ceph.rbd.csi.ceph.com
parameters:
# clusterID is the namespace where the rook cluster is running
clusterID: rook-ceph
# Ceph pool into which the RBD image shall be created
pool: replicapool
# RBD image format. Defaults to "2".
imageFormat: "2"
# RBD image features. Available for imageFormat: "2". CSI RBD currently supports only `layering` feature.
imageFeatures: layering
# The secrets contain Ceph admin credentials.
csi.storage.k8s.io/provisioner-secret-name: rook-ceph-csi
csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph
csi.storage.k8s.io/node-stage-secret-name: rook-ceph-csi
csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph
# Specify the filesystem type of the volume. If not specified, csi-provisioner
# will set default as `ext4`.
csi.storage.k8s.io/fstype: xfs
# Delete the rbd volume when a PVC is deleted
reclaimPolicy: Delete

--

--

Alex Punnen
Alex Punnen

Written by Alex Punnen

SW Architect/programmer- in various languages and technologies from 2001 to now. https://www.linkedin.com/in/alexpunnen/

No responses yet