Overview
Snapshots capture the complete state of a virtual cluster at a specific point in time, including:- All Kubernetes resources (Deployments, Services, ConfigMaps, etc.)
- Persistent data (optionally)
- Virtual cluster configuration
- Resource metadata and labels
- Backup and recovery: Protect against data loss or mistakes
- Cloning environments: Create exact copies for testing or development
- Migration: Move virtual clusters between hosts or infrastructure
- Compliance: Maintain point-in-time records for auditing
Snapshot Storage Backends
vCluster supports multiple storage backends for snapshots:OCI Registries
Store snapshots in container registries (Docker Hub, GHCR, etc.)
S3-Compatible Storage
Use AWS S3, MinIO, or other S3-compatible object storage
Container Filesystem
Store locally within the vCluster container
Custom Backends
Implement custom storage providers
Creating Snapshots
OCI Registry
Store snapshots in a container registry:S3-Compatible Storage
Store snapshots in S3 or S3-compatible storage:- AWS S3
- MinIO
- Custom S3
Configure AWS credentials in the vCluster:
Container Filesystem
Store snapshots locally within the vCluster container:Including Volumes
By default, snapshots include resource definitions but not persistent volume data. To include volume data:- VolumeSnapshot CRDs must be installed in the host cluster
- Storage class must support volume snapshots
- CSI driver must support snapshot functionality
Retrieving Snapshots
List Available Snapshots
Get information about existing snapshots:Download Snapshot
For OCI-stored snapshots, you can pull them like container images:Snapshot Workflow
Understand how snapshots are processed:Request Creation
When you run
vcluster snapshot create, a SnapshotRequest custom resource is created in the virtual cluster.Controller Processing
The vCluster snapshot controller detects the request and begins processing:
- Collects all resources from the virtual cluster
- Serializes them to YAML/JSON
- Optionally creates volume snapshots
- Packages everything into a tarball
Monitoring Snapshot Progress
Check the status of a snapshot operation:Snapshot Configuration
Configure snapshot behavior in yourvcluster.yaml:
Use Cases
Pre-Upgrade Backup
Pre-Upgrade Backup
Scenario: Create a safety snapshot before upgrading the virtual cluster.Implementation:
Environment Cloning
Environment Cloning
Scenario: Clone a production virtual cluster for testing.Implementation:
Disaster Recovery
Disaster Recovery
Scenario: Regular automated backups for disaster recovery.Implementation:Create a CronJob for automated snapshots:
Migration Between Clusters
Migration Between Clusters
Scenario: Move a virtual cluster from one host cluster to another.Implementation:
Troubleshooting
Snapshot Creation Times Out
Snapshot Creation Times Out
Symptoms: Snapshot command hangs or times out.Diagnosis:Check snapshot request status:Common Causes:
- Large virtual cluster with many resources
- Network issues connecting to storage backend
- Insufficient permissions to access storage
- Increase timeout: The snapshot is processed asynchronously, wait longer
- Check vCluster logs for errors:
- Verify storage backend credentials and connectivity
Cannot Access OCI Registry
Cannot Access OCI Registry
Error: Authentication or permission errors when creating OCI snapshots.Solution:
-
Create a registry credential secret:
-
Configure vCluster to use the secret:
-
Update the vCluster:
Volume Snapshots Not Included
Volume Snapshots Not Included
Symptoms: Persistent volume data is not in the snapshot.Verification:Check if VolumeSnapshot CRDs are installed:Check if storage class supports snapshots:Solutions:
-
Install VolumeSnapshot CRDs if missing:
- Verify CSI driver supports snapshots
- Use a snapshot-capable storage class
Best Practices
Regular Snapshots
Schedule automated snapshots for production virtual clusters using CronJobs.
Naming Convention
Use consistent, descriptive names with timestamps:
prod-vcluster-20240115-dailyTest Restores
Regularly test snapshot restoration to ensure they work when needed.
Retention Policy
Implement retention policies to automatically clean up old snapshots and control storage costs.
Document Snapshots
Maintain documentation of important snapshots, their purpose, and contents.
Secure Storage
Use encrypted storage backends and secure access credentials with Kubernetes secrets.
Next Steps
Backup & Restore
Learn how to restore from snapshots
Upgrading
Use snapshots as safety net during upgrades