Andrea Casarin

Andrea Casarin

Published on: 4/9/2022, 10:04:17 AM - Reading time: 1 minute

Backup Kubernetes volumes in AWS

When using Kops on AWS to deploy your Kubernetes cluster you'll find yourself with multiple elastic block storage volumes which are the PersistentVolumeClaim implementation on AWS. Snapshots are then a great way to provide backups, and especially so if coupled with lifecycle manager which can define your backup schedule and retention.

Usually when defining a life-cycle policy you create a tag filter to select specifics volumes and then a schedule to snapshot them and how many you want to keep.

So it would be great to add tags to volumes provisioned by Kubernetes that way you could create a life cycle policy to backup them automatically when marked with a specific tag.

Unfortunately that's currently not possible on the standard provisioner:

But you can use the AWS EBS CSI driver instead of the k8s in-tree one (which looks like will be deprecated one day), then you can add tags this way:

In fact the AWS EBS CSI provisioner ability to add extra tags got merged to master branch sometime in 2019 (