Replicate / synchronise kubernetes PV data across seperate kubernetes clusters

2.5k Views Asked by At

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.

3

There are 3 best solutions below

2
Narain On

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?

1
mario On

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.

0
Roman Gherta On

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