minikube config set cpus 4
minikube config set memory 5000
minikube start
az group create \
--name storage-resource-group \
--location eastus
az aks create \
--location eastus \
--name velero \
--resource-group storage-resource-group \
--network-plugin azure \
--node-vm-size Standard_DS3_v2 \
--node-count 2 \
--auto-upgrade-channel rapid \
--node-os-upgrade-channel NodeImage
az aks get-credentials --resource-group storage-resource-group --name velero --overwrite-existing
Create a storage account
az group create \
--name storage-resource-group \
--location eastus
az storage account create --name velerogist \
--resource-group storage-resource-group \
--location eastus --sku Standard_RAGRS \
--kind StorageV2 \
--allow-blob-public-access false
Create a storage container
az storage container create \
--name velerobackups \
--account-name velerogist
Get the access key:
AZURE_STORAGE_ACCOUNT_ACCESS_KEY=`az storage account keys list --account-name velerogist --query "[?keyName == 'key1'].value" -o tsv`
Create file with config:
cat << EOF > ./credentials-velero
AZURE_STORAGE_ACCOUNT_ACCESS_KEY=${AZURE_STORAGE_ACCOUNT_ACCESS_KEY}
AZURE_CLOUD_NAME=AzurePublicCloud
EOF
Install velero
velero install \
--provider azure \
--use-node-agent \
--plugins velero/velero-plugin-for-microsoft-azure:v1.8.0 \
--bucket velerobackups \
--secret-file ./credentials-velero \
--use-volume-snapshots=false \
--backup-location-config storageAccount=velerogist,storageAccountKeyEnvVar=AZURE_STORAGE_ACCOUNT_ACCESS_KEY
Check storage locations:
kubectl get -n velero BackupStorageLocation
kubectl apply -f https://raw.githubusercontent.com/vmware-tanzu/velero/main/examples/nginx-app/with-pv.yaml
Note: the fsfreeze hook in the sidecar container of the sample application makes minikube crash. You want to remove the annotations and the sidecar container if testing with minikube.
Generate some logs (works only on AKS)
curl -v $(k get svc -n nginx-example my-nginx -o=jsonpath='{.status.loadBalancer.ingress[0].ip}')
velero backup create aks-backup-2345 --include-namespaces nginx-example --default-volumes-to-fs-backup
az aks create \
--location eastus \
--name restore \
--resource-group storage-resource-group \
--network-plugin azure \
--node-vm-size Standard_DS3_v2 \
--node-count 2 \
--auto-upgrade-channel rapid \
--node-os-upgrade-channel NodeImage
az aks get-credentials --resource-group storage-resource-group --name restore --overwrite-existing
velero restore create --from-backup aks-backup-2345
this spec works: