Script to simplify detaching and later attaching vCluster resources
- vCluster you want to wipe the state of
- Already synced resources such as PVCs and PVs
- Downloaded this script "attach-detach.sh"
- Kubectl and jq installed
# Detach all pvc's of vCluster called "my-vcluster" in namespace "my-vcluster-namespace"
./attach-detach.sh detach pvc my-vcluster -n my-vcluster-namespace
# Make sure vCluster is stopped before you do this
kubectl delete pvc data-my-vcluster-0
Next start vCluster and restore the objects within the vCluster (statefulsets etc.)
# Attach all pvc's of vCluster called "my-vcluster" in namespace "my-vcluster-namespace"
./attach-detach.sh attach pvc my-vcluster -n my-vcluster-namespace