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:

  1. Verify pods in the kaas project. After the backup jobs have succeeded, the pods remain in the Completed 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


    By default, the system keeps five latest successful and one latest failed pods.

  2. Obtain an image of the MariaDB container:

    kubectl -n kaas get pods mariadb-server-0 -o jsonpath='{.spec.containers[0].image}'
  3. Create the check_pod.yaml file to create the helper pod required to view the backup volume content.

    Configuration example:

    apiVersion: v1
    kind: ServiceAccount
      name: check-backup-helper
      namespace: kaas
    apiVersion: v1
    kind: Pod
      name: check-backup-helper
      namespace: kaas
        application: check-backup-helper
        - name: helper
            allowPrivilegeEscalation: false
            runAsUser: 0
            readOnlyRootFilesystem: true
            - sleep
            - infinity
          # using image from mariadb sts
          image: <<insert_image_of_mariadb_container_here>>
          imagePullPolicy: IfNotPresent
            - name: pod-tmp
              mountPath: /tmp
            - mountPath: /var/backup
              name: mysql-backup
      restartPolicy: Never
      serviceAccount: check-backup-helper
      serviceAccountName: check-backup-helper
        - name: pod-tmp
          emptyDir: {}
        - name: mariadb-secrets
            secretName: mariadb-secrets
            defaultMode: 0444
        - name: mariadb-bin
            name: mariadb-bin
            defaultMode: 0555
        - name: mysql-backup
            claimName: mariadb-phy-backup-data
  4. 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
  5. 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:

    |-- base
    |   `-- 2021-09-09_11-35-48
    |       |--
    |       |-- backup.successful
    |       |-- grastate.dat
    |       |-- xtrabackup_checkpoints
    |       `-- xtrabackup_info
    |-- incr
    |   `-- 2021-09-09_11-35-48
    |       |-- 2021-09-10_01-02-36
    |       |   |--
    |       |   |-- backup.successful
    |       |   |-- grastate.dat
    |       |   |-- xtrabackup_checkpoints
    |       |   `-- xtrabackup_info
    |       `-- 2021-09-11_01-02-02
    |           |--
    |           |-- backup.successful
    |           |-- grastate.dat
    |           |-- xtrabackup_checkpoints
    |           `-- xtrabackup_info

    The base directory contains full backups. Each directory in the incr folder contains incremental backups related to a certain full backup in the base folder. All incremental backups always have the base backup name as the parent folder.

  6. Delete the helper pod:

    kubectl delete -f check_pod.yaml