backup-utils

by tobi-or-not

Helm chartv2.6.1App 1.4.9MITVerified publisher

Production-ready Helm chart for automated backups of PostgreSQL, MariaDB, MongoDB, etcd, Vault, Qdrant, and S3 buckets to S3-compatible storage with configurable schedules and retention policies.

About this chart

backup-utils

Production-ready Helm chart for automated backups of PostgreSQL, MariaDB, MongoDB, etcd, Vault, Qdrant, and S3 buckets to S3-compatible storage with configurable schedules and retention policies.

Overview

This Helm chart provides a production-ready solution for deploying automated backup jobs to S3-compatible storage. It supports multiple data sources and creates dedicated Kubernetes CronJobs with configurable schedules, retention policies, and resource limits.

Key Features

  • Automated Backups: Schedule backups using cron expressions
  • Multiple Data Sources: PostgreSQL, MariaDB, MongoDB, etcd, Vault, Qdrant, S3-to-S3
  • S3-Compatible Storage: Works with AWS S3, MinIO, Wasabi, etc.
  • Secure: Credentials stored in Kubernetes Secrets
  • Resource Efficient: Configurable CPU/memory limits per job
  • Retention Management: Automatic cleanup of old backups
  • Global Configuration: Share common settings across multiple backups

Supported Backup Types

TypeDescriptionRequired Environment Variables
postgresPostgreSQL database dumps using pg_dumpDB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASS
mariadbMariaDB/MySQL database dumps using mariadb-dumpDB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASS
mongodbMongoDB database archives using mongodumpDB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASS
etcdetcd cluster snapshots using etcdctlETCD_ENDPOINTS
vaultHashiCorp Vault snapshots (raft storage)VAULT_ADDR, VAULT_TOKEN
s3S3-to-S3 bucket synchronizationSOURCE_S3_ENDPOINT, SOURCE_S3_ACCESS_KEY, SOURCE_S3_SECRET_KEY, SOURCE_S3_BUCKET_NAME
qdrantQdrant vector database snapshotsQDRANT_URL, QDRANT_API_KEY, QDRANT_COLLECTION (optional)

Common Requirements: All types require S3 destination configuration: S3_ENDPOINT, S3_ACCESS_KEY, S3_SECRET_KEY, S3_BUCKET_NAME.

Installing the Chart

Prerequisites

  • Kubernetes 1.19+
  • Helm 3.0+
  • S3-compatible storage (AWS S3, MinIO, etc.)
  • Access credentials for data sources to backup

CLI

Using Traditional Helm Repository:

helm repo add tobi https://this-is-tobi.github.io/helm-charts
helm repo update
helm install <release_name> tobi/backup-utils

Using OCI Registry (Recommended):

helm install <release_name> oci://ghcr.io/this-is-tobi/charts/backup-utils --version 2.6.1

ArgoCD

Using Traditional Helm Repository:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: backup-utils
spec:
  project: default
  sources:
  - repoURL: https://this-is-tobi.github.io/helm-charts
    chart: backup-utils
    targetRevision: 2.6.1
    helm:
      releaseName: <release_name>
      values: |
        backups:
          postgres-prod:
            enabled: true
            type: postgres
            job:
              schedule: "0 2 * * *"
            secrets:
              DB_HOST: "postgres.default.svc"
              # ... other config
  destination:
    server: https://kubernetes.default.svc
    namespace: default

Using OCI Registry (Recommended):

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: backup-utils
spec:
  project: default
  sources:
  - repoURL: ghcr.io/this-is-tobi/charts
    chart: backup-utils
    targetRevision: 2.6.1
    helm:
      releaseName: <release_name>
      values: |
        backups:
          postgres-prod:
            enabled: true
            type: postgres
            job:
              schedule: "0 2 * * *"
            secrets:
              DB_HOST: "postgres.default.svc"
              # ... other config
  destination:
    server: https://kubernetes.default.svc
    namespace: default

Helm Dependency

Using Traditional Helm Repository:

# Chart.yaml
dependencies:
- name: backup-utils
  version: 2.6.1
  repository: https://this-is-tobi.github.io/helm-charts
  condition: backup-utils.enabled

Using OCI Registry (Recommended):

# Chart.yaml
dependencies:
- name: backup-utils
  version: 2.6.1
  repository: oci://ghcr.io/this-is-tobi/charts
  condition: backup-utils.enabled

values.yaml:

backup-utils:
  enabled: true
  backups:
    myBackup:
      enabled: true
      type: postgres
      # ... configuration

Configuration

Configuration Structure

The chart uses a map-based configuration where each key under backups represents one backup job:

  • Map Keys: Each key becomes a backup job identifier (converted to kebab-case)
  • Kubernetes Resources: Each backup creates 1 CronJob + 1 ConfigMap + 1 Secret
  • Independent Config: Each backup has its own schedule, type, env vars, and resources
  • Global Values: Use global.env and global.secrets for shared configuration

Example Structure:

global:
  env:
    S3_PATH_STYLE: "true"
    RETENTION: "30d"
  secrets:
    # Shared S3 credentials
    S3_ENDPOINT: "https://s3.amazonaws.com"
    S3_ACCESS_KEY: "AKIAIOSFODNN7EXAMPLE"
    S3_SECRET_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
    S3_BUCKET_NAME: "my-backups"

backups:
  postgresProduction:    # Creates: <release>-postgres-production
    enabled: true
    type: postgres
    job:
      schedule: "0 2 * * *"
    secrets:
      DB_HOST: "postgres"
      DB_PORT: "5432"
      DB_NAME: "myapp"
      DB_USER: "backup_user"
      DB_PASS: "password"
      S3_BUCKET_PREFIX: "postgres/prod/"
 
  vaultBackup:          # Creates: <release>-vault-backup
    enabled: true
    type: vault
    job:
      schedule: "0 3 * * *"
    secrets:
      VAULT_ADDR: "https://vault:8200"
      VAULT_TOKEN: "hvs.xxx"
      S3_BUCKET_PREFIX: "vault/"

Usage Examples

Example 1: Basic PostgreSQL Backup

Daily PostgreSQL backup at 2 AM with 30-day retention:

backups:
  postgresProduction:
    enabled: true
    type: postgres
    job:
      schedule: "0 2 * * *"  # Daily at 2 AM UTC
      timeZone: "Europe/Paris"
    env:
      RETENTION: "30d"
    secrets:
      # PostgreSQL connection
      DB_HOST: "postgres.default.svc.cluster.local"
      DB_PORT: "5432"
      DB_NAME: "production"
      DB_USER: "backup_user"
      DB_PASS: "secure_password"
      # S3 destination
      S3_ENDPOINT: "https://s3.amazonaws.com"
      S3_ACCESS_KEY: "AKIAIOSFODNN7EXAMPLE"
      S3_SECRET_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
      S3_BUCKET_NAME: "company-backups"
      S3_BUCKET_PREFIX: "postgres/production/"
    resources:
      requests:
        memory: "256Mi"
        cpu: "200m"
      limits:
        memory: "1Gi"
        cpu: "500m"

Example 2: MariaDB/MySQL Backup

Daily MariaDB backup at 2:30 AM with custom dump arguments:

backups:
  mariadbProduction:
    enabled: true
    type: mariadb
    job:
      schedule: "30 2 * * *"  # Daily at 2:30 AM UTC
      timeZone: "Europe/Paris"
    env:
      RETENTION: "30d"
      DB_DUMP_ARGS: "--single-transaction --routines --triggers --events"  # Optional custom args
    secrets:
      # MariaDB/MySQL connection
      DB_HOST: "mariadb.default.svc.cluster.local"
      DB_PORT: "3306"
      DB_NAME: "production"
      DB_USER: "backup_user"
      DB_PASS: "secure_password"
      # S3 destination
      S3_ENDPOINT: "https://s3.amazonaws.com"
      S3_ACCESS_KEY: "AKIAIOSFODNN7EXAMPLE"
      S3_SECRET_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
      S3_BUCKET_NAME: "company-backups"
      S3_BUCKET_PREFIX: "mariadb/production/"
    resources:
      requests:
        memory: "256Mi"
        cpu: "200m"
      limits:
        memory: "1Gi"
        cpu: "500m"

Example 3: MongoDB Backup

Daily MongoDB backup at 3 AM with authentication database:

backups:
  mongodbProduction:
    enabled: true
    type: mongodb
    job:
      schedule: "0 3 * * *"  # Daily at 3 AM UTC
      timeZone: "Europe/Paris"
    env:
      RETENTION: "30d"
    secrets:
      # MongoDB connection
      DB_HOST: "mongodb.default.svc.cluster.local"
      DB_PORT: "27017"
      DB_NAME: "production"
      DB_USER: "backup_user"
      DB_PASS: "secure_password"
      DB_AUTH_DB: "admin"  # Optional authentication database (default: admin)
      # S3 destination
      S3_ENDPOINT: "https://s3.amazonaws.com"
      S3_ACCESS_KEY: "AKIAIOSFODNN7EXAMPLE"
      S3_SECRET_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
      S3_BUCKET_NAME: "company-backups"
      S3_BUCKET_PREFIX: "mongodb/production/"
    resources:
      requests:
        memory: "256Mi"
        cpu: "200m"
      limits:
        memory: "1Gi"
        cpu: "500m"

Example 4: etcd Snapshot Backup

Hourly etcd snapshots with TLS:

backups:
  etcdSnapshots:
    enabled: true
    type: etcd
    job:
      schedule: "0 * * * *"  # Every hour
      successfulJobsHistoryLimit: 5
    env:
      RETENTION: "7d"
    secrets:
      ETCD_ENDPOINTS: "https://etcd.kube-system.svc.cluster.local:2379"
      ETCD_CACERT: "/etc/ssl/etcd/ca.crt"  # Optional TLS CA cert path
      ETCD_CERT: "/etc/ssl/etcd/client.crt"  # Optional TLS client cert path
      ETCD_KEY: "/etc/ssl/etcd/client.key"  # Optional TLS client key path
      # S3 destination
      S3_ENDPOINT: "https://minio.storage.svc.cluster.local:9000"
      S3_ACCESS_KEY: "minio-admin"
      S3_SECRET_KEY: "minio-secret"
      S3_BUCKET_NAME: "etcd-backups"
      S3_BUCKET_PREFIX: "snapshots/"

Example 5: Vault Snapshot Backup

Hourly Vault snapshots with 7-day retention:

backups:
  vaultSnapshots:
    enabled: true
    type: vault
    job:
      schedule: "0 * * * *"  # Every hour
      successfulJobsHistoryLimit: 5
    env:
      RETENTION: "7d"
    secrets:
      VAULT_ADDR: "https://vault.default.svc.cluster.local:8200"
      VAULT_TOKEN: "hvs.CAESIxxxxxxxxxxxxxx"
      VAULT_EXTRA_ARGS: "-namespace=admin"
      # S3 destination
      S3_ENDPOINT: "https://minio.storage.svc.cluster.local:9000"
      S3_ACCESS_KEY: "minio-admin"
      S3_SECRET_KEY: "minio-secret"
      S3_BUCKET_NAME: "vault-backups"
      S3_BUCKET_PREFIX: "snapshots/"

Example 6: Qdrant Vector Database Backup

Backup specific Qdrant collection daily:

backups:
  qdrantVectors:
    enabled: true
    type: qdrant
    job:
      schedule: "0 3 * * *"  # Daily at 3 AM
    env:
      RETENTION: "14d"
    secrets:
      QDRANT_URL: "https://qdrant.default.svc.cluster.local:6333"
      QDRANT_API_KEY: "your-api-key-here"
      QDRANT_COLLECTION: "embeddings"  # Specific collection or empty for all
      # S3 destination
      S3_ENDPOINT: "https://s3.amazonaws.com"
      S3_ACCESS_KEY: "AKIAIOSFODNN7EXAMPLE"
      S3_SECRET_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
      S3_BUCKET_NAME: "ai-backups"
      S3_BUCKET_PREFIX: "qdrant/vectors/"

Example 7: S3-to-S3 Bucket Sync

Sync data from one S3 bucket to another (cross-region backup):

backups:
  s3CrossRegion:
    enabled: true
    type: s3
    job:
      schedule: "0 4 * * *"  # Daily at 4 AM
    env:
      RETENTION: "90d"
      RCLONE_EXTRA_ARGS: "--transfers=8 --checkers=16"
    secrets:
      # Source S3 bucket
      SOURCE_S3_ENDPOINT: "https://s3.us-west-2.amazonaws.com"
      SOURCE_S3_ACCESS_KEY: "AKIAIOSFODNN7SOURCE"
      SOURCE_S3_SECRET_KEY: "source-secret-key"
      SOURCE_S3_BUCKET_NAME: "production-data"
      SOURCE_S3_BUCKET_PREFIX: "uploads/"
      # Destination S3 bucket (different region for DR)
      S3_ENDPOINT: "https://s3.eu-central-1.amazonaws.com"
      S3_ACCESS_KEY: "AKIAIOSFODNN7DEST"
      S3_SECRET_KEY: "destination-secret-key"
      S3_BUCKET_NAME: "dr-backups"
      S3_BUCKET_PREFIX: "production-uploads/"

Example 8: Multiple Backups with Global Configuration

Share S3 credentials across multiple backup jobs:

# Global configuration (shared by all backups)
global:
  env:
    S3_PATH_STYLE: "true"
    RETENTION: "30d"
  secrets:
    # Common S3 destination
    S3_ENDPOINT: "https://s3.amazonaws.com"
    S3_ACCESS_KEY: "AKIAIOSFODNN7EXAMPLE"
    S3_SECRET_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
    S3_BUCKET_NAME: "company-backups"

# Individual backup jobs
backups:
  postgresProduction:
    enabled: true
    type: postgres
    job:
      schedule: "0 2 * * *"
    secrets:
      DB_HOST: "postgres.prod.svc"
      DB_PORT: "5432"
      DB_NAME: "production"
      DB_USER: "backup_user"
      DB_PASS: "pg-password"
      S3_BUCKET_PREFIX: "postgres/production/"
 
  postgresStaging:
    enabled: true
    type: postgres
    job:
      schedule: "0 3 * * *"
    env:
      RETENTION: "7d"  # Override global retention
    secrets:
      DB_HOST: "postgres.staging.svc"
      DB_PORT: "5432"
      DB_NAME: "staging"
      DB_USER: "backup_user"
      DB_PASS: "pg-password"
      S3_BUCKET_PREFIX: "postgres/staging/"
 
  vaultCluster:
    enabled: true
    type: vault
    job:
      schedule: "0 */6 * * *"  # Every 6 hours
    secrets:
      VAULT_ADDR: "https://vault:8200"
      VAULT_TOKEN: "hvs.xxx"
      S3_BUCKET_PREFIX: "vault/snapshots/"
 
  qdrantEmbeddings:
    enabled: true
    type: qdrant
    job:
      schedule: "0 4 * * *"
    secrets:
      QDRANT_URL: "https://qdrant:6333"
      QDRANT_API_KEY: "api-key"
      S3_BUCKET_PREFIX: "qdrant/"

Advanced Features

Custom Resource Limits

Adjust CPU and memory based on backup size:

backups:
  largeDatabase:
    enabled: true
    type: postgres
    resources:
      requests:
        memory: "512Mi"
        cpu: "500m"
      limits:
        memory: "2Gi"
        cpu: "1000m"

Timezone Support

Run back

Deploy backup-utils with OpenTenant

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