velero-backup-schedules

by Oreon Information Technology

Helm chartv0.1.1App 0.1.0MITVerified publisher

A backup policy for Velero as values - daily, weekly and monthly Schedules with retention, optional BackupStorageLocation and VolumeSnapshotLocation, a scheduled restore test that restores the latest backup into a scratch namespace and checks the pods come up, and alerts for failed, partial or stale backups. Velero itself is not included.

About this chart

velero-backup-schedules

A backup policy for Velero, as values. Velero (the vmware-tanzu/velero chart) does the backing up; this chart says what, when, for how long, proves the backups restore, and alerts when they stop.

  • Schedules: daily (7 days), weekly (30 days), monthly (90 days) by default; any number, each overriding the shared defaults (namespaces, resources, volume snapshots or file-system backup, label selectors, CSI timeouts, hooks).
  • Locations (optional): a BackupStorageLocation and VolumeSnapshotLocation for AWS, GCP or Azure.
  • Restore test: a CronJob that restores the latest backup of a schedule into a scratch namespace, waits for the pods to become Ready, reports pass or fail, and cleans up. Monthly by default; weekly for anything that matters.
  • Alerts (optional): backup failed, partially failed, too old per schedule, never ran, restore test failed.

Install

helm repo add oreonit https://oreondev.github.io/helm-charts
helm install backups oreonit/velero-backup-schedules -n velero -f backups.yaml

backups.yaml:

defaults:
  excludedNamespaces: [kube-system, kube-public, kube-node-lease, velero, monitoring]

schedules:
  - name: daily
    schedule: "0 2 * * *"
    ttl: 168h
    maxAgeHours: 26
  - name: weekly
    schedule: "0 3 * * 0"
    ttl: 720h
    maxAgeHours: 192
    includeClusterResources: true
  - name: payments-hourly
    schedule: "0 * * * *"
    ttl: 48h
    maxAgeHours: 2
    includedNamespaces: [payments]
    defaultVolumesToFsBackup: true

restoreTest:
  enabled: true
  schedule: "0 6 * * 1"        # Mondays 06:00
  fromSchedule: daily
  namespace: payments
  minReadyPods: 2

monitoring:
  enabled: true
  labels:
    release: kube-prometheus-stack

Run the restore test by hand the first time:

kubectl -n velero create job --from=cronjob/backups-velero-backup-schedules-restore-test restore-test-manual
kubectl -n velero logs -f job/restore-test-manual

How the restore test works

  1. Finds the newest Completed backup of restoreTest.fromSchedule.
  2. Creates a Velero Restore of restoreTest.namespace mapped into <namespace>-restore-test (volumes included).
  3. Waits for the restore to complete, then for pods in the scratch namespace to become Ready (restoreTest.waitTimeout).
  4. Passes if at least restoreTest.minReadyPods pods are Ready; fails otherwise. Deletes the scratch namespace and the Restore object afterwards (restoreTest.cleanup).

A failed job is a failed test. With monitoring.enabled the VeleroRestoreTestFailed alert fires; without it, kube-prometheus-stack's KubeJobFailed still does.

Things the test cannot see: applications that come up Ready but have lost data, Secrets managed by an external operator, DNS or ingress names that differ in the scratch namespace. Read the restored app's logs the first few times.

Values

KeyDefaultDescription
veleroNamespaceveleroWhere Velero runs
storageLocation.createfalseCreate a BackupStorageLocation (provider, bucket, prefix, config, credential, default, accessMode, backupSyncPeriod)
volumeSnapshotLocation.createfalseCreate a VolumeSnapshotLocation (provider, config, credential)
defaults.*see values.yamlShared backup template: storageLocation, volumeSnapshotLocations, includedNamespaces, excludedNamespaces, includedResources, excludedResources, includeClusterResources, snapshotVolumes, defaultVolumesToFsBackup, labelSelector, csiSnapshotTimeout, hooks, paused, skipImmediately, maxAgeHours
schedules[]daily / weekly / monthlyname, schedule (cron), ttl, plus any default override
restoreTest.enabledfalseCreate the restore-test CronJob, ServiceAccount and RBAC
restoreTest.schedule / fromSchedule / namespacemonthly / daily / requiredWhat to test
restoreTest.targetNamespace<namespace>-restore-testScratch namespace
restoreTest.waitTimeout / minReadyPods / cleanup30m / 1 / truePass criteria
restoreTest.imagebitnami/kubectl:1.31Any image with bash and kubectl
monitoring.enabledfalsePrometheusRule (needs Velero metrics scraped and kube-state-metrics)
monitoring.labels{}Prometheus Operator ruleSelector labels

Notes

  • Velero's own install is a prerequisite: the server, the cloud plugin, node agent if you use file-system backup, and a credentials Secret. kubectl -n velero get bsl must say Available before the first schedule fires.
  • Retention is ttl on the backup; Velero deletes expired backups from the bucket. Match it to your recovery point objective and to what the bucket lifecycle rules do.
  • includeClusterResources: true on one schedule (weekly here) captures CRDs, ClusterRoles and StorageClasses for a full-cluster rebuild; leave it unset on the others.
  • The restore-test ClusterRole can delete namespaces. It is bound to one ServiceAccount in the Velero namespace; keep that namespace locked down.

The plan this slots into is the disaster recovery plan template; if you would like the whole plan written and tested, see our disaster recovery planning.

Licence

MIT. Maintained by Oreon IT.

Deploy velero-backup-schedules with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has velero-backup-schedules on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartvelero-backup-schedules is pinned at v0.1.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply