New to KubeDB? Please start here.
Branch Neo4j Across Clusters
Cross-cluster branching creates an independent Neo4j deployment on another Kubernetes cluster from a point-in-time snapshot of an existing deployment. Use it to prepare development, testing, or data analysis environments on a separate cluster using existing data.
The branch accepts independent reads and writes without changing the source. Source changes are not continuously replicated; scheduled refreshes can replace branch data with fresh source snapshots.
Before You Begin
- Read the branching overview.
- Complete Courier setup, including KubeDB and the Branch CRD. Use branching-capable Courier, provisioner, and database images.
- Ensure
Neo4jVersion2025.12.1is available in your installed catalog. - Use Ceph RBD storage with copy-on-write cloning, compatible VolumeSnapshot and VolumeGroupSnapshot classes, and the corresponding CSI APIs, controllers, and driver support.
- Review the snapshot requirements. Your account must be able to create databases and Branches, read auth Secrets, inspect snapshots and Jobs, and open pod shells.
- Allow capacity for three source and three target database pods, each requesting 2Gi of memory, plus operators and action Jobs.
- Have existing OCM registration for managed clusters
sourceandtarget, with Courier agents enabled and kubectl contextshub,source, andtarget. - Both clusters must access the same network-reachable Ceph backend, with compatible CSI identities, pool settings, and credentials. Matching StorageClass names alone do not provide shared snapshots.
The source uses demo; the target uses dev. Replace ceph-rbd consistently if your Ceph StorageClass has another name. Reserve the tutorial names and create namespaces if they do not already exist:
kubectl --context source create namespace demo
kubectl --context target create namespace dev
Check the existing registration and storage classes:
kubectl --context hub get managedclusters source target
kubectl --context source get storageclass ceph-rbd
kubectl --context target get storageclass ceph-rbd
Deploy the source database
Save the following as neo4j-source.yaml. It creates a three-server cluster:
apiVersion: kubedb.com/v1alpha2
kind: Neo4j
metadata:
name: neo4j-source
namespace: demo
spec:
version: 2025.12.1
replicas: 3
podTemplate:
spec:
containers:
- name: neo4j
resources:
requests:
cpu: 500m
memory: 2Gi
limits:
memory: 2Gi
storageType: Durable
storage:
storageClassName: ceph-rbd
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 4Gi
deletionPolicy: WipeOut
kubectl --context source -n demo apply -f neo4j-source.yaml
kubectl --context source -n demo wait neo4j/neo4j-source --for=jsonpath='{.status.phase}'=Ready --timeout=30m
Use the Enterprise server catalog entry for this cluster. The client examples select database neo4j and use routing so writes reach its leader.
Seed and inspect the source data
Discover the auth Secret referenced by neo4j-source:
kubectl --context source -n demo get neo4j neo4j-source -o jsonpath='{.spec.authSecret.name}{"\n"}'
neo4j-source-auth
Use the returned name below if it differs. Read its password:
kubectl --context source -n demo get secret neo4j-source-auth -o jsonpath='{.data.password}' | base64 -d
Enter this password when the client prompts.
From your terminal, open a pod shell:
kubectl --context source -n demo exec -it neo4j-source-0 -c neo4j -- bash
Inside the pod, start the client through the writable database Service:
cypher-shell -a neo4j://neo4j-source.demo.svc:7687 -u neo4j -d neo4j --format plain
Enter Cypher at the client prompt. neo4j:// discovers the cluster’s writer; a direct bolt:// connection to an arbitrary member can reject writes.
Create five customers. Expected results below omit connection banners and are formatted for readability.
CREATE (c1:Customer {id: 1, full_name: "Customer 1", email: "[email protected]"}),
(c2:Customer {id: 2, full_name: "Customer 2", email: "[email protected]"}),
(c3:Customer {id: 3, full_name: "Customer 3", email: "[email protected]"}),
(c4:Customer {id: 4, full_name: "Customer 4", email: "[email protected]"}),
(c5:Customer {id: 5, full_name: "Customer 5", email: "[email protected]"});
CALL db.checkpoint();
db.checkpoint() is provided by the Enterprise server used here. Committed transaction logs still support recovery when the cloned database starts.
MATCH (c:Customer) RETURN c.id AS id, c.full_name AS full_name, c.email AS email ORDER BY id;
id, full_name, email
1, "Customer 1", "[email protected]"
2, "Customer 2", "[email protected]"
3, "Customer 3", "[email protected]"
4, "Customer 4", "[email protected]"
5, "Customer 5", "[email protected]"
Run :exit to leave cypher-shell, then exit to leave the pod shell.
Create the cross-cluster Branch
Save the following as neo4j-cross.yaml:
apiVersion: courier.kubedb.com/v1alpha1
kind: Branch
metadata:
name: neo4j-cross
namespace: demo
spec:
source:
databaseRef:
apiGroup: kubedb.com
kind: Neo4j
name: neo4j-source
namespace: demo
target:
namespace: dev
name: neo4j-cross
storageClassName: ceph-rbd
resources:
requests:
cpu: 500m
memory: 2Gi
limits:
memory: 2Gi
clusterName: target
deletionPolicy: Delete
kubectl --context source -n demo apply -f neo4j-cross.yaml
kubectl --context source -n demo wait branch/neo4j-cross --for=condition=Ready --timeout=60m
kubectl --context source -n demo get branch neo4j-cross
The Branch is created on source. Courier sends the target resource manifests through the OCM hub; the target KubeDB provisioner creates the database using the delivered cloned PVCs. target.clusterName is the OCM ManagedCluster name.
kubectl --context hub -n source get branchworks
kubectl --context hub -n target get manifestworks
kubectl --context target -n dev get neo4j neo4j-cross
Verify the copied data
Discover the auth Secret referenced by neo4j-cross:
kubectl --context target -n dev get neo4j neo4j-cross -o jsonpath='{.spec.authSecret.name}{"\n"}'
neo4j-cross-auth
Use the returned name below if it differs. Read its password:
kubectl --context target -n dev get secret neo4j-cross-auth -o jsonpath='{.data.password}' | base64 -d
Enter this password when the client prompts.
From your terminal, open a pod shell:
kubectl --context target -n dev exec -it neo4j-cross-0 -c neo4j -- bash
Inside the pod, start the client through the writable database Service:
cypher-shell -a neo4j://neo4j-cross.dev.svc:7687 -u neo4j -d neo4j --format plain
Enter Cypher at the client prompt. neo4j:// discovers the cluster’s writer; a direct bolt:// connection to an arbitrary member can reject writes.
MATCH (c:Customer) RETURN c.id AS id, c.full_name AS full_name, c.email AS email ORDER BY id;
id, full_name, email
1, "Customer 1", "[email protected]"
2, "Customer 2", "[email protected]"
3, "Customer 3", "[email protected]"
4, "Customer 4", "[email protected]"
5, "Customer 5", "[email protected]"
Run :exit to leave cypher-shell, then exit to leave the pod shell.
Inspect target resources
kubectl --context target -n dev get pods,pvc -l app.kubernetes.io/instance=neo4j-cross
Discover the auth Secret referenced by neo4j-cross:
kubectl --context target -n dev get neo4j neo4j-cross -o jsonpath='{.spec.authSecret.name}{"\n"}'
neo4j-cross-auth
Use the returned name below if it differs. Read its password:
kubectl --context target -n dev get secret neo4j-cross-auth -o jsonpath='{.data.password}' | base64 -d
Enter this password when the client prompts.
From your terminal, open a pod shell:
kubectl --context target -n dev exec -it neo4j-cross-0 -c neo4j -- bash
Inside the pod, start the client through the writable database Service:
cypher-shell -a neo4j://neo4j-cross.dev.svc:7687 -u neo4j -d neo4j --format plain
Enter Cypher at the client prompt. neo4j:// discovers the cluster’s writer; a direct bolt:// connection to an arbitrary member can reject writes.
SHOW SERVERS YIELD address, state, health RETURN address, state, health;
SHOW DATABASES YIELD name, address, writer, currentStatus RETURN name, address, writer, currentStatus;
Expect three branch server addresses, available servers, and online databases with a writer for neo4j.
Run :exit to leave cypher-shell, then exit to leave the pod shell.
Verify independent writes
Change the branch
Discover the auth Secret referenced by neo4j-cross:
kubectl --context target -n dev get neo4j neo4j-cross -o jsonpath='{.spec.authSecret.name}{"\n"}'
neo4j-cross-auth
Use the returned name below if it differs. Read its password:
kubectl --context target -n dev get secret neo4j-cross-auth -o jsonpath='{.data.password}' | base64 -d
Enter this password when the client prompts.
From your terminal, open a pod shell:
kubectl --context target -n dev exec -it neo4j-cross-0 -c neo4j -- bash
Inside the pod, start the client through the writable database Service:
cypher-shell -a neo4j://neo4j-cross.dev.svc:7687 -u neo4j -d neo4j --format plain
Enter Cypher at the client prompt. neo4j:// discovers the cluster’s writer; a direct bolt:// connection to an arbitrary member can reject writes.
MATCH (c:Customer {id: 5}) SET c.full_name = "Branch-only Customer 5";
CALL db.checkpoint();
MATCH (c:Customer) RETURN c.id AS id, c.full_name AS full_name, c.email AS email ORDER BY id;
id, full_name, email
1, "Customer 1", "[email protected]"
2, "Customer 2", "[email protected]"
3, "Customer 3", "[email protected]"
4, "Customer 4", "[email protected]"
5, "Branch-only Customer 5", "[email protected]"
Run :exit to leave cypher-shell, then exit to leave the pod shell.
Change and inspect the source
Discover the auth Secret referenced by neo4j-source:
kubectl --context source -n demo get neo4j neo4j-source -o jsonpath='{.spec.authSecret.name}{"\n"}'
neo4j-source-auth
Use the returned name below if it differs. Read its password:
kubectl --context source -n demo get secret neo4j-source-auth -o jsonpath='{.data.password}' | base64 -d
Enter this password when the client prompts.
From your terminal, open a pod shell:
kubectl --context source -n demo exec -it neo4j-source-0 -c neo4j -- bash
Inside the pod, start the client through the writable database Service:
cypher-shell -a neo4j://neo4j-source.demo.svc:7687 -u neo4j -d neo4j --format plain
Enter Cypher at the client prompt. neo4j:// discovers the cluster’s writer; a direct bolt:// connection to an arbitrary member can reject writes.
MATCH (c:Customer {id: 1}) SET c.full_name = "Updated Customer 1";
CALL db.checkpoint();
MATCH (c:Customer) RETURN c.id AS id, c.full_name AS full_name, c.email AS email ORDER BY id;
id, full_name, email
1, "Updated Customer 1", "[email protected]"
2, "Customer 2", "[email protected]"
3, "Customer 3", "[email protected]"
4, "Customer 4", "[email protected]"
5, "Customer 5", "[email protected]"
Run :exit to leave cypher-shell, then exit to leave the pod shell.
The source retains the original customer 5; the branch edit did not reach it.
Check the branch again
Discover the auth Secret referenced by neo4j-cross:
kubectl --context target -n dev get neo4j neo4j-cross -o jsonpath='{.spec.authSecret.name}{"\n"}'
neo4j-cross-auth
Use the returned name below if it differs. Read its password:
kubectl --context target -n dev get secret neo4j-cross-auth -o jsonpath='{.data.password}' | base64 -d
Enter this password when the client prompts.
From your terminal, open a pod shell:
kubectl --context target -n dev exec -it neo4j-cross-0 -c neo4j -- bash
Inside the pod, start the client through the writable database Service:
cypher-shell -a neo4j://neo4j-cross.dev.svc:7687 -u neo4j -d neo4j --format plain
Enter Cypher at the client prompt. neo4j:// discovers the cluster’s writer; a direct bolt:// connection to an arbitrary member can reject writes.
MATCH (c:Customer) RETURN c.id AS id, c.full_name AS full_name, c.email AS email ORDER BY id;
id, full_name, email
1, "Customer 1", "[email protected]"
2, "Customer 2", "[email protected]"
3, "Customer 3", "[email protected]"
4, "Customer 4", "[email protected]"
5, "Branch-only Customer 5", "[email protected]"
Run :exit to leave cypher-shell, then exit to leave the pod shell.
The branch retains its own customer 5 and the original customer 1. The source update did not reach it.
Cleanup
Delete the Branch on the source cluster first. Let Courier remove its target and snapshots before deleting the source:
kubectl --context source -n demo delete branch neo4j-cross --wait=true --timeout=30m
kubectl --context source -n demo delete neo4j neo4j-source --wait=true --timeout=30m
Keep Courier, CSI, the shared backend, and OCM when used available until cleanup completes. These commands leave the namespaces in place.

































