A while ago I was setting up backups for a Postgres volume on Kubernetes, and I wrote down what I actually wanted:
Keep a backup from each of the last 7 days, one per week for a month, and one per month for a year.
Pretty normal ask, right? That's how people have rotated backups for decades. Then I tried to build it, and it got weird fast.
Velero gives you one number
Velero is great, and I still use it for cluster stuff. But every backup it makes gets exactly one TTL. So "7 daily, 4 weekly, 12 monthly" turns into three schedules:
velero schedule create daily --schedule "0 2 * * *" --ttl 168h
velero schedule create weekly --schedule "0 3 * * 0" --ttl 672h
velero schedule create monthly --schedule "0 4 1 * *" --ttl 8760h
Three schedules backing up the same data. Three things to keep in sync every time something changes.
The part that actually bugged me: a TTL is just a timer. Say your backups quietly fail for eight days. Maybe the bucket credentials expired, maybe a node is stuck. Your last good daily backup still expires right on time. So right when you need it most, it's gone.
The old-school fix: GFS
Sysadmins figured this out ages ago with Grandfather-Father-Son rotation. Take one backup a night, then decide afterwards which ones to keep:
- the newest one from each of the last 7 days
- the newest one from each of the last 4 weeks
- the newest one from each of the last 12 months
One backup can be your "daily", your "weekly" and your "monthly" at the same time. restic and borg have worked this way forever. I wanted the same for Kubernetes volumes, so I built Bardiup.
What it looks like
apiVersion: bardiup.io/v1alpha1
kind: BackupConfig
metadata: {name: nightly, namespace: shop}
spec:
schedule: "0 2 * * *"
pvcSelector: {matchLabels: {app: postgres}}
storage:
s3: {bucket: backups, credentialsSecretRef: {name: s3}}
retention: {daily: 7, weekly: 4, monthly: 12, yearly: 5}
That's it. One schedule. After a year you end up with 20 backups instead of 365. My favourite bit: each backup tells you why it's still around.
$ kubectl get backups
NAME RETAINED BY
nightly-data-pg-0-20261119-020000 ["daily","weekly","monthly","yearly"]
nightly-data-pg-0-20261118-020000 ["daily"]
nightly-data-pg-0-20261031-020000 ["monthly"]
And the outage problem? Bardiup only counts days that have a successful backup. If things break for a week, your last good copies just stay put.
I wanted boring backups
Every backup is a plain tar.gz in your S3 bucket, plus a small JSON file with its checksum. No special format, no repo password to lose.
If the cluster is gone, and the operator is gone, and you're restoring at 3am from some random laptop, this still works:
aws s3 cp s3://backups/shop/data-pg-0/nightly-....tar.gz - | tar -xzpf - -C /restore
I like knowing that.
A few other things I cared about
-
Teams own their backups. It's all namespaced and plugs into the normal
edit/viewroles. Nobody needs cluster-admin to back up their own database. - It's small. One controller using around 45 MB of RAM. Nothing runs on your nodes between backups, just a short Job per volume while it works.
-
Snapshots if you want them. Use
method: snapshotand it backs up from a CSI snapshot, so the database gets a consistent copy without stopping.
What it doesn't do (yet)
I'd rather say this upfront. It doesn't back up Kubernetes resources, so keep Git or Velero for that. There's no dedup either, since every backup is a full archive. And pre/post hooks (like telling Postgres "hey, backup starting") are next on my list.
Try it, break it, tell me
It's v0.1.0 and I'm honestly looking for feedback. What breaks, what's confusing, what's missing for your setup.
How do you handle backup retention today? I'd love to hear in the comments.
Top comments (0)