backup-operator

by janip81

Helm chartv0.4.2App 0.4.0Verified publisher

Kubernetes operator that backs up PersistentVolume data as versioned, encrypted restic snapshots, with plugins that choose what to keep

About this chart

backup-operator

Kubernetes operator that backs up PersistentVolume data as versioned, encrypted restic snapshots, with plugins that choose what to keep

Homepage: https://github.com/janip81/helm-charts/tree/main/charts/backup-operator

Maintainers

NameEmailUrl
janip81https://github.com/janip81

Source Code

Overview

Installs backup-operator: CRDs (BackupSchedule, BackupRequest, Backup), a least-privilege ClusterRole, the controller, and optionally a ServiceMonitor, alert rules and a Grafana dashboard.

Each run snapshots a PersistentVolume, mounts a read-only copy in a short-lived worker Job, and a plugin (files, archives, sqlite or custom) decides what is stored as a versioned, encrypted restic snapshot in S3, a REST server or over SFTP.

Adding this helm repository

helm repo add janip81 https://janip81.github.io/helm-charts/
helm install backup-operator janip81/backup-operator -n backup-operator --create-namespace

Notes

  • CRDs are rendered from templates (crds.enabled), so helm upgrade and Argo CD's Helm plugins upgrade them too. They carry helm.sh/resource-policy: keep (crds.keep): an uninstall never deletes them, because that would delete every Backup record and schedule.
  • One replica only (replicaCount 0 or 1). Use 0 to pause the operator.
  • Private images: set imagePullSecrets for the controller and worker.imagePullSecret to a pull secret that exists in every namespace with backups.
  • Worker pods run as root with only DAC_READ_SEARCH by default, which needs Pod Security "privileged" in the app's namespace (or run non-root per schedule, see the operator README).
  • Upgrading from v0.3: docs/upgrade-0.4.md.
  • CRDs, rules and dashboard are copied from the operator repo with hack/sync.sh <ref>.

Values

KeyTypeDefaultDescription
affinityobject{}
configobject{}Controller settings as environment variables, e.g. MAX_CONCURRENT_RUNS, MAX_SNAPSHOTS_PER_PVC, DEFAULT_MAX_ATTEMPTS, DEFAULT_STORAGE_CLASS, JOB_TIMEOUT_SECONDS. Unset means the operator default; see the backup-operator README.
crds.enabledbooltrueInstall and upgrade the CRDs with the chart (rendered from templates, so helm upgrade and Argo CD's Helm plugins update them too)
crds.keepbooltrueKeep the CRDs on uninstall; deleting them would delete every Backup record and schedule
dashboard.annotationsobject{}
dashboard.enabledboolfalseCreate the Grafana dashboard as a ConfigMap for the Grafana sidecar
dashboard.labels.grafana_dashboardstring"1"
dashboard.namespacestring""Namespace for the dashboard ConfigMap (defaults to the release namespace)
image.pullPolicystring"IfNotPresent"
image.repositorystring"ghcr.io/janip81/backup-operator-controller"Controller image
image.tagstring""Image tag; defaults to the chart's appVersion. Pin a release or sha-<commit> tag.
imagePullSecretslist[]Pull secrets for the controller pod (in the release namespace)
nodeSelectorobject{}
podAnnotationsobject{}
prometheusRule.enabledboolfalseCreate the alert rules (stale or failed backups, runaway snapshots/requests, operator health)
prometheusRule.labelsobject{}Labels your Prometheus selects rules by
replicaCountint1Number of controller replicas: 1, or 0 to pause the operator. Never more than one: admission control is in-process.
resources.limits.memorystring"256Mi"
resources.requests.cpustring"50m"
resources.requests.memorystring"128Mi"
serviceMonitor.clusterLabelstring""If set, add a k8s_cluster label with this value to every scraped series
serviceMonitor.enabledboolfalseCreate a ServiceMonitor (Prometheus Operator)
serviceMonitor.intervalstring"30s"
serviceMonitor.labelsobject{}Labels your Prometheus selects ServiceMonitors by
tolerationslist[]
worker.image.repositorystring"ghcr.io/janip81/backup-operator-worker"Worker image (restic and the plugins), run as a Job in the backed-up app's namespace
worker.image.tagstring""Worker image tag; defaults to the chart's appVersion
worker.imagePullSecretstring""Name of a pull secret that must exist in every namespace with backups (worker Jobs use it)

Deploy backup-operator with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has backup-operator 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 chartbackup-operator is pinned at v0.4.2 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