Backup and restore

PVC Backups

PVC-backed backups are useful for labs, isolated clusters, and short-retention local copies. They are not a disaster-recovery substitute for off-cluster storage.

When to use PVC backups

Use PVC backups when:

  • You are testing backup and restore behavior locally.
  • Your cluster has a durable shared storage system.
  • You need a short-lived staging copy before exporting elsewhere.

Avoid PVC backups when:

  • Cluster loss must not lose backups.
  • The StorageClass is node-local.
  • The PVC cannot be mounted by backup, restore, and cleanup Jobs.

Operator-managed PVC

backup:
  profiles:
    - name: pvc-local
      storage:
        type: PVC
        pvc:
          storageClassName: fast-ssd
          size: 500Gi
          subPath: orders
      retentionPolicy:
        count: 7
        minKeep: 2
  schedules:
    - name: nightly
      profileName: pvc-local
      schedule: "0 6 * * *"
      timeZone: Etc/UTC
      concurrencyPolicy: Forbid

User-managed PVC

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: orders-backup-store
  namespace: orders
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: fast-ssd
  resources:
    requests:
      storage: 500Gi
---
apiVersion: shipstream.io/v1alpha1
kind: MysqlFailoverGroup
metadata:
  name: orders
  namespace: orders
spec:
  backup:
    profiles:
      - name: pvc-local
        storage:
          type: PVC
          pvc:
            claimName: orders-backup-store
            subPath: orders

On-demand backup

apiVersion: shipstream.io/v1alpha1
kind: MysqlBackup
metadata:
  name: orders-pvc-manual-20260427
  namespace: orders
spec:
  failoverGroupRef:
    name: orders
  profileName: pvc-local
  triggeredBy: manual
kubectl apply -f orders-pvc-backup.yaml
kubectl get mysqlbackup orders-pvc-manual-20260427 -n orders -o wide

Restore from PVC

apiVersion: shipstream.io/v1alpha1
kind: MysqlFailoverGroup
metadata:
  name: orders-restore
  namespace: orders
spec:
  initFromBackup:
    source:
      pvc:
        claimName: orders-backup-store
        subPath: orders/orders-pvc-manual-20260427

Include normal sites, credentials, and dns fields in the recovery failover group.

Sizing and retention

  • Size the PVC for peak dump size, compression ratio uncertainty, and retention overlap.
  • Keep at least two successful backups with retentionPolicy.minKeep.
  • Watch PVC usage; a full PVC usually causes backup Jobs to fail after doing expensive work.

Common failures

FailureCheck
PVC fullkubectl describe pvc orders-backup-store -n orders, Job logs
Wrong access modeWhether the backup Job can mount the claim on its scheduled node
Node-local storageRestore Job scheduled to a different node cannot see data
Reclaim policyDeleting a claim might delete the only backup copy
Copyright © 2026