litestream-k8s

Installation
SKILL.md

Litestream on Kubernetes with S3/R2

Run SQLite as your primary database in Kubernetes with continuous replication to S3-compatible object storage via Litestream. The database restores automatically on pod startup — no PersistentVolumeClaim needed.

Why this pattern

SQLite is fast, simple, and zero-dependency. The problem on Kubernetes is that pods are ephemeral — when a pod dies, the DB is gone. Litestream solves this by continuously streaming WAL changes to object storage (Cloudflare R2, AWS S3, etc.) and restoring on startup. This gives you:

  • Single-binary app with no external database dependency
  • Durability via object storage (cheaper and more resilient than a PVC on a single node)
  • Point-in-time recovery for free — every WAL segment is preserved
  • Works with any S3-compatible backend

Trade-off: single-writer only (one replica). If you need horizontal scaling or concurrent writes, use Postgres.

File layout

.
Related skills
Installs
4
First Seen
Apr 18, 2026