Repository navigation
Description
Use case
A ClickHouseCluster managed by the operator has no built-in way to be backed up or restored. Users who
need scheduled backups to S3 and a repeatable restore have to maintain their own CronJobs or sidecars
next to the operator, with their own credentials handling, status reporting and retention.
This is item 7 of the roadmap in #65 ("Automated backups to S3"). I would like to:
- take a one-off backup of a cluster before a risky change,
- run backups on a schedule, with a full backup followed by incremental backups,
- restore a backup into the same cluster or into a new one, and
- see the result of each of these in the status of a Kubernetes resource.
Describe the solution you'd like
Three new kinds in clickhouse.com/v1alpha1, separate from ClickHouseCluster so the existing API does
not change:
ClickHouseBackup: one backup of a cluster to S3, full or incremental (baseBackupRef), for
everything exceptsystemor for selected databases and tables.ClickHouseScheduledBackup: createsClickHouseBackupresources on a cron schedule, with
fullBackupIntervalto alternate full and incremental backups and history limits for the created
resources.ClickHouseRestore: one restore, from aClickHouseBackupor from a location in the storage.
The controllers use the native BACKUP / RESTORE ... ON CLUSTER ... ASYNC statements and poll
system.backups. The data goes from the ClickHouse pods to the storage directly, so there is no sidecar
or extra pod and the operator needs no access to the storage. Credentials come from a Secret, or from
the server itself (for example an IAM role of the ServiceAccount) when none are given.
I have an implementation of this and will open a pull request that links to this issue.
Describe alternatives you've considered
- A
clickhouse-backupsidecar and CronJobs. It needs an extra container in every replica with
access to the data volume and the storage credentials, and the operator has no view of the result. - A
backupsection insideClickHouseCluster. It would change the cluster API while the
v1alpha2API is being designed, and it does not model one-off backups and restores well. Separate
kinds can be added without touching the cluster spec. - Reading
system.backup_loginstead ofsystem.backups. The log survives restarts, but the
operator does not enable it today and enabling it would restart existing clusters.
Additional context
Open questions where maintainer direction would help:
- Whether the new kinds should target
v1alpha1now or wait forv1alpha2. - Whether deleting backup data from the storage (retention) should be done by the operator or left to
bucket lifecycle rules. The proposed implementation leaves it to the bucket. - Whether a running operation should be cancelled when its resource is deleted.
Activity
Tal-E commentedon Dec 1, 2026
@GrigoryPervakov thank you for looking at this and for setting the type and the
featurelabel.There is a PR that implements it: #394. It adds
ClickHouseBackup,ClickHouseScheduledBackupandClickHouseRestore, built on the nativeBACKUP/RESTORE ... ON CLUSTERstatements with S3 storage.I merged the current
maininto it today (it had a conflict inPROJECT) and adapted it to the Pod IP connections and to the logging and constants rules indocs/development.md.make lint,make testand the backup e2e spec pass locally. The workflow runs on the PR are waiting for approval.I'm happy to change the API or split the PR if you would prefer a different shape.