Velero supports cron expressions to schedule backup tasks. Let's perform the following steps to schedule backups for our application:
- Create a scheduled daily backup:
$ velero schedule create myapp-daily --schedule="0 0 1 * * ?" --selector app=app2backup
If you are not familiar with cron expressions, you can create a different schedule using the Cron expression generator link in the See also section.
Note that the preceding schedule uses a cron expression. As an alternative, you can use a shorthand expression such as --schedule="@daily" or use an online cron maker to create a cron expression.
- Get a list of the currently scheduled backup jobs:
$ velero schedule get
NAME STATUS CREATED SCHEDULE BACKUP TTL LAST BACKUP SELECTOR
myapp-daily Enabled 2019-09-13 21:38:36 +0000 UTC 0 0 1 * * ? 720h0m0s 2m ago app=app2backup
- Confirm that a backup has been created by the scheduled backup job:
$ velero backup get
NAME STATUS CREATED EXPIRES STORAGE LOCATION SELECTOR
myapp-daily-20190913205123 Completed 2019-09-13 20:51:24 +0000 UTC 29d default app=app2backup
With that, you've learned how to create scheduled backups of an application using Velero.