Restoring onto new kubernetes cluster from velero backup
Here I am documenting my process and issues I am encountering while "cold" restoring a whole cluster from velero backup.
I have adapted the script from https://docs.stackspin.net/en/v2/system_administration/maintenance.html#restore:
backup='231028.13'; app=dashboard
namespace=stackspin-apps
restore=${backup}-$app-$(date +%s)
if test $app = dashboard
then kust=single-sign-on
hr="$kust-database"
namespace=stackspin
else hr="$namespace $app"
fi
flux suspend kustomization ${kust:-$app}
flux suspend helmrelease -n $namespace $hr
kubectl delete all -n $namespace -l stackspin.net/backupSet=$app
kubectl delete secret -n $namespace -l stackspin.net/backupSet=$app
kubectl delete configmap -n $namespace -l stackspin.net/backupSet=$app
kubectl delete pvc -n $namespace -l stackspin.net/backupSet=$app
velero restore create $restore --from-backup=$backup -l stackspin.net/backupSet=$app
echo "Waiting a few seconds for backup to restore..."
sleep 10
velero restore describe $restore
echo "Press enter if backup is ready:"
read
flux resume helmrelease -n $namespace $hr
flux resume kustomization ${kust:-$app}