Longhorn backup to contabo object storage

Configure longhorn backup to point to contabo object storage

Published on 20 Apr, 2023

rancher logo

While this guide provides essential configuration information to utilize Contabo object-storage as a backup location, it is important to note that it is not a comprehensive tutorial on setting up Longhorn backup.

To prevent accidental data loss, I’ve implemented longhorn as my csi for Kubernetes and opted to leverage Contabo’s S3-compatible object-storage for backup storage.

I needed more time than expected to configure the backup to the Contabo object-storage, so here is a brief guide.

Pre requirements


Following the guide to setup a backup, after we created the contabo object-storage and a bucket, we need to create a secret to connect to the object-storage.

Values for longorn secret

I encountered two pitfalls while attempting to set up the correct data, but the following configuration worked for me:

AWS_ACCESS_KEY_ID: your_access_key
AWS_SECRET_ACCESS_KEY: your_secret_key
AWS_ENDPOINT: https://<eu2|sin1>.contabostorage.com/
AWS_REGION: default

You can get the AWS_ENDPOINT url from your contabo control-panel.
The AWS_REGION is default, the location is contained in the AWS_ENDPOINT variable, so this value does not change even if you have two object-storages in different regions.
Also we need to set VIRTUAL_HOSTED_STYLE to true, because the new url style is currently not supported.

Values for longorn helm chart

You need to extend your longhorn helm values, under the point defaultSettings you have to add these configurations:

backupTarget: "s3://<bucket-name>@default/"
backupTargetCredentialSecret: <name-of-your-secret>

Thats all, hope it helped someone!