2

Can I replicate data between Kubernetes PV into two separate clusters situated in different data centers?

I have a cluster with associated PV running in Primary site. I have a separate cluster running in DR site.

How do I continuously replicate data in primary site to DR site so that when application is running from from DR? The data written to PR PVs are available in DR.

Application writes files to the PV like xls, csv etc.

I can use any OSS storage orchestrator like openebs, rook, storageos etc.

Database is outside of kubernetes.

Wytrzymały Wiktor
  • 11,492
  • 5
  • 29
  • 37
Vij P
  • 57
  • 5

3 Answers3

1

Narain is right. Kubernetes doesn't contain any functionality that would allow you to synchronize two PVs used by two different clusters. So you would need to find your own solution to synchronize those two filesystems. It can be an existing solution like lsyncd, proposed in this thread or any custom solution like the above mentioned rsync which can be wrapped into a simple bash script and run periodically in cron.

mario
  • 9,858
  • 1
  • 26
  • 42
0

Forget Kubernetes for some time. End of the day, you are talking sync files between two storages. Mounting it into Kubernetes as PV is just your choice. So it can be as simple as a rsync setup between two storages?

Narain
  • 872
  • 9
  • 11
  • I have hears that rook with rbdmirroring , netapp with trident as storage class can help acheive. – Vij P Nov 21 '21 at 10:19
  • 1
    Hi VijP, Yeah there could be multiple solution to keep storage in-sync, but it outside scope of kubernetes. Check Mario referred thread or raise a question specifically on how to sync storages, you might get better options. This question sounds like directed to kubernetes community and they might not have much answers. – Narain Nov 23 '21 at 12:22
0

You can replicate same PV across different nodes within same cluster using openEBS Replicated Volumes as long as you are using a proper openebs engine.

https://openebs.io/docs/#replicated-volumes

Roman Gherta
  • 821
  • 2
  • 15
  • 27