New to KubeDB? Please start here.

Kafka Branching Overview

KubeDB Courier creates independent Kafka deployments from CSI storage snapshots on copy-on-write storage such as Ceph RBD. Use a branch to develop against existing data, test changes, or prepare an isolated environment. Writes on either side do not propagate to the other; optional refresh replaces branch data with a fresh source snapshot.

The tutorials use a three-node combined broker/controller cluster. Courier clones the broker/controller volumes, and KubeDB recovers the independent Kafka cluster. Topic records are copied through storage snapshots, rather than replicated continuously.

Start with the common branching architecture and Courier setup.

The Branch resource

A Branch is a namespaced courier.kubedb.com/v1alpha1 resource created on the source cluster. This example selects a source in demo and a target in dev:

apiVersion: courier.kubedb.com/v1alpha1
kind: Branch
metadata:
  name: kafka-dev
  namespace: demo
spec:
  source:
    databaseRef:
      apiGroup: kubedb.com
      kind: Kafka
      name: kafka-source
    namespace: demo
  target:
    namespace: dev
    name: kafka-dev
    storageClassName: ceph-rbd
    resources:
      requests:
        cpu: 500m
        memory: 1200Mi
      limits:
        memory: 1200Mi
  deletionPolicy: Delete

Source and target

source.databaseRef selects the KubeDB resource, while source.namespace locates it. target.name and target.namespace identify the new deployment. Omit target.clusterName for the same cluster; for OCM, set it to the target ManagedCluster name.

target.storageClassName selects storage backed by the same Ceph system as the snapshots. target.resources sets database container resources for this example. The source requires durable storage.

Optional behavior

Status and readiness

The Branch progresses through snapshot creation, target provisioning, optional credential reset and actions, then Ready. A refresh temporarily leaves readiness while target storage is replaced. Inspect the original Branch for completion:

kubectl -n demo get branch kafka-dev
kubectl -n demo get branch kafka-dev -o yaml

status.resources references the cloned PVCs, auth Secret, and action Job when present. status.snapshot records the strategy and generation. Readiness includes configured preparation; the target database becoming ready alone does not establish that its post-actions have finished.