Prometheus backup

From UVOO Tech Wiki
Revision as of 07:21, 1 February 2025 by Busk (talk | contribs)
Jump to navigation Jump to search

https://devopstales.github.io/kubernetes/backup-and-retore-prometheus/

/data or /var/lib/prometheus

cat backup-resore.sh
kubectl exec -n monitoring <prometheus-pod-name> -- curl -X POST http://localhost:9090/api/v1/admin/tsdb/snapshot

kubectl cp monitoring/<prometheus-pod-name>:/data/snapshots ./prometheus-snapshots

or shutdown

kubectl scale deployment prometheus-server --replicas=0 -n monitoring

kubectl cp monitoring/<prometheus-pod-name>:/data ./prometheus-backup

kubectl scale deployment prometheus-server --replicas=1 -n monitoring

or using snapshot pvc

az snapshot create --resource-group myResourceGroup --source myDisk --name prometheus-snapshot