Back up Apache Kafka on Kubernetes
Run backup and restore as first-class Kubernetes resources. The OSO Kafka Backup Operator reconciles KafkaBackup and KafkaRestore custom resources against any Kafka reachable from your cluster, so backups live in Git next to the rest of your platform config.
Kubernetes-native backup for any Kafka
The OSO Kafka Backup Operator extends Kubernetes with Custom Resource
Definitions in the kafka.oso.sh/v1alpha1 API group. You declare a KafkaBackup or
KafkaRestore object, and the operator runs it as a Kubernetes Job that executes the
kafka-backup engine. Because the desired state is a custom resource, backups fit
straight into GitOps and kubectl workflows.
It targets any Kafka the pod can reach over the network — self-managed brokers on the same cluster, Amazon MSK, Confluent, or Kafka in another namespace. If your cluster is managed by Strimzi, use the Strimzi Backup Operator instead: it resolves bootstrap servers and credentials from your Strimzi resources. This generic operator is the right choice for everything else.
Install and schedule a backup
Install the operator with Helm, then apply a KafkaBackup. A schedule field turns it
into a recurring backup; stopAtCurrentOffsets: true makes each run a point-in-time
snapshot. To restore, apply a KafkaRestore that points at the backup and, optionally,
a target time.
- Install
- KafkaBackup
- KafkaRestore
helm repo add oso https://osodevops.github.io/helm-charts/
helm repo update
helm install kafka-backup-operator oso/kafka-backup-operator \
--namespace kafka-backup \
--create-namespace
apiVersion: kafka.oso.sh/v1alpha1
kind: KafkaBackup
metadata:
name: hourly-backup
namespace: kafka-backup
spec:
kafkaCluster:
bootstrapServers:
- kafka.default.svc:9092
topics:
- orders
- payments
storage:
storageType: s3
s3:
bucket: my-kafka-backups
region: us-west-2
credentialsSecret:
name: s3-credentials
schedule: "0 0 * * * * *" # every hour; cron format includes seconds
stopAtCurrentOffsets: true
compression: zstd
apiVersion: kafka.oso.sh/v1alpha1
kind: KafkaRestore
metadata:
name: pitr-restore
namespace: kafka-backup
spec:
backupRef:
name: hourly-backup
pitr:
endTime: "2026-07-06T12:00:00Z"
kafkaCluster:
bootstrapServers:
- kafka.default.svc:9092
Without the operator
Not every team wants a controller. The same kafka-backup engine runs as a plain
Kubernetes CronJob for scheduled backups or a one-off Job for a single
backup or restore — the Kubernetes deployment guide covers
both manifests. The operator adds schedule reconciliation, status reporting, and
GitOps-native CRDs on top of that same engine, so you can start with a CronJob and move
to the operator later without changing how backups are written.
Frequently asked questions
Does the operator only work with Kafka running inside Kubernetes?
No. The operator runs on Kubernetes, but it backs up any Kafka cluster its pods can reach over the network — including Amazon MSK, Confluent, or self-managed brokers outside the cluster. You set the broker addresses in spec.kafkaCluster.bootstrapServers.
How do I schedule recurring backups on Kubernetes?
Set the schedule field on a KafkaBackup resource using cron syntax (the operator uses a seven-field format that includes seconds). The operator reconciles the schedule and runs each backup as a Kubernetes Job. Omit the field for a one-shot backup.
What is the difference between this and the Strimzi Backup Operator?
This generic operator uses the kafka.oso.sh/v1alpha1 API group and targets any Kafka you point it at with bootstrapServers. The Strimzi Backup Operator (kafkabackup.com/v1alpha1) is for Strimzi-managed clusters and resolves connection details and credentials from your Strimzi Kafka and KafkaUser resources automatically.
Can I restore to a specific point in time from a CRD?
Yes. A KafkaRestore resource with a pitr.endTime restores topic data up to that millisecond-precise timestamp, which is how you recover from a bad deploy or an accidental delete.
How are storage credentials handled?
Credentials come from Kubernetes Secrets referenced in the storage configuration — for example credentialsSecret for S3. The operator mounts them into the backup Job pod, so no secrets live in the KafkaBackup manifest itself.
Ready to protect your Kafka data?
Take your first backup in minutes with the open source CLI, or talk to us about Enterprise features like encryption, RBAC, and audit logging.