Three scripts for backing up and restoring ALL PVCs and StatefulSets as device-level snapshots:
backup.sh- Creates device snapshots (tar.gz) for all PVCs, stops pods during backuprestore.sh- Restores all device snapshots, stops pods during restoredelete-pvc.sh— Imitate lost of PVC and their GUIDsview.sh- Explore and inspect backup contents without extraction
Make sure you use synrc-control-plane and synrc cluster and chose kind control plane instead of built-in Docker Desktop control plane.
$ brew intall kind
$ ./kind.sh create synrc
$ ./kind.sh kind
./backup.shSteps:
- Export all Kubernetes manifests (StatefulSets, Deployments, PVCs, Services)
- Stop all pods (unmounts volumes for clean device snapshots)
- Create device image for each PVC via
tar -czf(filesystem snapshot) - Create backup metadata (PVC list, file counts, sizes)
- Restart all pods
- Output:
./priv/YYYYMMDD-HHMMSS/
Output Structure:
priv/20260706-004359/
├── BACKUP_INFO.txt # Metadata
├── manifests.yaml # All K8s resources
├── erp-infra@registry-data.tar.gz # Docker registry device snapshot (4KB)
├── erp-telemetry@grafana-data.tar.gz # Grafana data device snapshot (1MB)
└── erp-telemetry@prometheus-data.tar.gz # Prometheus data device snapshot (16KB)
./restore.sh ./priv/YYYYMMDD-HHMMSSSteps:
- Apply all Kubernetes manifests (recreate StatefulSets, Deployments, PVCs)
- Stop all pods (unmounts volumes)
- Clear existing PVC data
- Extract each device image via
tar -xzf - Restart all pods
- Verify PVCs bound and pods restarting
view.sh ./priv/YYYYMMDD-HHMMSSShows:
- Backup summary (backup date, type, format)
- List of PVCs and their sizes
- Device images with file counts
Subcommands:
view.sh ./priv/20260706-004359 list erp-telemetry@prometheus-data
view.sh ./priv/20260706-004359 tree erp-telemetry@grafana-data
view.sh ./priv/20260706-004359 extract erp-telemetry@grafana-data ./restored-grafana
view.sh ./priv/20260706-004359 cat erp-telemetry@prometheus-data queries.activeEach backup file is a tar.gz (gzip-compressed tar archive):
- Complete filesystem snapshot - all files, directories, permissions preserved
- Mountable - can extract to any filesystem
- Portable - works across systems
- Compressed - typically 30-50% of original size
- 5HT