Automatic Backup with Velero
Context
K8SaaS provides a builtin backup mechanism to manage the availability of the applications. As part of the Business Continuity Plan of the k8saas service, the team in charge of the Operation of the service is able to restore any cluster at any time.
All the kubernetes objects (containers, service accounts, deployment etc...) as well as the storage are backup by default every 2 hours and kept 240h.
Velero backups your storage using incremental snapshot provided by azure. This feature help to reduce your k8saas bill.
Use case
- Disaster recovery plan
What to do ?
Nothing ! The service is enabled by default.
HOWTO
Manage backup and restoration by your own ?
First, the default mechanism is mandatory due to the commitment of the k8saas to provide a SLA on the availability of the application that runs on the service. Second, the customer can add a configuration to add a custom cronjob based on his needs.
To do so, please go to the TrustNest K8SaaS Service catalog to get a dedicated backup service account.
Once done, you can run the following HOWTO commands
Get the backup list ?
prerequisites:
$ brew install velero
Then:
$ velero backup get -n velero
NAME STATUS ERRORS WARNINGS CREATED EXPIRES STORAGE LOCATION SELECTOR
velero-auto-backup-20210707140042 Completed 0 0 2021-07-07 10:00:42 -0400 EDT 9d default <none>
velero-auto-backup-20210707120042 Completed 0 0 2021-07-07 08:00:42 -0400 EDT 9d default <none>
Do a one shot backup ?
# Full backup restoration will generated warnings when restored on an existing cluster because of already existing components
velero backup create cluster-backup-`date '+%Y%m%d-%H%M%S'`
# Do backup on a specific namespaces only
velero backup create --include-namespaces dev,qa,staging cluster-backup-`date '+%Y%m%d-%H%M%S'`
Schedule an additional backup ?
velero schedule create cluster-backup --schedule "0 */2 * * *"
# Do backup on a specific namespaces only
velero schedule create --include-namespaces dev,qa,demo,staging cluster-backup --schedule "0 */2 * * *"
Monitor your backups
K8SAAS provides a dashboard "K8SAAS / Velero" in the observability stack
Here is a screenshot of the dashboard: