# Backing up CrateDB in Kubernetes using Velero?

**URL:** https://community.cratedb.com/t/backing-up-cratedb-in-kubernetes-using-velero/1377
**Category:** Integrations
**Created:** [February 14, 2023, 10:36am UTC](https://community.cratedb.com/t/backing-up-cratedb-in-kubernetes-using-velero/1377 "2023-02-14T10:36:23Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jogu](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jogu](https://community.cratedb.com/u/jogu)
#### Post date: [February 14, 2023, 10:36am UTC](https://community.cratedb.com/t/backing-up-cratedb-in-kubernetes-using-velero/1377/1 "2023-02-14T10:36:23Z")

</div>

Hello!

I have been trying to find information about how to back up CrateDB when it runs in a Kubernetes cluster using the tool Velero for backups.  
I am concerned about how to ensure that you have a consistent backup of CrateDB if you do snapshots of volumes where the database files reside.  
Does anyone have an example of doing backup of CrateDB using Velero?

Best regards,  
Johan

---

<div class="post-metadata">

### Author: ![Walter\_Behmann](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/walter_behmann/32/117_2.png) [@Walter\_Behmann](https://community.cratedb.com/u/Walter_Behmann)
#### Post date: [February 14, 2023, 10:56am UTC](https://community.cratedb.com/t/backing-up-cratedb-in-kubernetes-using-velero/1377/2 "2023-02-14T10:56:59Z")

</div>

Hello Johan,  
thank you for reaching out to us!

Snapshot Backups of the underlying PV (disk snapshotting) are **problematic**.

We recommend using the [built-in](https://crate.io/blog/backing-up-and-restoring-cratedb) Backup, which takes care of cluster coordination, allows for setting Full Backups, Differentials on a repository level, single table restore, restore to the same cluster, or another cluster.

There are several options for the backup _repository_ (eg. a S3 bucket), depending on your requirements.

Please let me know if there are any specific question where we could help you.

Best regards,  
Walter

---

<div class="post-metadata">

### Author: ![jogu](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jogu](https://community.cratedb.com/u/jogu)
#### Post date: [February 14, 2023, 11:34am UTC](https://community.cratedb.com/t/backing-up-cratedb-in-kubernetes-using-velero/1377/3 "2023-02-14T11:34:24Z")

</div>

Thanks Walter!

I will look into the built-in backup some more.

Kind regards,  
Johan

---

<div class="post-metadata">

### Author: ![Walter\_Behmann](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/walter_behmann/32/117_2.png) [@Walter\_Behmann](https://community.cratedb.com/u/Walter_Behmann)
#### Post date: [February 14, 2023, 1:41pm UTC](https://community.cratedb.com/t/backing-up-cratedb-in-kubernetes-using-velero/1377/4 "2023-02-14T13:41:30Z")

</div>

Johan,  
let me know if there is anything around this we can help you with. It should be quite straight forward.

What you could do:

- is setup a k8s cronjob,
- on the backup it self, you would start by adding a _backup repository_. In case of k8s best option would be to write to an S3 compatible endpoint outside the k8s cluster, or eventually an azure storage blob. Minio would be an option here also, which you could eventually run inside k8s.
- then _create snapshot_ is next (this is probably the statement run by cronjob
- to monitor it, you could fancy `sql_exporter` and expose the _lastbackup_ as a metric eg. for prometheus [GitHub - burningalchemist/sql\_exporter: Database agnostic SQL exporter for Prometheus](https://github.com/burningalchemist/sql_exporter)

`create snapshot` does trigger a FULL, with subsequent incremental backups. By deleting the oldest backup you can maintain backup versions. Think about each snapshot like a _virtual full_. I am getting to fancy now 🙂

Hope that helps.

Best regards,  
Walter

---

<div class="post-metadata">

### Author: ![jogu](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jogu](https://community.cratedb.com/u/jogu)
#### Post date: [February 14, 2023, 2:12pm UTC](https://community.cratedb.com/t/backing-up-cratedb-in-kubernetes-using-velero/1377/5 "2023-02-14T14:12:24Z")

</div>

Vielen Dank Walter!

I will look into that. 👍

Best regards,  
Johan
