Backup

AKS backup tricks.

AKS backup with velero

Install velero

Set env vars.


# Velero Azure Storace Account Name (must be unique)
VELERO_SA_NAME="myaksbackup"

# Velero Azure Storace Account Resource Group
VELERO_RG="rg-aks-backup"

# Velero Azure Storace Account Region
VELERO_REGION="eastus"

# Velero Azure Storace Account Subscription
VELERO_SUBSCRIPTION="MY-SUBSCRIPTION"

Create Velero Storage Account Resource Group.

az group create \
  --location $VELERO_REGION \
  --name $VELERO_RG \
  --subscription $VELERO_SUBSCRIPTION \
  --tags 'ENV=DEV' 'BU=MARKETING'

Create Velero Storage Account.

Create BLOB.

Create Velero Service Principal.

Copy and paste in a safe place the Service Principal credentials.

Velero Service Principal must be owner of the AKS Node Resource Group.

Velero Service Principal must be owner of the Storage Account RG.

Set env vars.

Create a file with Velero credentials.

Install Velero.

Restic

Requirements

Your pods must have the following annotation.

To backup azure-file, the Storage Classes must have the following mount option:

For more details search for "Microsoft Azure" here: https://velero.io/docs/master/restic/arrow-up-right

Credentials

List restic repos

Get restic password

List snapshots

Mount volume

Force delete

References

https://docs.syseleven.de/metakube/en/tutorials/create-backup-and-restorearrow-up-right

https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#microsoft-azure-blob-storagearrow-up-right

https://restic.readthedocs.io/en/latest/060_forget.htmlarrow-up-right

Backup test

Apply the following manifest.

Create a test backup.

References

https://github.com/vmware-tanzu/velero-plugin-for-microsoft-azurearrow-up-right

https://github.com/vmware-tanzu/velero/blob/48792ece1f6b10d732b57477059a6b32dd10e25d/site/docs/v1.0.0/restic.mdarrow-up-right

https://velero.io/docs/v1.3.2/restic/arrow-up-right Search for "Microsoft Azure"

https://stackoverflow.com/questions/61915527/azure-aks-backup-using-veleroarrow-up-right

https://github.com/andyzhangx/demo/blob/master/issues/azuredisk-issues.md#recommended-stable-version-for-azure-diskarrow-up-right

https://github.com/vmware-tanzu/velero/issues/1404arrow-up-right

https://github.com/vmware-tanzu/velero-plugin-for-microsoft-azure/issues/13arrow-up-right

Velero (DEPRECATED DOCUMENTATION)

circle-exclamation

Setup the storage

Velero stores the backup files on a Storage Account.

Using Azure CLI, login and set your subscription.

Define variables.

Create the Storage Account.

Create the Storage Container.

Create a Service Principal.

Get the output and save it in a secure place (it will be displayed only once).

Create the Velero credentials file.

Install Velero

First of all, make sure you have kubectl.

Check the latest Velero release: https://github.com/heptio/velero/releasesarrow-up-right

Install it.

Deploy it.

Test it

References

https://github.com/vmware-tanzu/velero-plugin-for-microsoft-azurearrow-up-right

https://velero.io/docs/v1.0.0/azure-config/arrow-up-right

https://blog.getupcloud.com/velero-backup-do-seu-cluster-kubernetes-em-5-minutos-3129a0518541arrow-up-right

https://blog.kubernauts.io/backup-and-restore-of-kubernetes-applications-using-heptios-velero-with-restic-and-rook-ceph-as-2e8df15b1487arrow-up-right

https://sysadminas.eu/2019/12/part-3-azure-kubernetes-services-aks-backup-restore-your-aks-data-with-velero/arrow-up-right

Backup schedule

Last updated