Scheduling a backup by using the CLI

Schedule a backup of the orchestration data or application logging data to run at regular intervals. You can schedule backups from the OpenShift® CLI. You specify the schedule in the cron format.

Procedure

  1. Create a YAML file with content similar to the following sample:
    apiVersion: tnc.ibm.com/v1beta1
    kind: OrchestrationBackup
    metadata:
      name: cp4na-scheduledbackup-sample
    spec:
      schedule:
        schedule: "0 0 23 * * *"
        immediate: true
        suspend: false
    Note: To back up application log data, set the value of spec.type to Opensearch, as shown in this example:
    apiVersion: tnc.ibm.com/v1beta1
    kind: OrchestrationBackup
    metadata:
        name: cp4na-scheduledbackup-sample
    spec:
        type: Opensearch
        schedule:
          schedule: "0 0 23 * * *"
          immediate: true
          suspend: false
    If you do not configure the spec.type setting, or if you set its value to Backup, orchestration data is backed up.
    Restriction: In active-active configurations of IBM® Cloud Pak for Network Automation, orchestration data is replicated across clusters, but application logging data is not. As a result, each application logging data backup contains only the logging data from the cluster where you created the backup.

    To back up application logging data for all clusters in your active-active configuration, create a backup on each cluster.

  2. Specify the details of the schedule in the spec.schedule section, as described in the following table:
    Key Description
    schedule Use the cron format to specify the schedule. The first field specifies seconds. For example, the cron schedule "0 0 23 * * *" from the sample in step 1 schedules a backup to run every day at 11:00 PM.

    For more information about schedules in cron format, see Cron format schedules.

    immediate To run a backup immediately after the schedule is created, set to true.
    suspend To pause the scheduled backups, set to true.
  3. Run the following command to apply the YAML file:
    oc apply -f <filename>
  4. Run the following command to view the backup you created:
    oc get OrchestrationBackup

Results

Run the following command to view a list of the backups that are completed or are running:
oc get OrchestrationBackup

Use the output of the command to check whether backups are being created according to the schedule.

This command also shows the status of the backup. If the phase value of a backup is completed, the data was saved to S3 storage successfully.