Skip to content

Kubernetes controller for velero that detects PVCs with no restic backup and exposes a prometheus metric

Notifications You must be signed in to change notification settings

bitsbeats/velero-pvc-watcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

velero-pvc-watcher

Build Status Go Report

velero-pvc-watcher is a Prometheus exporter that monitores all PVCs in the cluster and verifies that a matching backup.velero.io/backup-volumes or a backup.velero.io/backup-volumes-excludes is set.

Note: Due to the design all unmounted PVCs will reported as not being backuped, since there is no configuration for them.

Installation

Helm Chart https://github.com/bitsbeats/helm-charts

helm repo add bitsbeats https://bitsbeats.github.io/helm-charts/
helm upgrade -i --namespace <YOUR NAMESPACE> bitsbeats/velero-pvc-watcher

You can now scrape the metrics directly via prometheus kubernetes discovery, annotations:

annotation default value
prometheus.io/scrape true
prometheus.io/port 2112
prometheus.io/path /metrics

Example StatefulSet config

Note: The names come from pod.spec.volumes, not the pvc name.

apiVersion: apps/v1
kind: StatefulSet
spec:
  template:
    metadata:
      annotations:
        backup.velero.io/backup-volumes: data,logging
        backup.velero.io/backup-volumes-excludes: tmp

Example PVC config

To exclude a PVC that is not in use from backups annotate it as follows:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    backup.velero.io/backup-excluded: "true"

Example Alertmanager config


alert: Velero PVC Check
for: 10m
expr: |
  backupmonitor_missing != 0
labels:
  severity: warning
annotations:
  text: >-
    The pvc {{ $labels.pvc_name }} in namespace {{ $labels.namespace }} has no backup annotation.
  action: >-
    Either configure a backup or exclude the volume from backup. For more
    information visit https://github.com/bitsbeats/velero-pvc-watcher

About

Kubernetes controller for velero that detects PVCs with no restic backup and exposes a prometheus metric

Resources

Stars

Watchers

Forks

Packages

No packages published