Backup Kubernetes Object to AWS S3 using Heptio Velero(Ark)

In this post i’ll show how to backup Kubernetes objects to AWS S3 and restoring this backup to another cluster or same cluster. This allows us to copy,move,restore our objects.

First of we need Velero in our system to do that download Velero binary (or we can make).

$ wget && tar -xvf velero-v1.0.0-linux-amd64.tar.gz

After that we have binary we need to install velero server to our cluster.

BTW: we dont need any cluster inside AWS. This credentials for backup objects. For this blog post i created DigitalOcean Kubernetes.

Velero is running yay!. Lets backup some objects. Every velero tutorial is using nginx backup and hey lets run nginx.
Lets see our backup location.

Velero github repo has example nginx yaml. Lets apply this. This yaml will create namespace,deployment and loadbalancer service for nginx. You may having problem with nginx:1.7.9 lets change it to latest for deployment.

Now we can create backup. For creating backup we are going to use velero binary

As we can see our backup is completed. Lets check out logs

Nice. Lets look our s3 bucket to see whats inside.

These files contains our deployment,service,namespace and our app logs json.

$kubectl delete namespace nginx-example
namespace “nginx-example” deleted

We already have backup so lets restore it. Also we can select different namespace to restore this.

As you can see restore completed.
If we will use persistent volumes this volume snapshot also will be restored. Have you noticed deployment pod names are same with backup.

This entry was posted in Kubernetes and tagged , , , . Bookmark the permalink.

Leave a Reply