Backblaze B2

Stash supports Backblaze B2 as backend. This tutorial will show you how to configure Restic and storage Secret for B2 backend.

Create Storage Secret

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

Key Description
RESTIC_PASSWORD Required. Password used to encrypt snapshots by restic
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 b2-secret \
    --from-file=./RESTIC_PASSWORD \
    --from-file=./B2_ACCOUNT_ID \
secret "b2-secret" created

Verify that the secret has been created with respective keys,

$ kubectl get secret b2-secret -o yaml

apiVersion: v1
  B2_ACCOUNT_ID: PHlvdXItYXp1cmUtc3RvcmFnZS1hY2NvdW50LWtleT4=
  B2_ACCOUNT_KEY: PHlvdXItYXp1cmUtc3RvcmFnZS1hY2NvdW50LW5hbWU+
kind: Secret
  creationTimestamp: 2017-06-28T13:27:16Z
  name: b2-secret
  namespace: default
  resourceVersion: "6809"
  selfLink: /api/v1/namespaces/default/secrets/b2-secret
  uid: 80f658d1-5c05-11e7-bb52-08002711f4aa
type: Opaque

Configure Restic

Now, you have to configure Restic crd to use Backblaze B2. You have to provide previously created storage secret in spec.backend.storageSecretName field.

Following parameters are available for B2 backend.

Parameter Description
b2.bucket Required. Name of B2 bucket
b2.prefix Optional. Path prefix into bucket where repository will be created.

Below, the YAML for Restic crd configured to use Backblaze B2.

kind: Restic
  name: b2-restic
  namespace: default
      app: b2-restic
  - path: /source/data
    retentionPolicyName: 'keep-last-5'
      bucket: stash-qa
      prefix: demo
    storageSecretName: b2-secret
  schedule: '@every 1m'
  - mountPath: /source/data
    name: source-data
  - name: 'keep-last-5'
    keepLast: 5
    prune: true

Now, create the Restic we have configured above for b2 backend,

$ kubectl apply -f ./docs/examples/backends/b2/b2-restic.yaml
restic "b2-restic" created

Next Steps

  • Learn how to use Stash to backup a Kubernetes deployment from here.
  • Learn how to recover from backed up snapshot from here.

Take your team where it needs to go.

Create your cluster in minutes. Our team is here to help and would be happy to chat with you.