New to KubeDB? Please start here.

MSSQL Server Branching Overview

KubeDB Courier creates independent MSSQL Server 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-replica Availability Group. Courier clones the member volumes, and KubeDB recovers an independent Availability Group with its own endpoints.

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: mssql-dev
  namespace: demo
spec:
  source:
    databaseRef:
      apiGroup: kubedb.com
      kind: MSSQLServer
      name: mssql-source
    namespace: demo
  target:
    namespace: dev
    name: mssql-dev
    storageClassName: ceph-rbd
    resources:
      requests:
        cpu: '1'
        memory: 3Gi
      limits:
        memory: 3Gi
    issuerRef:
      apiGroup: cert-manager.io
      kind: Issuer
      name: mssql-source-ca
  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.

Every example provides target.issuerRef, because SQL Server requires certificates for its supporting components even when client TLS is disabled. The issuer and its signing Secret must exist in dev on the target cluster.

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 mssql-dev
kubectl -n demo get branch mssql-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.