Microsoft Azure Storage

KubeStash supports Microsoft’s Azure Blob Storage as a backend. This tutorial will show you how to use this backend.

In order to use Azure Blob Storage as backend, you have to create a Secret and a BackupStorage object pointing to the desired blob container.

Create Storage Secret

To configure storage secret for this backend, following secret keys are needed:

KeyTypeDescription
AZURE_ACCOUNT_KEYRequiredAzure Storage account key

Create storage secret as below,

$ echo -n '<your-azure-storage-account-key>' > AZURE_ACCOUNT_KEY
$ kubectl create secret generic -n demo azure-secret \
    --from-file=./AZURE_ACCOUNT_KEY
secret/azure-secret created

Create BackupStorage

Now, you have to create a BackupStorage cr. You have to specify the name of the storage secret that we have created earlier in the spec.storage.azure.secretName field.

Following parameters are available for azure backend.

ParameterTypeDescription
azure.storageAccountRequiredName of the Storage account.
azure.containerRequiredName of Storage container.
azure.secretNameRequiredSpecify the name of the Secret that contains the access credential for this storage.
azure.prefixOptionalPath prefix inside the container where backed up data will be stored.
azure.maxConnectionsOptionalMaximum number of parallel connections to use for uploading backup data. By default, KubeStash will use maximum 5 parallel connections.

Below, the YAML of a sample BackupStorage crd that uses an Azure Blob container as a backend.

apiVersion: storage.kubestash.com/v1alpha1
kind: BackupStorage
metadata:
  name: azure-storage
  namespace: demo
spec:
  storage:
    provider: azure
    azure:
      storageAccount: kubestash
      container: kubestash-demo
      prefix: /backup/demo/deployment/kubestash-demo
      secretName: azure-secret
  usagePolicy:
    allowedNamespaces:
      from: All
  default: true
  deletionPolicy: WipeOut

Create the BackupStorage we have shown above using the following command,

$ kubectl apply -f https://github.com/kubestash/docs/raw/v2024.12.9/docs/guides/backends/azure/examples/azure.yaml
backupstorage.storage.kubestash.com/azure-storage created

Now, we are ready to use this backend to backup our desired data using KubeStash.

Next Steps

  • Learn how to use KubeStash to backup workloads data from here.
  • Learn how to use KubeStash to backup stand-alone PVC from here.