Setup A-SYNC DR Fast and Easy with simulation

Pre-requisites:-

  • 2 Separate Portworx clusters on 2 Kubernetes Clusters
  • Portworx Enterprise + DR Licence on both Portworx Clusters
  • Clusters are configured with Secrets Provider such as Kubernetes Secrets / AWS KMS / VAULT etc.

The setup has 3 Parts as follows:-

  1. Cluster Pairing
  2. Schedule Policy
  3. Migration Schedules

Test Environment:

  • Site-A - Primary Site, where applications are currently hosted.
  • Site-B - Disaster Recovery Site, where applications will be migrated.
  • Postgres Application using PX volume running on Site A as a Deployment in postgresns namespace.

Common Steps for both Sites Clusters:

  1. Install Storkctl command line on the Kubernetes Client.

STORK_POD=$(kubectl get pods -n kube-system -l name=stork -o jsonpath='{.items[0].metadata.name}') && kubectl cp -n kube-system $STORK_POD:/storkctl/linux/storkctl ./storkctl sudo mv storkctl /usr/local/bin && sudo chmod +x /usr/local/bin/storkctl

  1. Setup credentials to create and access S3 bucket in AWS from one of the nodes.

/opt/pwx/bin/pxctl credentials create --provider s3 --s3-access-key <aws_access_key> --s3-secret-key <aws_secret_key> --s3-region us-east-1 --s3-endpoint s3.amazonaws.com clusterPair_<UUID_of_destination_cluster>

On Site-A cluster:

A1. Generate ClusterPair on the DR Site-B Cluster.
A2. Copy the generated ClusterPair spec (B1) to Site-A, add the required info obtained from B2 and apply it.
kubectl create -f async_clusterpair.yaml

A3. Create SchedulePolicy referring to Docs for A-Sync DR
A4. Create MigrationSchedule referring to Docs for A-Sync DR

Listing and verifying the resources created:-

A5. storkctl get migration -n postgresns
A6. kubectl get migration -n postgresns
A7. kubectl describe migrations -n postgresns
A8. kubectl get migrationschedule -n postgresns
A9. kubectl get schedules

Simulate Disaster on Site A:-
storkctl suspend migrationschedules -n postgresns -c postgrescp

On Site-B (DR) Cluster:-

B1.Generate ClusterPair
storkctl generate clusterpair -n postgresns postgrescp > async_clusterpair.yaml

B2. Any one of the IP-Address of the nodes in Site-B
pxctl status --json | grep "Data IP"
pxctl cluster token show

Activating DR Site-B and verifying Application Resources

B3. storkctl activate migration -n postgresns
B4. kubectl get all -n postgresns
B5. kubectl get pvc -n postgresns