Notes on Velero

Velero Install


#After installing the velero CLI, we deploy the server side component.
arathod@arathod-a01 velero-1.4.2 % kubectl apply -f examples/minio/00-minio-deployment.yaml
namespace/velero created
deployment.apps/minio created
service/minio created
job.batch/minio-setup created
arathod@arathod-a01 velero-1.4.2 % velero install \
--provider aws \
--plugins velero/velero-plugin-for-aws:v1.0.0 \
--bucket velero \
--secret-file ./credentials-velero \
--use-volume-snapshots=false \
--backup-location-config region=minio,s3ForcePathStyle="true",s3Url=http://minio.velero.svc:9000
CustomResourceDefinition/backups.velero.io: attempting to create resource
CustomResourceDefinition/backups.velero.io: created
CustomResourceDefinition/backupstoragelocations.velero.io: attempting to create resource
CustomResourceDefinition/backupstoragelocations.velero.io: created
CustomResourceDefinition/deletebackuprequests.velero.io: attempting to create resource
CustomResourceDefinition/deletebackuprequests.velero.io: created
CustomResourceDefinition/downloadrequests.velero.io: attempting to create resource
CustomResourceDefinition/downloadrequests.velero.io: created
CustomResourceDefinition/podvolumebackups.velero.io: attempting to create resource
CustomResourceDefinition/podvolumebackups.velero.io: created
CustomResourceDefinition/podvolumerestores.velero.io: attempting to create resource
CustomResourceDefinition/podvolumerestores.velero.io: created
CustomResourceDefinition/resticrepositories.velero.io: attempting to create resource
CustomResourceDefinition/resticrepositories.velero.io: created
CustomResourceDefinition/restores.velero.io: attempting to create resource
CustomResourceDefinition/restores.velero.io: created
CustomResourceDefinition/schedules.velero.io: attempting to create resource
CustomResourceDefinition/schedules.velero.io: created
CustomResourceDefinition/serverstatusrequests.velero.io: attempting to create resource
CustomResourceDefinition/serverstatusrequests.velero.io: created
CustomResourceDefinition/volumesnapshotlocations.velero.io: attempting to create resource
CustomResourceDefinition/volumesnapshotlocations.velero.io: created
Waiting for resources to be ready in cluster...
Namespace/velero: attempting to create resource
Namespace/velero: already exists, proceeding
Namespace/velero: created
ClusterRoleBinding/velero: attempting to create resource
ClusterRoleBinding/velero: created
ServiceAccount/velero: attempting to create resource
ServiceAccount/velero: created
Secret/cloud-credentials: attempting to create resource
Secret/cloud-credentials: created
BackupStorageLocation/default: attempting to create resource
BackupStorageLocation/default: created
Deployment/velero: attempting to create resource
Deployment/velero: created
Velero is installed! ⛵ Use 'kubectl logs deployment/velero -n velero' to view the status.

#Taking a look at the logs.
arathod@arathod-a01 velero-1.4.2 % kubectl logs deployment/velero -n velero
time="2020-09-16T05:14:44Z" level=info msg="setting log-level to INFO" logSource="pkg/cmd/server/server.go:177"
time="2020-09-16T05:14:44Z" level=info msg="Starting Velero server v1.4.2 (56a08a4d695d893f0863f697c2f926e27d70c0c5)" logSource="pkg/cmd/server/server.go:179"
time="2020-09-16T05:14:44Z" level=info msg="1 feature flags enabled []" logSource="pkg/cmd/server/server.go:181"
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=BackupItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/crd-remap-version
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=BackupItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/pod
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=BackupItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/pv
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=BackupItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/service-account
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=RestoreItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/add-pv-from-pvc
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=RestoreItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/add-pvc-from-pod
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=RestoreItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/change-pvc-node-selector
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=RestoreItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/change-storage-class
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=RestoreItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/cluster-role-bindings
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=RestoreItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/crd-preserve-fields
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=RestoreItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/job
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=RestoreItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/pod
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=RestoreItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/restic
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=RestoreItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/role-bindings
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=RestoreItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/service
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/velero kind=RestoreItemAction logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/service-account
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/plugins/velero-plugin-for-aws kind=VolumeSnapshotter logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/aws
time="2020-09-16T05:14:44Z" level=info msg="registering plugin" command=/plugins/velero-plugin-for-aws kind=ObjectStore logSource="pkg/plugin/clientmgmt/registry.go:100" name=velero.io/aws
time="2020-09-16T05:14:44Z" level=info msg="Checking existence of namespace" logSource="pkg/cmd/server/server.go:361" namespace=velero
time="2020-09-16T05:14:44Z" level=info msg="Namespace exists" logSource="pkg/cmd/server/server.go:367" namespace=velero
time="2020-09-16T05:14:46Z" level=info msg="Checking existence of Velero custom resource definitions" logSource="pkg/cmd/server/server.go:396"
time="2020-09-16T05:14:50Z" level=info msg="All Velero custom resource definitions exist" logSource="pkg/cmd/server/server.go:430"
time="2020-09-16T05:14:50Z" level=info msg="Checking that all backup storage locations are valid" logSource="pkg/cmd/server/server.go:437"
time="2020-09-16T05:14:50Z" level=warning msg="Velero restic daemonset not found; restic backups/restores will not work until it's created" logSource="pkg/cmd/server/server.go:509"
time="2020-09-16T05:14:50Z" level=info msg="Starting controllers" logSource="pkg/cmd/server/server.go:585"
time="2020-09-16T05:14:50Z" level=info msg="Starting metric server at address [:8085]" logSource="pkg/cmd/server/server.go:593"
time="2020-09-16T05:14:50Z" level=info msg="Backup sync period is 1m0s" logSource="pkg/controller/backup_sync_controller.go:75"
time="2020-09-16T05:14:50Z" level=info msg="Waiting for informer caches to sync" logSource="pkg/cmd/server/server.go:853"
time="2020-09-16T05:14:51Z" level=info msg="Done waiting for informer caches to sync" logSource="pkg/cmd/server/server.go:856"
time="2020-09-16T05:14:51Z" level=info msg="Informer cache synced" informer="*v1.PodVolumeBackup" logSource="pkg/cmd/server/server.go:867"
time="2020-09-16T05:14:51Z" level=info msg="Informer cache synced" informer="*v1.Schedule" logSource="pkg/cmd/server/server.go:867"
time="2020-09-16T05:14:51Z" level=info msg="Informer cache synced" informer="*v1.BackupStorageLocation" logSource="pkg/cmd/server/server.go:867"
time="2020-09-16T05:14:51Z" level=info msg="Informer cache synced" informer="*v1.Restore" logSource="pkg/cmd/server/server.go:867"
time="2020-09-16T05:14:51Z" level=info msg="Informer cache synced" informer="*v1.ResticRepository" logSource="pkg/cmd/server/server.go:867"
time="2020-09-16T05:14:51Z" level=info msg="Informer cache synced" informer="*v1.VolumeSnapshotLocation" logSource="pkg/cmd/server/server.go:867"
time="2020-09-16T05:14:51Z" level=info msg="Informer cache synced" informer="*v1.Backup" logSource="pkg/cmd/server/server.go:867"
time="2020-09-16T05:14:51Z" level=info msg="Informer cache synced" informer="*v1.ServerStatusRequest" logSource="pkg/cmd/server/server.go:867"
time="2020-09-16T05:14:51Z" level=info msg="Informer cache synced" informer="*v1.DeleteBackupRequest" logSource="pkg/cmd/server/server.go:867"
time="2020-09-16T05:14:51Z" level=info msg="Informer cache synced" informer="*v1.DownloadRequest" logSource="pkg/cmd/server/server.go:867"
time="2020-09-16T05:14:51Z" level=info msg="Server started successfully" logSource="pkg/cmd/server/server.go:881"
time="2020-09-16T05:14:51Z" level=info msg="Starting controller" controller=restore logSource="pkg/controller/generic_controller.go:76"
time="2020-09-16T05:14:51Z" level=info msg="Starting controller" controller=schedule logSource="pkg/controller/generic_controller.go:76"
time="2020-09-16T05:14:51Z" level=info msg="Starting controller" controller=restic-repository logSource="pkg/controller/generic_controller.go:76"
time="2020-09-16T05:14:51Z" level=info msg="Starting controller" controller=downloadrequest logSource="pkg/controller/generic_controller.go:76"
time="2020-09-16T05:14:51Z" level=info msg="Starting controller" controller=backup-sync logSource="pkg/controller/generic_controller.go:76"
time="2020-09-16T05:14:51Z" level=info msg="Starting controller" controller=serverstatusrequest logSource="pkg/controller/generic_controller.go:76"
time="2020-09-16T05:14:51Z" level=info msg="Starting controller" controller=gc-controller logSource="pkg/controller/generic_controller.go:76"
time="2020-09-16T05:14:51Z" level=info msg="Starting controller" controller=backup logSource="pkg/controller/generic_controller.go:76"
time="2020-09-16T05:14:51Z" level=info msg="Starting controller" controller=backup-deletion logSource="pkg/controller/generic_controller.go:76"
time="2020-09-16T05:14:51Z" level=info msg="Checking for expired DeleteBackupRequests" controller=backup-deletion logSource="pkg/controller/backup_deletion_controller.go:551"
time="2020-09-16T05:14:51Z" level=info msg="Done checking for expired DeleteBackupRequests" controller=backup-deletion logSource="pkg/controller/backup_deletion_controller.go:579"

#Get all Deployments
arathod@arathod-a01 velero-1.4.2 % kubectl get deploy -A
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
kube-system coredns 2/2 2 2 8d
local-path-storage local-path-provisioner 1/1 1 1 8d
nginx-example nginx-deployment 0/2 2 0 13s
velero minio 1/1 1 1 4m40s
velero velero 1/1 1 1 4m13s
arathod@arathod-a01 velero-1.4.2 % kubectl get deploy -n nginx-example
NAME READY UP-TO-DATE AVAILABLE AGE
nginx-deployment 2/2 2 2 31s
arathod@arathod-a01 velero-1.4.2 % kubectl get deployments -l component=velero --namespace=velero
NAME READY UP-TO-DATE AVAILABLE AGE
velero 1/1 1 1 4m42s
arathod@arathod-a01 velero-1.4.2 % velero backup create nginx-backup --selector app=nginx
Backup request "nginx-backup" submitted successfully.
Run `velero backup describe nginx-backup` or `velero backup logs nginx-backup` for more details.

#Listing down the CRDs deployed from the velero install
arathod@arathod-a01 velero-1.4.2 % kubectl get crds
NAME CREATED AT
backups.velero.io 2020-09-16T05:13:48Z
backupstoragelocations.velero.io 2020-09-16T05:13:48Z
deletebackuprequests.velero.io 2020-09-16T05:13:48Z
downloadrequests.velero.io 2020-09-16T05:13:48Z
podvolumebackups.velero.io 2020-09-16T05:13:48Z
podvolumerestores.velero.io 2020-09-16T05:13:48Z
resticrepositories.velero.io 2020-09-16T05:13:48Z
restores.velero.io 2020-09-16T05:13:48Z
schedules.velero.io 2020-09-16T05:13:48Z
serverstatusrequests.velero.io 2020-09-16T05:13:48Z
volumesnapshotlocations.velero.io 2020-09-16T05:13:48Z
arathod@arathod-a01 velero-1.4.2 % velero backup describe nginx-backup
Name: nginx-backup
Namespace: velero
Labels: velero.io/storage-location=default
Annotations: velero.io/source-cluster-k8s-gitversion=v1.18.2
velero.io/source-cluster-k8s-major-version=1
velero.io/source-cluster-k8s-minor-version=18
Phase: Completed
Errors: 0
Warnings: 0
Namespaces:
Included: *
Excluded:
Resources:
Included: *
Excluded:
Cluster-scoped: auto
Label selector: app=nginx
Storage Location: default
Velero-Native Snapshot PVs: auto
TTL: 720h0m0s
Hooks:
Backup Format Version: 1
Started: 2020-09-16 17:18:46 +1200 NZST
Completed: 2020-09-16 17:18:48 +1200 NZST
Expiration: 2020-10-16 18:18:46 +1300 NZDT
Total items to be backed up: 6
Items backed up: 6
Velero-Native Snapshots:

arathod@arathod-a01 velero-1.4.2 % velero plugin get
NAME KIND
velero.io/crd-remap-version BackupItemAction
velero.io/pod BackupItemAction
velero.io/pv BackupItemAction
velero.io/service-account BackupItemAction
velero.io/aws ObjectStore
velero.io/add-pv-from-pvc RestoreItemAction
velero.io/add-pvc-from-pod RestoreItemAction
velero.io/change-pvc-node-selector RestoreItemAction
velero.io/change-storage-class RestoreItemAction
velero.io/cluster-role-bindings RestoreItemAction
velero.io/crd-preserve-fields RestoreItemAction
velero.io/job RestoreItemAction
velero.io/pod RestoreItemAction
velero.io/restic RestoreItemAction
velero.io/role-bindings RestoreItemAction
velero.io/service RestoreItemAction
velero.io/service-account RestoreItemAction
velero.io/aws VolumeSnapshotter

#Getting the list of backups by Velero
arathod@arathod-a01 velero-1.4.2 % velero get backups
NAME STATUS ERRORS WARNINGS CREATED EXPIRES STORAGE LOCATION SELECTOR
nginx-backup Completed 0 0 2020-09-16 17:18:46 +1200 NZST 29d default app=nginx

#Now deleting the example deploy
arathod@arathod-a01 velero-1.4.2 % kubectl delete namespace nginx-example
namespace "nginx-example" deleted

#Verifying if the ns exists.
arathod@arathod-a01 velero-1.4.2 % kubectl get deployments --namespace=nginx-example
kubectl get services --namespace=nginx-example
kubectl get namespace/nginx-example
No resources found in nginx-example namespace.
No resources found in nginx-example namespace.
Error from server (NotFound): namespaces "nginx-example" not found

#Now doing the restore.
arathod@arathod-a01 velero-1.4.2 % velero restore create --from-backup nginx-backup
Restore request "nginx-backup-20200916172318" submitted successfully.
Run `velero restore describe nginx-backup-20200916172318` or `velero restore logs nginx-backup-20200916172318` for more details.


#Status of the Velero restore.
arathod@arathod-a01 velero-1.4.2 % velero restore get
NAME BACKUP STATUS ERRORS WARNINGS CREATED SELECTOR
nginx-backup-20200916172318 nginx-backup Completed 0 0 2020-09-16 17:23:18 +1200 NZST


#Describing velero restore.
arathod@arathod-a01 velero-1.4.2 % velero restore describe nginx-backup-20200916172318
Name: nginx-backup-20200916172318
Namespace: velero
Labels:
Annotations:
Phase: Completed
Backup: nginx-backup
Namespaces:
Included: all namespaces found in the backup
Excluded:
Resources:
Included: *
Excluded: nodes, events, events.events.k8s.io, backups.velero.io, restores.velero.io, resticrepositories.velero.io
Cluster-scoped: auto
Namespace mappings:
Label selector:
Restore PVs: auto