Configure longhorn backup to contabo object storage

ngotzmann
2 min readApr 21, 2023

Configure longhorn backup to point to contabo object storage

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

  • Kubernetes cluster
  • Helm installed
  • Contabo object-storage
  • Longhorn installed with helm

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_ENDPOINT: https://<eu2|sin1>.contabostorage.com/
AWS_REGION: default
VIRTUAL_HOSTED_STYLE: true

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

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

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

Thats all, hope it helped someone!

Originally published at https://ngotzmann.net.

--

--