Oreon IT Helm charts / velero-backup-schedules

velero-backup-schedules Helm chart

Version 0.1.1 · app 0.1.0 · MIT · source · Artifact Hub

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.

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

Key Default Description
veleroNamespace velero Where Velero runs
storageLocation.create false Create a BackupStorageLocation (provider, bucket, prefix, config, credential, default, accessMode, backupSyncPeriod)
volumeSnapshotLocation.create false Create a VolumeSnapshotLocation (provider, config, credential)
defaults.* see values.yaml Shared backup template: storageLocation, volumeSnapshotLocations, includedNamespaces, excludedNamespaces, includedResources, excludedResources, includeClusterResources, snapshotVolumes, defaultVolumesToFsBackup, labelSelector, csiSnapshotTimeout, hooks, paused, skipImmediately, maxAgeHours
schedules[] daily / weekly / monthly name, schedule (cron), ttl, plus any default override
restoreTest.enabled false Create the restore-test CronJob, ServiceAccount and RBAC
restoreTest.schedule / fromSchedule / namespace monthly / daily / required What to test
restoreTest.targetNamespace <namespace>-restore-test Scratch namespace
restoreTest.waitTimeout / minReadyPods / cleanup 30m / 1 / true Pass criteria
restoreTest.image bitnami/kubectl:1.31 Any image with bash and kubectl
monitoring.enabled false PrometheusRule (needs Velero metrics scraped and kube-state-metrics)
monitoring.labels {} Prometheus Operator ruleSelector labels

Notes

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.

Oreon IT

Maintained by Oreon IT

A London cloud, DevOps and SRE consultancy. If you want this chart rolled out and tuned for your platform, we can help.