Skip to main content

Backup and Restore

Learn how to backup and restore your KubeZero platform and applications.

Overview

KubeZero provides comprehensive backup and restore capabilities for both platform components and application data.

Backup Strategy

Implement a comprehensive backup strategy:

  • Platform Configuration: GitOps repository backups
  • Application Data: Persistent volume backups
  • Cluster State: etcd backups
  • Secrets: Encrypted secret backups

Automated Backups

Configure automated backup schedules:

# Backup configuration
backup:
enabled: true
schedule: "0 2 * * *" # Daily at 2 AM
retention: 30d
storage:
provider: s3
bucket: kubezero-backups
region: us-west-2

Platform Backup

GitOps Repository

Your platform configuration is version controlled:

# Backup GitOps repository
git clone https://github.com/your-org/kubezero-config.git
cd kubezero-config
git push --mirror https://backup-location/kubezero-config.git

Cluster State

Backup cluster state and configurations:

# Backup cluster resources
kubezero backup cluster --output cluster-backup.tar.gz

# Backup specific namespaces
kubezero backup namespace --namespace production

Application Data Backup

Persistent Volumes

Backup persistent volume data:

# Volume snapshot configuration
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
name: database-snapshot
spec:
source:
persistentVolumeClaimName: database-pvc

Database Backups

Configure database-specific backups:

# PostgreSQL backup example
apiVersion: batch/v1
kind: CronJob
metadata:
name: postgres-backup
spec:
schedule: "0 1 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: postgres-backup
image: postgres:14
command:
- pg_dump
- -h
- postgres-service
- -U
- postgres
- -d
- myapp

Disaster Recovery

Plan for disaster recovery scenarios:

Recovery Time Objective (RTO)

Target recovery times:

  • Platform restoration: < 2 hours
  • Application restoration: < 1 hour
  • Data restoration: < 30 minutes

Recovery Point Objective (RPO)

Acceptable data loss:

  • Configuration: 0 (GitOps)
  • Application data: < 1 hour
  • Logs: < 15 minutes

Restore Procedures

Platform Restore

Restore KubeZero platform:

# Restore from backup
kubezero restore cluster --input cluster-backup.tar.gz

# Verify platform health
kubezero status --all

Application Restore

Restore application data:

# Restore persistent volumes
kubectl apply -f volume-snapshots.yaml

# Restore application manifests
kubezero app deploy --from-backup app-backup.yaml

Testing Backups

Regularly test backup and restore procedures:

  1. Automated Testing: Run monthly restore tests
  2. Documentation: Keep procedures updated
  3. Training: Train team on restore procedures
  4. Validation: Verify data integrity

Backup Security

Secure your backups:

  • Encryption: Encrypt backups at rest and in transit
  • Access Control: Limit backup access
  • Audit: Log backup and restore activities
  • Retention: Follow data retention policies

Monitoring

Monitor backup operations:

  • Backup success/failure rates
  • Backup completion times
  • Storage utilization
  • Restore test results

For detailed backup configuration, see the backup reference.