
DR-Syncer provides tools designed to automate and simplify disaster recovery synchronization between Kubernetes clusters.
Organizations running Kubernetes in production face several challenges when establishing and maintaining disaster recovery environments:
Inconsistent state between clusters
Resource Management Complexity
Selective resource synchronization complications
Operational Overhead
DR-Syncer addresses these challenges by providing automated synchronization of resources from source namespaces to destination namespaces in remote clusters. It enables reliable disaster recovery setups with minimal operational overhead.
DR-Syncer offers two distinct tools to handle disaster recovery synchronization:
Supports continuous, scheduled, and manual synchronization modes
CLI: A standalone command-line tool for direct, on-demand synchronization operations
Both tools maintain feature parity for the core synchronization capabilities, but are used in different contexts and deployment models.
DR-Syncer follows the Kubernetes operator pattern:
RemoteCluster: Defines remote cluster configuration and authenticationReplication: Defines synchronization configuration and resource filtering
Reconciliation Flow
Updates status and metrics
Synchronization Process
dr-syncer.io/scale-override)dr-syncer.io/ignore label)# Add the DR-Syncer Helm repository
helm repo add dr-syncer https://supporttools.github.io/dr-syncer/charts
# Update repositories
helm repo update
# Install DR-Syncer
helm install dr-syncer dr-syncer/dr-syncer \
--namespace dr-syncer-system \
--create-namespace
# Define a remote cluster
apiVersion: dr-syncer.io/v1alpha1
kind: RemoteCluster
metadata:
name: dr-cluster
spec:
kubeconfigSecret: dr-cluster-kubeconfig
---
# Define a replication
apiVersion: dr-syncer.io/v1alpha1
kind: NamespaceMapping
metadata:
name: production-to-dr
spec:
sourceNamespace: production
destinationNamespace: production-dr
destinationCluster: dr-cluster
resourceTypes:
- ConfigMap
- Secret
- Deployment
- Service
schedule: "0 */6 * * *" # Every 6 hours
For more comprehensive documentation, visit our documentation site.
The DR-Syncer CLI provides a simple way to perform disaster recovery operations directly from the command line without needing to deploy the controller.
Build the CLI binary:
make build
This will create the dr-syncer-cli binary in the bin/ directory.
The CLI supports three primary operation modes:
bin/dr-syncer-cli \
--source-kubeconfig=/path/to/source/kubeconfig \
--dest-kubeconfig=/path/to/destination/kubeconfig \
--source-namespace=my-namespace \
--dest-namespace=my-namespace-dr \
--mode=Stage
Stage mode synchronizes resources and scales down deployments to 0 replicas in the destination.
bin/dr-syncer-cli \
--source-kubeconfig=/path/to/source/kubeconfig \
--dest-kubeconfig=/path/to/destination/kubeconfig \
--source-namespace=my-namespace \
--dest-namespace=my-namespace-dr \
--mode=Cutover
Cutover mode synchronizes resources, scales down source deployments, and scales up destination deployments.
bin/dr-syncer-cli \
--source-kubeconfig=/path/to/source/kubeconfig \
--dest-kubeconfig=/path/to/destination/kubeconfig \
--source-namespace=my-namespace \
--dest-namespace=my-namespace-dr \
--mode=Failback
Failback mode scales down destination deployments and scales up source deployments.
The CLI supports many additional options for resource filtering, PVC data migration, and more:
bin/dr-syncer-cli \
--source-kubeconfig=/path/to/source/kubeconfig \
--dest-kubeconfig=/path/to/destination/kubeconfig \
--source-namespace=my-namespace \
--dest-namespace=my-namespace-dr \
--mode=Stage \
--include-custom-resources=true \
--migrate-pvc-data=true \
--resource-types=configmaps,secrets,deployments
For complete CLI documentation, refer to the CLI Usage Guide.
To run the controller locally for development:
run-local.sh script:./run-local.sh /path/to/controller/kubeconfig
The script handles: - Scaling down the in-cluster controller deployment to prevent conflicts - Setting the KUBECONFIG environment variable - Restoring the original deployment when you exit
Build the container:
make docker-build
Deploy the controller:
make deploy
The project uses GitHub Actions for CI/CD and follows semantic versioning for releases.
To create a new release:
Ensure all changes are committed and pushed to the main branch:
bash
git checkout main
git pull
Create an annotated tag following semantic versioning:
bash
git tag -a v1.0.0 -m "Release v1.0.0"
Push the tag to GitHub:
bash
git push origin v1.0.0
When a tag is pushed, the GitHub Actions pipeline automatically:
DR-Syncer follows Semantic Versioning:
X in vX.Y.Z): Incompatible API changes or major functionality changesY in vX.Y.Z): New features that are backward-compatibleZ in vX.Y.Z): Bug fixes and minor improvements that are backward-compatibleFor pre-release versions, use formats like:
- v1.0.0-alpha.1
- v1.0.0-beta.2
- v1.0.0-rc.1
If the remote cluster API calls seem excessive, check the logs for rapid cycling between states. The controller implements exponential backoff to reduce API load during failures.
When running locally, ensure you're using the proper kubeconfig with the necessary permissions:
./run-local.sh /path/to/controller/kubeconfig
Check the status of the Replication resource for error messages:
kubectl get replications -n <namespace> -o yaml
Verify the agent DaemonSet is running on remote clusters:
kubectl get daemonset -n dr-syncer-system --context=<remote-context>
Check agent logs for rsync or SSH errors:
kubectl logs -n dr-syncer-system -l app=dr-syncer-agent --context=<remote-context> --tail=100
If experiencing SSH authentication problems, check the secrets containing SSH keys:
kubectl get secret <remote-cluster>-ssh-key -n dr-syncer-system -o yaml
Always use --tail flag to limit log output:
kubectl logs pod-name --tail=100 # Last 100 lines
Never use -f/--follow in automated scripts or tests as these commands will never return and cause scripts to hang.
We welcome contributions from the community! Here's how you can get involved:
See CONTRIBUTING.md for details on contributing to DR-Syncer, including: - Code contribution guidelines - Pull request process - Development environment setup - Testing requirements
This project is licensed under the terms of the LICENSE file.
$ claude mcp add dr-syncer \
-- python -m otcore.mcp_server <graph>