Gemini: Automate Backups of PersistentVolumes in Kubernetes

Persistent Storage is Hard

Searching for a Solution

Creating Gemini

apiVersion: gemini.fairwinds.com/v1beta1
kind: SnapshotGroup
metadata:
name: postgres-backups
spec:
persistentVolumeClaim:
claimName: postgres-data
schedule:
- every: 10 minutes
keep: 3
apiVersion: gemini.fairwinds.com/v1beta1
kind: SnapshotGroup
metadata:
name: postgres-backups
spec:
persistentVolumeClaim:
claimName: postgres-data
schedule:
- every: 10 minutes
keep: 3
- every: hour
keep: 1
- every: day
keep: 1
- every: week
keep: 1
- every: month
keep: 1
- every: year
keep: 1

Restoring Data

$ kubectl get volumesnapshot
NAME AGE
postgres-backups-1585945609 15m
kubectl scale all --all --replicas=0
kubectl annotate snapshotgroup/postgres-backups --overwrite \ "gemini.fairwinds.com/restore=1585945609"
kubectl scale all --all --replicas=1
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: restore-pvc
spec:
dataSource:
name: postgres-backups-1585945609
kind: VolumeSnapshot
apiGroup: snapshot.storage.k8s.io
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi

Going Forward

Fairwinds — The Kubernetes Enablement Company | Editor of uptime 99