You can configure your deployment to be automatically backed up on a regular schedule. By default, the cluster have a scheduled backup which is configured to run at 23 hours every day.
Procedure
- Connect to the deployer VM and execute below command:
export KUBECONFIG=/root/.kube/<KubeConfig File>
- In a text editor, create the configuration file for the scheduled backup in YAML format.
The example file is located in the tcx-deployer/examples/backup-and-restore/scheduledback.yaml.example.
Use the following template for the component backup:apiVersion: tcx.vmware.com/v1alpha1 kind: ScheduledBackup metadata: name: scheduledbackup-name spec: backup: acrossClusters: enabled: true retentionPolicy: numberOfDaysToKeep: 45 components: postgres: enabled: true timeout: 10m dbs: - "analyticsservice" - "alarmservice" - "collector" - "grafana" - "keycloak" elastic: enabled: true timeout: 30m removeAndAddRepository: false cleanUpIndices: "" indices: "ELASTICSEARCH_EVENTS,ELASTICSEARCH_CONFIG,ELASTICSEARCH_KAFKA_MAPPER" collectors: enabled: true timeout: 10m secrets: enabled: true timeout: 10m nameList: - name: "collector.tcops-postgres.credentials" namespace: "default" zookeeper: enabled: true timeout: 10m rootPaths: - "/vmware/vsa/gateway" - "/vmware/vsa/smarts" - "/omega/enrichment" - "/omega/kpi" #- "/vmware/vsa/ncm" configmaps: enabled: true timeout: 10m nameList: - name: "product-info" namespace: "default" backupSchedule: "0 23 * * *" successfulBackupsToKeep: 10 failedBackupsToKeep: 5
Uncomment
#- "/vmware/vsa/ncm"
to take backup of NCM reports.Option Description name Enter a prefix for the backup files. The alphanumeric string can include special characters (-) and (_). This is a mandatory field. feature Enter the feature name to identify the backup by feature. This is an optional field. acrossClusters Set across clusters to true in order to make backups available in another cluster. backupSchedule Specify the backup schedule as a five-field cron expression. For example, enter "5 0 * * *" to back up every day at 00:05. This is a mandatory field. numberOfDaysToKeep The maximum number of days to retain the backup. Enter an integer greater than 0. This is a mandatory field. successfulBackupsToKeep The maximum number of days to retain successful backups. Enter an integer greater than 0. This is a mandatory field. Note: successfulBackupsToKeep takes precedence over the numberOfDaysToKeep field, If the number of backups exceeds the limit, the oldest backup is removed based on the value set in successfulBackupsToKeepfailedBackupsToKeep The maximum number of days to retain failed backups. Enter an integer greater than 0. This is a mandatory field. The backupSchedule in the YAML configuration provided with ScheduledBackup is
"0 23 * * *"
. The ScheduledBackup gets triggered based on the Kubernetes node time zone, and the default Kubernetes node time zone is UTC zone unless you want to change it. Therefore, it is recommended that you create backups based on the UTC zone (Kubernetes node time zone) rather than the local time zone.The backupSchedule uses a standard Cron expression to define the backup frequency. The fields are as follows:- Field 1: Minute (0 - 59)
- Field 2: Hour (0 - 23)
- Field 3: Day of the Month (1 - 31)
- Field 4: Month (1 - 12)
- Field 5: Day of the Week (0 - 6) (Sunday to Saturday)
In the backupSchedule:
"0 23 * * "
, the first field is set to 0, which means the backup can start at the beginning of the hour. The second field is set to 23, which means the backup can start at 11 PM UTC. The third, fourth, and fifth fields are set to "", which means the backup can run every day of every month of every week. - To create the scheduled backup, run the following command:
kubectl apply -f <configuration YAML file>
The output is:scheduledbackup.tcx.vmware.com/scheduledbackup-name created
Note: Once the ScheduledBackup is created, it cannot be changed. If you want to update the ScheduledBackup, delete the old ScheduledBackup and create a new one. Default scheduled backup is not available for the demo footprint.