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.
- Connect to the cluster node 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 # <------ name of the backup labels: feature: "dashboard" # <------ [Optional] label to identify the backup by feature spec: backup: retentionPolicy: numberOfDaysToKeep: 45 # <------ number of days to keep the backup components: # <------ defination of the backup postgres: enabled: true dbs: - "grafana" - "keycloak" elastic: enabled: true indices: "ELASTICSEARCH_EVENTS,ELASTICSEARCH_CONFIG,ELASTICSEARCH_KAFKA_MAPPER" timeOut: "30m" collectors: enabled: true secrets: enabled: true nameList: - name: "collector.tcops-postgres.credentials" namespace: "default" zookeeper: enabled: true rootPaths: - "/vmware/vsa/gateway" - "/vmware/vsa/smarts" - "/omega/enrichment" configmaps: enabled: true nameList: - name: "product-info" namespace: "default" backupSchedule: "0 23 * * *" # <------ schedule of the backup successfulBackupsToKeep: 10 # <------ number of successful backups to keep failedBackupsToKeep: 5 # <------ number of failed backups to keep
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. 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 successfulBackupsToKeep failedBackupsToKeep The maximum number of days to retain failed backups. Enter an integer greater than 0. This is a mandatory field.
- To create the scheduled backup, run the following command:
kubectl apply -f <configuration YAML file>The output is:
scheduledbackup.tcx.vmware.com/scheduledbackup-name createdNote: 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.