brew install velero
Ensure your kubectl cli is working properly.
These notes come from reading https://github.com/vmware-tanzu/velero-plugin-for-microsoft-azure#setup
az login
Set variables
export AZURE_BACKUP_RESOURCE_GROUP="Velero_Backups"
export BLOB_CONTAINER=velero
Create account id with random characters
export AZURE_STORAGE_ACCOUNT_ID="velero$(uuidgen | cut -d '-' -f5 | tr '[A-Z]' '[a-z]')"
Create the az objects
az group create -n $AZURE_BACKUP_RESOURCE_GROUP --location EastUS
az storage account create \
--name $AZURE_STORAGE_ACCOUNT_ID \
--resource-group $AZURE_BACKUP_RESOURCE_GROUP \
--sku Standard_GRS \
--encryption-services blob \
--https-only true \
--kind BlobStorage \
--access-tier Hot
az storage container create -n $BLOB_CONTAINER --public-access off --account-name $AZURE_STORAGE_ACCOUNT_ID
Set your resource group ID. Needs to be the group with the VMs and disks. Usually this is the auto-generated one. example:
export AZURE_RESOURCE_GROUP="MC_mdd-rfed-aks_c-fzzkm_eastus"
grab from az command, or look it up
export AZURE_SUBSCRIPTION_ID=$(az account list --query '[?isDefault].id' -o tsv)
export AZURE_TENANT_ID=$(az account list --query '[?isDefault].tenantId' -o tsv)
Create service principal, grab client ID
export AZURE_CLIENT_SECRET=$(az ad sp create-for-rbac --name "velero" --role "Contributor" --query "password" -o tsv --scopes /subscriptions/${AZURE_SUBSCRIPTION_ID})
export AZURE_CLIENT_ID=$(az ad sp list --display-name "velero" --query '[0].appId' -o tsv)
cat << EOF > ./credentials-velero
AZURE_SUBSCRIPTION_ID=${AZURE_SUBSCRIPTION_ID}
AZURE_TENANT_ID=${AZURE_TENANT_ID}
AZURE_CLIENT_ID=${AZURE_CLIENT_ID}
AZURE_CLIENT_SECRET=${AZURE_CLIENT_SECRET}
AZURE_RESOURCE_GROUP=${AZURE_RESOURCE_GROUP}
AZURE_CLOUD_NAME=AzurePublicCloud
EOF
velero install \
--provider azure \
--plugins velero/velero-plugin-for-microsoft-azure:v1.1.0 \
--bucket $BLOB_CONTAINER \
--secret-file ./credentials-velero \
--backup-location-config resourceGroup=$AZURE_BACKUP_RESOURCE_GROUP,storageAccount=$AZURE_STORAGE_ACCOUNT_ID \
--snapshot-location-config apiTimeout=10m \
--velero-pod-cpu-limit 2000m \
--velero-pod-mem-limit 1024Mi
Need to increase the resource limits in the deployment otherwise you might see strange errors. vmware-tanzu/velero#1856
resources:
requests:
cpu: "1"
memory: 256Mi
https://velero.io/docs/v1.5/examples/ velero gives some examples here
git clone https://github.com/vmware-tanzu/velero.git
kubectl apply -f examples/nginx-app/with-pv.yaml
kubectl delete namespace/velero clusterrolebinding/velero
kubectl delete crds -l component=velero