Create script for cockroach db daily backup to kubernetes to GCP storage

12/26/2018

I have deployed Cockroach db database in google Kubernetes engine, and now i want to backup that database daily purpose. I want to backup database from Kubernetes and upload that database dump to my google storage bucket. Suggest me if anyone have any idea about it.

-- Vishal
cockroachdb
google-cloud-platform
kubernetes

1 Answer

1/1/2019

Yes, it is possible to perform a daily backup of a database in GKE. There are different approaches.

The easiest solution is to just write a little script that executes pg_dump to export the database directly to Google Cloud Storage. Containerize the script, run it as a job. Run the job everyday.

To run the job every day, you would have to write a cron job pod. Hence, the job will be performed every day. The database will be backed-up everyday.

-- Mahmoud Sharif
Source: StackOverflow