You are looking at the documentation of a prior release. To read the documentation of the latest release, please visit here.

Backblaze B2

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.

Create Storage Secret

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

KeyTypeDescription
RESTIC_PASSWORDRequiredPassword that will be used to encrypt the backup snapshots.
B2_ACCOUNT_IDRequiredBackblaze B2 account id.
B2_ACCOUNT_KEYRequiredBackblaze 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

Create Repository

Now, you have to create a Repository crd. You have to provide the storage secret that we have created earlier in spec.backend.storageSecretName field.

Following parameters are available for b2 backend,

ParameterTypeDescription
b2.bucketRequiredName of the B2 bucket.
b2.prefixOptionalPath prefix inside the bucket where the backed up data will be stored.
b2.maxConnectionsOptionalMaximum 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

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

$ kubectl apply -f https://github.com/stashed/docs/raw/v0.9.0-rc.6/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.

Next Steps

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