# Overview

Backup and Recovery Recover Workloads in Case of a Disaster

# Backup & Restore with velero

To backup and restore your kubernetes resources kube+ provides velero, an open source backup and restore tool. If you haven't installed the velero CLI yet, you can find further instructions here velero CLI Installation.

NOTE: Because Velero is provided in the system namespace velero on the Kube+ platform you will always have to specify the Velero namespace itself when using the CLI with -n velero. Alternatively you can overwrite the system namespace for Velero via ENV variable:
export VELERO_NAMESPACE=velero

# Backup

You can create backups of all the Kubernetes resources and data by running the commands as follows:

$ velero -n velero backup create <MY_BACKUPNAME> \
        --include-namespaces <YOUR_NAMESPACE> 

Backup request "<MY_BACKUPNAME>" submitted successfully.
Run `velero backup describe <MY_BACKUPNAME>` or `velero backup logs <MY_BACKUPNAME>` for more details.

NOTE: You can also exclude resources like --exclude-resources replicasets.apps

You can check the progress of the backup by running the following command:

$ velero -n velero backup describe <MY_BACKUPNAME>

Name:         <MY_BACKUPNAME>
Namespace:    velero
Labels:       velero.io/storage-location=default
Annotations:  velero.io/source-cluster-k8s-gitversion=v1.20.7-eks-d88609
              velero.io/source-cluster-k8s-major-version=1
              velero.io/source-cluster-k8s-minor-version=20+

Phase:  InProgress (run `velero backup logs <MY_BACKUPNAME>` for more information)

Errors:    0
Warnings:  0

Namespaces:
  Included:  demo
  Excluded:  <none>

Resources:
  Included:        *
  Excluded:        <none>
  Cluster-scoped:  auto

Label selector:  <none>

Storage Location:  default

Velero-Native Snapshot PVs:  auto

TTL:  720h0m0s

Hooks:  <none>

Backup Format Version:  1.1.0

Started:    2021-11-11 13:15:05 +0100 CET
Completed:  2021-11-11 13:15:05 +0100 CET

Expiration:  2021-12-11 13:15:05 +0100 CET

Velero-Native Snapshots: <none included>

Once the backup has completed you can also check the logs of the backup by running:

$ velero -n velero backup logs <MY_BACKUPNAME>

This command can be useful for troubleshooting any backup issues.

The backups will be stored in the storage provider you are using, but you can also download the backup by running:

$ velero -n velero backup download <MY_BACKUPNAME>

NOTE: This download will not include the disk snapshots but will include the Kubernetes resources and metadata relating to the disk snapshots.

# Scheduling Backups

If you wish to run a backup on a schedule, run the commands as follows:

$ velero -n velero schedule create bugsnag-backup-namespace-daily \
        --include-namespaces <YOUR_NAMESPACE> \
        --schedule "0 7 * * *" &&

# Restore

You can get a list of the backups by running:

$ velero -n velero backup get

For restoring you can run the following command to restore a specific backup by name:

$ velero -n velero restore create --from-backup <MY_BACKUP>

Like with backups you can check the progress of a restore using the following:

$ velero -n velero restore describe <RESTORE_NAME>

Once the restore has completed you can check the logs of the restore by running:

$ velero -n velero restore logs <RESTORE_NAME>

This command can be useful for troubleshooting any restore issues.

# Restoring scheduled backups

For restoring scheduled backups you can either follow the above instructions if you wish to specify the backup name.
However if you wish to restore from the latest successful backup triggered by schedule <SCHEDULE-NAME> you can do so by running:

$ velero -n velero restore create --from-schedule <SCHEDULE-NAME>
Last Updated: 6/16/2022, 1:30:36 PM