Longhorn backup to contabo object storage

Configure longhorn backup to point to contabo object storage

Published on 20 Apr, 2024


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

Configuration

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 longhorn 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_ENDPOINTS: https://contabostorage.com/
AWS_REGION: default
VIRTUAL_HOSTED_STYLE: true
  1. 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.
  2. Also we need to set VIRTUAL_HOSTED_STYLE to true, because the new url style is currently not supported.

Values for longhorn helm chart

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

backupTarget: "s3://<eu2|usc1|sin1>@contabo/<your-bucket-name>/"
backupTargetCredentialSecret: <name-of-your-secret>

Thats all, hope it helped someone!