DRCluster CRD
DRCluster CRD
Overview
The DRCluster custom resource represents a managed cluster registered for disaster recovery operations. It is a cluster-scoped resource created by administrators on the OCM hub cluster that provides:
- S3 configuration for storing PV metadata and cluster state
- Network fencing configuration for Sync (Metro)
- Cluster availability and fencing status
DRClusters are referenced by DRPolicy resources to define which clusters participate in DR relationships. Each managed cluster that participates in DR must have a corresponding DRCluster resource on the hub.
Lifecycle: Created during initial DR setup for each managed cluster. Long-lived resource that remains for the lifetime of the cluster’s DR participation.
API Group and Version
- API Group:
ramendr.openshift.io - API Version:
v1alpha1 - Kind:
DRCluster - Scope: Cluster
Spec Fields
Required Fields
s3ProfileName (string)
Name of the S3 profile (from RamenConfig) to use for this cluster.
Purpose:
- When applications are active on this cluster, their PV metadata is stored to S3 profiles of all peer clusters
- When applications failover/relocate TO this cluster, PV metadata is restored FROM this S3 profile
Requirements:
- The S3 profile name specified in DRCluster must match an S3 profile name defined in RamenConfig
- Immutable after creation
Example:
s3ProfileName: s3-profile-east
Optional Fields
cidrs ([]string)
List of CIDR strings for node IP addresses in this cluster.
Purpose: Used for network fencing operations in Sync (Metro) to isolate a failed cluster.
Example:
cidrs:
- "10.0.1.0/24"
When to set: Required for Sync (Metro) deployments where network fencing is needed.
clusterFence (ClusterFenceState)
Desired fencing state of the cluster.
Valid values:
Unfenced- Cluster is not fenced or should be unfenced (default/normal state; automated)Fenced- Cluster should be fenced (automated)ManuallyFenced- Cluster was manually fenced by adminManuallyUnfenced- Cluster was manually unfenced by admin
Example:
clusterFence: Unfenced
How it works: During failover in Sync (Metro), Ramen may fence the source cluster to prevent potential concurrent writes to storage.
Status Fields
phase (DRClusterPhase)
Current state of the DRCluster.
Values:
Available- DRCluster is available for DR operationsStarting- Initial reconciliation in progressFencing- Cluster fencing operation in progressFenced- Cluster has been successfully fencedUnfencing- Cluster unfencing operation in progressUnfenced- Cluster has been successfully unfenced
conditions ([]metav1.Condition)
Standard Kubernetes conditions.
Condition types:
Validated- DRCluster configuration has been validatedClean- No fencing CRs present in the clusterFenced- Fencing CR has been created for this cluster
maintenanceModes ([]ClusterMaintenanceMode)
Status of storage maintenance modes for this cluster.
Fields:
storageProvisioner- Storage provisioner typetargetID- Storage instance identifierstate- Maintenance mode state (Unknown, Error, Progressing, Completed)conditions- Maintenance mode conditions
Examples
Example 1: Basic Async (Regional) Cluster
DRCluster for Async (Regional):
apiVersion: ramendr.openshift.io/v1alpha1
kind: DRCluster
metadata:
name: east-cluster
spec:
# S3 profile for this cluster
s3ProfileName: s3-profile-east
Example 2: Sync (Metro) Cluster with Fencing
DRCluster for Sync (Metro) with network fencing:
apiVersion: ramendr.openshift.io/v1alpha1
kind: DRCluster
metadata:
name: metro-cluster-1
spec:
# S3 profile for this cluster
s3ProfileName: s3-profile-metro1
# Node CIDRs for network fencing
cidrs:
- "191.168.1.0/24"
- "191.168.1.0/24"
# Fencing state
clusterFence: Unfenced
Usage
Creating a DRCluster
Prerequisites:
- ManagedCluster resource exists in OCM
- S3 profile configured in RamenConfig
- Storage with replication support on the managed cluster
Steps:
Create S3 profile in RamenConfig (or verify it exists):
# In RamenConfig s3StoreProfiles: - s3ProfileName: s3-profile-east s3Bucket: ramen-dr-east s3CompatibleEndpoint: https://s1.us-east-1.amazonaws.com s3Region: us-east-1 s3SecretRef: name: s3-secret-east namespace: ramen-systemCreate the DRCluster:
kubectl apply -f drcluster.yamlVerify the DRCluster is validated:
kubectl get drcluster east-cluster -o yamlCheck for
Validatedcondition:status: phase: Available conditions: - type: Validated status: "True"
Fencing a Cluster (Sync (Metro))
To fence a cluster:
kubectl patch drcluster metro-cluster-1 --type merge -p '{"spec":{"clusterFence":"Fenced"}}'
To unfence a cluster:
kubectl patch drcluster metro-cluster-1 --type merge -p '{"spec":{"clusterFence":"Unfenced"}}'
S3 Configuration
How S3 Profiles Work
Each DRCluster has its own S3 profile because:
- Different clusters may use different S3 endpoints (regional, on-prem)
- S3 access credentials may differ per cluster
- Application metadata needs to be accessible if the source cluster is down
S3 Profile Requirements
For the S3 profile referenced by a DRCluster:
- Must be accessible from the managed cluster
- Should have appropriate capacity for PV metadata
- Credentials must have read/write permissions
Monitoring
Check DRCluster Status
kubectl get drcluster
kubectl describe drcluster east-cluster
Verify S3 Configuration
# Check if S3 profile is valid
kubectl get drcluster east-cluster -o jsonpath='{.spec.s3ProfileName}'
# Verify profile exists in RamenConfig
kubectl get cm ramen-hub-operator-config -n ramen-system -o yaml | grep s3ProfileName
Check Fencing State
kubectl get drcluster east-cluster -o jsonpath='{.status.phase}'
kubectl get drcluster east-cluster -o jsonpath='{.spec.clusterFence}'
View Maintenance Modes
kubectl get drcluster east-cluster -o jsonpath='{.status.maintenanceModes}' | jq
Troubleshooting
DRCluster Not Validated
Check status:
kubectl get drcluster east-cluster -o yaml
Common issues:
S3 profile not found
Verify the S3 profile name specified in DRCluster matches an S3 profile name defined in RamenConfig
Check RamenConfig:
kubectl get cm ramen-hub-operator-config -n ramen-system -o yaml
ManagedCluster not found
Verify managed cluster is registered:
kubectl get managedcluster east-cluster
Fencing Not Working
Check:
CIDRs configured:
kubectl get drcluster metro-cluster-1 -o jsonpath='{.spec.cidrs}'NetworkFence resources:
kubectl get networkfence -AFencing state:
kubectl get drcluster metro-cluster-1 -o jsonpath='{.status.phase}'
Cannot Delete DRCluster
Cause: DRPolicy still referencing it.
Check:
kubectl get drpolicy -o yaml | grep drClusters
Solution: Delete all DRPolicies referencing this DRCluster first.
Best Practices
Use names that match the ManagedCluster name:
metadata: name: us-east-prod-1 # Match ManagedCluster nameConfigure S3 profiles carefully:
- Test S3 connectivity before creating DRClusters
- Use separate S3 buckets per cluster or namespace objects properly
- Ensure credentials have appropriate permissions
Document CIDRs:
- Keep CIDR documentation updated
- Include all node network ranges
- Plan for cluster expansion
Monitor DRCluster status:
- Check
Validatedcondition after creation - Monitor
maintenanceModesduring DR operations - Watch fencing state during Sync (Metro) failovers
- Check
Test before production:
- Verify S3 access from managed clusters
- Test fencing operations in non-production
- Validate DRPolicy creation succeeds
Related Resources
- DRPolicy - References DRCluster to define DR topology
- DRClusterConfig - Managed cluster-side configuration
- Configuration Guide - How to configure S3 profiles
- Install Guide - Prerequisites for DR setup