2020-08-13 16:09:15 +00:00
---
title: "Examples"
layout: docs
---
2020-02-04 16:32:59 +00:00
2020-11-18 00:28:03 +00:00
After you set up the Velero server, you can clone the examples used in the following sections by running the following:
```
git clone https://github.com/vmware-tanzu/velero.git
cd velero
```
2020-02-04 16:32:59 +00:00
2020-08-28 18:06:11 +00:00
## Basic example (without PersistentVolumes)
2020-02-04 16:32:59 +00:00
1. Start the sample nginx app:
```bash
kubectl apply -f examples/nginx-app/base.yaml
```
1. Create a backup:
```bash
velero backup create nginx-backup --include-namespaces nginx-example
```
1. Simulate a disaster:
```bash
kubectl delete namespaces nginx-example
```
Wait for the namespace to be deleted.
1. Restore your lost resources:
```bash
velero restore create --from-backup nginx-backup
```
2020-08-28 18:06:11 +00:00
## Snapshot example (with PersistentVolumes)
2020-02-04 16:32:59 +00:00
> NOTE: For Azure, you must run Kubernetes version 1.7.2 or later to support PV snapshotting of managed disks.
1. Start the sample nginx app:
```bash
kubectl apply -f examples/nginx-app/with-pv.yaml
```
2022-07-06 07:51:42 +00:00
1. Create a backup with PV snapshotting. `--csi-snapshot-timeout` is used to setup time to wait before CSI snapshot creation timeout. The default value is 10 minutes:
2020-02-04 16:32:59 +00:00
```bash
2022-07-06 07:51:42 +00:00
velero backup create nginx-backup --include-namespaces nginx-example --csi-snapshot-timeout=20m
2020-02-04 16:32:59 +00:00
```
1. Simulate a disaster:
```bash
kubectl delete namespaces nginx-example
```
Because the default [reclaim policy][1] for dynamically-provisioned PVs is "Delete", these commands should trigger your cloud provider to delete the disk that backs the PV. Deletion is asynchronous, so this may take some time. **Before continuing to the next step, check your cloud provider to confirm that the disk no longer exists.**
1. Restore your lost resources:
```bash
velero restore create --from-backup nginx-backup
```
[1]: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#reclaiming