Creating a custom resource file for backups

Before you install GuardiumĀ® Insights, you must enable backups with a Network File System (NFS) storage class by using a YAML custom resource (CR) file. To configure backups, you must provision your own Persistent Volume (PV) and Persistent Volume Claim (PVC).

The back up process

Guardium Insights backups run as CronJobs and can be activated by using a YAML file.

The YAML file defines the frequency of backups, the schedule of the backup, and the number of days that the backup is retained. A pod that contains the backup scripts is created and the top-level script is executed. The default location of the backup directory is in the backup pod, unless it is configured differently.

During a full backup, the configuration files (such as LDAP information and oc secrets) and internal databases (Db2, MongoDB, and PostgreSQL) are backed up. During an incremental backup, the configuration files are not backed up.

The YAML file is applied by running the command oc apply -f backup.yaml.

YAML CR file definition

Create a YAML CR file by using the code in the following example:

apiVersion: gi.ds.isc.ibm.com/v1
kind: Backup
metadata:
  name: insights
spec:
  gi-backup:
    cronjob:
      # schedule of jobs
      schedule: "0 23 * * *"
    insightsEnv:
      #How many days to keep the full backups, default 0, never remove
      RETENTION_FULL_BACKUP_IN_DAYS: 30
      #How frequent (in days) the full backup should be. (Default 7)
      FREQUENCY_FULL_BACKUP_IN_DAYS: 15
      #After X times of DB2 incremental backup, the next round of job 
      #will perform a system full backup. (Default 6)
      FREQUENCY_FULL_BACKUP_IN_INC_COUNT: 14
      #Resume the full backup process from where it failed before if 
      #failure occurred in previous full backup job run. (Default true)
      RESUME_FULL_BACKUP_ON_FAILURE: true
    persistentVolumesClaims:
      backup: 
        name: gi-custom-named-pvc
        size: 500Gi 
        storageClassName: <storage class on your system>
        volumeName: gi-sample-pv
  targetGIInstance: gi-sample
Table 1. Descriptions of the definitions in the YAML CR file
Attribute Description
schedule: "0 23 * * *" "0 23 * * *" is the schedule of the CronJob that begins everyday at 23:00 (Coordinated Universal Time time zone). You can customize the schedule based on your needs.

Note: If the backup runs longer than anticipated, the next task might be out of schedule.

insightsEnv The settings of your environment. They can be customized to suit your needs.
name: gi-custom-named-pvc The name of the PVC for your NFS.
size: 500Gi The minimum size of the PV for your NFS.
storageClassName

The storage class on your system. Select the rwx file storage type.

For more information, see Validated storage options.

volumeName: gi-sample-pv

The name of the PV for your NFS. Must match the class type storageClassName.

Based on the required frequency of full and incremental backups, define your cronjob by using the following examples:

Table 2. cronjob examples
Schedule name Aggressive Frequent Common Historical
Full backup schedule Once daily Once weekly (7 days) Once every 2 weeks (15 days) Once every 30 days
Incremental backup schedule 1 incremental 12 hours later in between 6 increments in between 14 increments in between 29 increments in between
CRON schedule "* 0-23/12 * * *" "* 23 * * *" "0 23 * * *" "* 23 * * *"
FREQUENCY_FULL_BACKUP_IN_DAYS 1 7 15 30
FREQUENCY_FULL_BACKUP_IN_INC_COUNT 1 6 14 29