Synopsis
Restore a virtual cluster from a previously created snapshot.
vcluster restore VCLUSTER_NAME [flags]
Description
The restore command recreates a virtual cluster from a snapshot, including all resources and data.
Examples
# Restore from specific snapshot
vcluster restore my-vcluster -n team-x \
--snapshot my-snapshot \
--backend oci://myregistry.io/snapshots
# Restore to different namespace
vcluster restore my-vcluster -n new-namespace \
--snapshot backup-20240305 \
--backend oci://myregistry.io/snapshots
# Restore with volumes
vcluster restore my-vcluster -n team-x \
--snapshot backup-20240305 \
--backend oci://myregistry.io/snapshots \
--restore-volumes
Flags
The target namespace for the restored vCluster.
The name of the snapshot to restore from.
Storage backend where the snapshot is stored.
Restore persistent volume data.
Restore Process
Validate Snapshot
Verify the snapshot exists and is accessible.
Create vCluster
Deploy a new vCluster instance.
Restore etcd Data
Load the control plane state from the snapshot.
Restore Volumes (Optional)
If --restore-volumes is set, restore PVC data.
Reconcile
Sync resources between virtual and host cluster.
Complete Example
#!/bin/bash
VCLUSTER="prod-vcluster"
OLD_NAMESPACE="production"
NEW_NAMESPACE="production-restore"
BACKEND="oci://myregistry.io/backups"
# List available snapshots
echo "Available snapshots:"
vcluster snapshot get $VCLUSTER -n $OLD_NAMESPACE --backend $BACKEND
# Restore from latest snapshot
LATEST_SNAPSHOT=$(vcluster snapshot get $VCLUSTER -n $OLD_NAMESPACE --backend $BACKEND --output json | jq -r '.[0].Name')
echo "Restoring from $LATEST_SNAPSHOT"
vcluster restore $VCLUSTER -n $NEW_NAMESPACE \
--snapshot $LATEST_SNAPSHOT \
--backend $BACKEND \
--restore-volumes
# Connect and verify
vcluster connect $VCLUSTER -n $NEW_NAMESPACE
kubectl get all --all-namespaces
See Also