Skip to main content

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

--namespace
string
required
The target namespace for the restored vCluster.
--snapshot
string
required
The name of the snapshot to restore from.
--backend
string
required
Storage backend where the snapshot is stored.
--restore-volumes
boolean
Restore persistent volume data.
--driver
string
default:"helm"
The driver to use.

Restore Process

1

Validate Snapshot

Verify the snapshot exists and is accessible.
2

Create vCluster

Deploy a new vCluster instance.
3

Restore etcd Data

Load the control plane state from the snapshot.
4

Restore Volumes (Optional)

If --restore-volumes is set, restore PVC data.
5

Reconcile

Sync resources between virtual and host cluster.

Complete Example

disaster-recovery.sh
#!/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

Build docs developers (and LLMs) love