Skip to content

Instantly share code, notes, and snippets.

@seidler2547
Last active March 18, 2026 12:08
Show Gist options
  • Select an option

  • Save seidler2547/c90667dcdb2b038f51eec3faac41024f to your computer and use it in GitHub Desktop.

Select an option

Save seidler2547/c90667dcdb2b038f51eec3faac41024f to your computer and use it in GitHub Desktop.
CephFS CSI Kubernetes Backup to Proxmox Backup Server
#!/bin/bash
# this is just an example, better source this from a .env file or via cron/other means
export PBS_PASSWORD=password
export PBS_REPOSITORY=k8sbackup@pbs@pbs:backup
ROOTNS=k8s
cd /mnt/pve/cephfs/volumes/csi
for d in csi-vol-*
do
cd $d
NS="$(grep 'csi.storage.k8s.io/pvc/namespace = ' .meta | sed -e 's/^.* = //')"
PVC="$(grep 'csi.storage.k8s.io/pvc/name = ' .meta | sed -e 's/^.* = //')"
/usr/bin/proxmox-backup-client namespace create "${ROOTNS}/${NS}"
/usr/bin/proxmox-backup-client backup "${PVC}.pxar:$PWD" --backup-id="${PVC}" --backup-type=ct --ns "${ROOTNS}/${NS}"
cd -
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment