Taking Snapshots of AKS Persistent Volumes

I ended up writing couple of scripts this weekend to manage snapshots of Azure Disks attached to AKS Nodes. First script goes through all thePersistentVolume objects in AKS (default context, all namespaces) and tries to take an incremental snapshot. A new snapshot is created every Monday, otherwise an incremental backup is taken on the existing snapshot. Second script goes through all snapshots in a resource group and deletes the ones older than the expiry date. They depend on bash, jq, kubectl, and az.

Written on April 6, 2020