Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

minio-mounter

A small container image that mounts a WebDAV endpoint over davfs2 and runs a MinIO server on top of it. Built to turn a Hetzner Storagebox, or anything else that only speaks WebDAV, into an S3-compatible backend without paying for real object storage.

Why this exists

Hetzner Storageboxes are cheap per-TB and support WebDAV, but nothing that expects an S3 API can talk to WebDAV directly. This image bridges the two: mount the storagebox with davfs2 at container startup, point MinIO's server process at that mount, and anything speaking S3 (MOCO's backup jobs, mc, aws s3, whatever) sees a normal bucket.

It's not a replacement for the official MinIO Operator. There's no multi-node clustering, no erasure coding, no distributed mode. It's one pod, one mount, one MinIO process. That's the tradeoff for getting an S3 endpoint out of storage that was never meant to have one.

Written up in more detail, including a production incident this image was directly responsible for, in Getting Started on MOCO Part 2.

How it works

The entrypoint script does two things, in order:

  1. Mounts $WEBDAV_URL at $MOUNT_POINT using mount.davfs.
  2. Execs the MinIO server against that mount point, using the root credentials and KMS key passed in as environment variables.

Nothing else runs in the container. If the mount fails, MinIO never starts.

Environment variables

Variable Required Description
WEBDAV_URL yes Full WebDAV URL to mount, e.g. https://uXXXXXX.your-storagebox.de/some-directory
MOUNT_POINT yes Where to mount it inside the container, typically /data
SECRETS_PATH yes Path to a file holding WEBDAV_URL <storagebox-user> <storagebox-password>, used by davfs2 for auth instead of an interactive prompt
MINIO_ROOT_USER yes MinIO root username
MINIO_ROOT_PASSWORD yes MinIO root password
MINIO_KMS_SECRET_KEY no Enables SSE-KMS at-rest encryption if set, format key-name:base64-key
MINIO_CONSOLE_PORT no Defaults to :9001 if unset

Requirements

This has to run privileged, and it needs /dev/fuse from the host. davfs2 mounts a FUSE filesystem, and FUSE needs both the device node and enough privilege to create the mount from inside the container. There's no way around this that keeps the container unprivileged; if your cluster's Pod Security policy blocks privileged containers, this image won't run there.

docker run --privileged \
  --device /dev/fuse \
  -e WEBDAV_URL="https://uXXXXXX.your-storagebox.de/backups" \
  -e MOUNT_POINT="/data" \
  -e SECRETS_PATH="/secrets/webdav-creds" \
  -e MINIO_ROOT_USER="minio" \
  -e MINIO_ROOT_PASSWORD="change-me" \
  -v /path/to/secrets:/secrets \
  ghcr.io/muchezz/minio-mounter:latest

Running it in Kubernetes

Same two requirements apply: securityContext.privileged: true on the container, and a hostPath volume mounting /dev/fuse. A minimal shape:

containers:
  - name: minioclient
    image: ghcr.io/muchezz/minio-mounter:latest
    securityContext:
      privileged: true
    volumeMounts:
      - name: data
        mountPath: /data
      - name: fuse
        mountPath: /dev/fuse
volumes:
  - name: data
    emptyDir: {}
  - name: fuse
    hostPath:
      path: /dev/fuse

/data is an emptyDir. It doesn't store anything itself, it's just the mount point that gets taken over once davfs2 attaches the WebDAV filesystem.

davfs2 tuning: read this before pushing anything larger than a few GB through it

The defaults davfs2 ships with are not sized for large uploads. At 50MB cache_size, a multipart upload in the tens of GB will hit a cache flush mid-stream, and MinIO will reject the truncated part with IncompleteBody. This is not intermittent once you're past the size where it triggers. It fails the same way on every retry.

Fix, set in /etc/davfs2/davfs2.conf:

cache_size      4096
buf_size        64
delay_upload    0
use_locks       0

delay_upload 0 matters almost as much as the larger cache. The default 10-second delay batches writes in a way that makes the mid-stream flush worse once an upload gets large, not better. These values are already baked into this image; if you're building your own variant from the Dockerfile, don't drop them back to defaults.

Full incident writeup, including the actual error and the numbers involved, is in the dev.to post.

Building

docker build -t minio-mounter .

The Dockerfile pulls minio and mc from dl.min.io at build time with no version pinning, so a rebuild today can pull a different binary than a rebuild last month. Pin the download URLs to a specific release if you need reproducible builds.

Limitations

  • Single pod, no HA. A pod restart means a brief gap while the FUSE mount comes back up.
  • Throughput is bounded by WebDAV over HTTPS plus the FUSE overhead on top, not by MinIO or the storagebox itself. Fine for scheduled backups, not meant for anything latency-sensitive.
  • Requires a privileged container. Won't run under a restrictive Pod Security Standard without an exception.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages