Skip to content

Instantly share code, notes, and snippets.

@veerendra2
Created September 4, 2022 20:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veerendra2/3be97b8dfd0c7085127511546de2f855 to your computer and use it in GitHub Desktop.
Save veerendra2/3be97b8dfd0c7085127511546de2f855 to your computer and use it in GitHub Desktop.
Velero CLI Cheatsheet
## Show backups with label
$ velero backup get --show-labels
## Show backups based on labels
$ velero backup get -l velero.io/storage-location=wiki-demo
## Remove backups based on labels
$ velero backup delete -l ”velero.io/schedule-name=wiki-demo”
## Show Velero logs
$ kubectl logs deployment/velero -n velero
## Show backup logs
$ velero backup describe [backup name] –details
## Delete backup
$ velero backup delete [backup name] (add --confirm to skip prompt)
## Remove backups in deleting state
$ kubectl -n velero delete backup.velero.io [backup name]
## Remove all backups
$ kubectl -n velero delete backup.velero.io --all
## Remove backup location
$ kubectl -n velero delete backupstoragelocation [backup location name]
## Show backup location
$ velero backup-location get
## Create restore job from backup
$ velero restore create –from-backup [backup name]
## Create scheduled backup every 5 min
$ velero schedule create wiki-demo --schedule=”*/5 * * * *” --storage-location wiki-demo --include-namespaces wiki-demo
## Set backup location in read only
$ kubectl patch backupstoragelocation [backup location name] --namespace velero --type merge --patch '{”spec”:{”accessMode”:”ReadOnly”}}'
## Restore backup location to read and write
$ kubectl patch backupstoragelocation [backup location name] --namespace velero --type merge --patch '{”spec”:{”accessMode”:”ReadWrite”}}'
## Delete backup-location
$ kubectl -n velero delete backupstoragelocation NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment