Verify operability of the MariaDB backup jobs¶
After you configure the MariaDB periodic jobs, verify that backup jobs are operational by creating a helper pod to view the backup volume content.
To verify operability of the MariaDB backup jobs:
Verify pods in the
kaas
project. After the backup jobs have succeeded, the pods remain in theCompleted
state:kubectl -n kaas get pods -l application=mariadb-phy-backup
Example of a positive system response:
NAME READY STATUS RESTARTS AGE mariadb-phy-backup-1599613200-n7jqv 0/1 Completed 0 43h mariadb-phy-backup-1599699600-d79nc 0/1 Completed 0 30h mariadb-phy-backup-1599786000-d5kc7 0/1 Completed 0 6h17m
Note
By default, the system keeps five latest successful and one latest failed pods.
Obtain an image of the MariaDB container:
kubectl -n kaas get pods mariadb-server-0 -o jsonpath='{.spec.containers[0].image}'
Create the
check_pod.yaml
file to create the helper pod required to view the backup volume content.Configuration example:
apiVersion: v1 kind: ServiceAccount metadata: name: check-backup-helper namespace: kaas --- apiVersion: v1 kind: Pod metadata: name: check-backup-helper namespace: kaas labels: application: check-backup-helper spec: containers: - name: helper securityContext: allowPrivilegeEscalation: false runAsUser: 0 readOnlyRootFilesystem: true command: - sleep - infinity # using image from mariadb sts image: <<insert_image_of_mariadb_container_here>> imagePullPolicy: IfNotPresent volumeMounts: - name: pod-tmp mountPath: /tmp - mountPath: /var/backup name: mysql-backup restartPolicy: Never serviceAccount: check-backup-helper serviceAccountName: check-backup-helper volumes: - name: pod-tmp emptyDir: {} - name: mariadb-secrets secret: secretName: mariadb-secrets defaultMode: 0444 - name: mariadb-bin configMap: name: mariadb-bin defaultMode: 0555 - name: mysql-backup persistentVolumeClaim: claimName: mariadb-phy-backup-data
Apply the helper service account and pod resources:
kubectl -n kaas apply -f check_pod.yaml kubectl -n kaas get pods -l application=check-backup-helper
Example of a positive system response:
NAME READY STATUS RESTARTS AGE check-backup-helper 1/1 Running 0 27s
Verify the directories structure within the
/var/backup
directory of the spawned pod:kubectl -n kaas exec -t check-backup-helper -- tree /var/backup
Example of a system response:
/var/backup |-- base | `-- 2021-09-09_11-35-48 | |-- backup.stream.gz | |-- backup.successful | |-- grastate.dat | |-- xtrabackup_checkpoints | `-- xtrabackup_info |-- incr | `-- 2021-09-09_11-35-48 | |-- 2021-09-10_01-02-36 | | |-- backup.stream.gz | | |-- backup.successful | | |-- grastate.dat | | |-- xtrabackup_checkpoints | | `-- xtrabackup_info | `-- 2021-09-11_01-02-02 | |-- backup.stream.gz | |-- backup.successful | |-- grastate.dat | |-- xtrabackup_checkpoints | `-- xtrabackup_info
The
base
directory contains full backups. Each directory in theincr
folder contains incremental backups related to a certain full backup in thebase
folder. All incremental backups always have the base backup name as the parent folder.Delete the helper pod:
kubectl delete -f check_pod.yaml