Stash supports Backblaze’s B2 Cloud Storage as a backend. This tutorial will show you how to use this backend.
In order to use Backblaze B2 Cloud Storage as backend, you have to create a
Secret and a
Repository object pointing to the desired B2 bucket.
If the bucket does not exist yet and the credentials you have provided have the privilege to create bucket, it will be created automatically during the first backup. In this case, you have to make sure that the bucket name is unique across all B2 buckets.
To configure storage secret for this backend, following secret keys are needed:
|Password that will be used to encrypt the backup snapshots.|
|Backblaze B2 account id.|
|Backblaze B2 account key.|
Create storage secret as below,
$ echo -n 'changeit' > RESTIC_PASSWORD $ echo -n '<your-b2-account-id>' > B2_ACCOUNT_ID $ echo -n '<your-b2-account-key>' > B2_ACCOUNT_KEY $ kubectl create secret generic -n demo b2-secret \ --from-file=./RESTIC_PASSWORD \ --from-file=./B2_ACCOUNT_ID \ --from-file=./B2_ACCOUNT_KEY secret/b2-secret created
Now, you have to create a
Repository crd. You have to provide the storage secret that we have created earlier in
Following parameters are available for
|Name of the B2 bucket.|
|Path prefix inside the bucket where the backed up data will be stored.|
|Maximum number of parallel connections to use for uploading backup data. By default, Stash will use maximum 5 parallel connections.|
Below, the YAML of a sample
Repository crd that uses a B2 bucket as a backend.
apiVersion: stash.appscode.com/v1alpha1 kind: Repository metadata: name: b2-repo namespace: demo spec: backend: b2: bucket: stash-backup prefix: /demo/deployment/my-deploy storageSecretName: b2-secret
Repository we have shown above using the following command,
$ kubectl apply -f https://github.com/stashed/docs/raw/v0.9.0-rc.4/docs/examples/guides/latest/backends/b2.yaml repository/b2-repo created
Now, we are ready to use this backend to backup our desired data using Stash.