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

REST Backend

Stash supports restic’s REST Server as a backend. This tutorial will show you how to use this backend.

In order to use REST Server as backend, you have to create a Secret and a Repository object pointing to the desired REST Server address.

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.
REST_SERVER_USERNAMEOptionalUsername for basic authentication in the REST server.
REST_SERVER_PASSWORDOptionalPassword for basic authentication in the REST Server
CA_CERT_DATAoptionalCA certificate used by storage backend. This can be used to pass the root certificate that has been used to sign the server certificate of a TLS secured REST Server.

Create storage secret as below,

$ echo -n 'changeit' > RESTIC_PASSWORD
$ echo -n '<your-rest-server-username>' > REST_SERVER_USERNAME
$ echo -n '<your-rest-server-password>' > REST_SERVER_PASSWORD
$ kubectl create secret generic -n demo rest-secret \
    --from-file=./RESTIC_PASSWORD \
    --from-file=./REST_SERVER_USERNAME \
    --from-file=./REST_SERVER_PASSWORD
secret/rest-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 rest backend,

ParameterTypeDescription
rest.urlRequiredURL of the REST Server along with an optional path inside the server where backed up snapshot will be stored.

Below, the YAML of a sample Repository crd that uses a REST Server as a backend.

apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
  name: rest-repo
  namespace: demo
spec:
  backend:
    rest:
      url: http://rest-server.demo.svc:8000/stash-backup-demo
    storageSecretName: rest-secret

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

$ kubectl apply -f https://github.com/stashed/docs/raw/v2020.08.27/docs/examples/guides/latest/backends/rest.yaml
repository/rest-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.