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:
Key | Type | Description |
---|---|---|
RESTIC_PASSWORD | Required | Password that will be used to encrypt the backup snapshots. |
B2_ACCOUNT_ID | Required | Backblaze B2 account id. |
B2_ACCOUNT_KEY | Required | 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
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,
Parameter | Type | Description |
---|---|---|
b2.bucket | Required | Name of the B2 bucket. |
b2.prefix | Optional | Path prefix inside the bucket where the backed up data will be stored. |
b2.maxConnections | Optional | 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
Create the Repository
we have shown above using the following command,
$ kubectl apply -f https://github.com/stashed/docs/raw/v2023.02.28/docs/guides/backends/b2/examples/b2.yaml
repository/b2-repo created
Now, we are ready to use this backend to backup our desired data using Stash.