mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-07 13:55:20 +00:00
add doc changes for 0.7.0
Signed-off-by: JENNIFER RONDEAU <jrondeau@heptio.com>
This commit is contained in:
247
README.md
247
README.md
@@ -5,167 +5,145 @@
|
||||
[![Build Status][1]][2]
|
||||
|
||||
## Overview
|
||||
Heptio Ark is a utility for managing disaster recovery, specifically for your [Kubernetes][14] cluster resources and persistent volumes. It provides a simple, configurable, and operationally robust way to back up and restore applications and PVs from a series of checkpoints. This allows you to better automate in the following scenarios:
|
||||
|
||||
* **Disaster recovery** with reduced TTR (time to respond), in the case of:
|
||||
* Infrastructure loss
|
||||
* Data corruption
|
||||
* Service outages
|
||||
Ark gives you tools to back up and restore your Kubernetes cluster resources and persistent volumes. Ark lets you:
|
||||
|
||||
* **Cross-cloud-provider migration** for Kubernetes API objects (cross-cloud-provider migration of persistent volume snapshots not yet supported)
|
||||
* Take backups of your cluster and restore in case of loss.
|
||||
* Copy cluster resources across cloud providers. NOTE: Cloud volume migrations are not yet supported.
|
||||
* Replicate your production environment for development and testing environments.
|
||||
|
||||
* **Dev and testing environment setup (+ CI)**, via replication of prod environment
|
||||
Ark consists of:
|
||||
|
||||
More concretely, Heptio Ark combines an in-cluster service with a CLI that allows you to record both:
|
||||
1. *Configurable subsets of Kubernetes API objects* -- as tarballs stored in object storage
|
||||
2. *Disk snapshots of Persistent Volumes* -- via the cloud provider APIs
|
||||
* A server that runs on your cluster
|
||||
* A command-line client that runs locally
|
||||
|
||||
Heptio Ark currently supports the [AWS][15], [GCP][16], and [Azure][17] cloud provider platforms.
|
||||
## Getting started
|
||||
|
||||
## Quickstart
|
||||
The following example sets up the Ark server and client, then backs up and restores a sample application.
|
||||
|
||||
This guide gets Ark up and running on your cluster, and goes through an example using the following:
|
||||
* **Minio, an S3-compatible storage service** that runs locally on your cluster. This is the storage service where backup files are uploaded. *Note that Ark is intended to run on a cloud provider--we are using Minio here to keep the example convenient and self-contained.*
|
||||
For simplicity, the example uses Minio, an S3-compatible storage service that runs locally on your cluster. See [Set up Ark with your cloud provider][3] for how to run on a cloud provider.
|
||||
|
||||
* **A sample nginx app** under the `nginx-example` namespace, used to demonstrate Ark's backup and restore functionality.
|
||||
### Prerequisites
|
||||
|
||||
Note that this example *does not* include a demonstration of PV disk snapshots, because that feature requires integration with a cloud provider API. For snapshotting examples and instructions specific to AWS, GCP, and Azure, see [Cloud Provider Specifics][23].
|
||||
* Access to a Kubernetes cluster, version 1.7 or later. Version 1.7.5 or later is required to run `ark backup delete`.
|
||||
* A DNS server on the cluster
|
||||
* `kubectl` installed
|
||||
|
||||
### 0. Prerequisites
|
||||
### Download
|
||||
|
||||
* *You should have access to an up-and-running Kubernetes cluster (minimum version 1.7).* If you do not have a cluster, [choose a setup solution][9] from the official Kubernetes docs.
|
||||
Clone or fork the Ark repository:
|
||||
|
||||
* *You will need to have a DNS server set up on your cluster for the example files to work.* You can check this with `kubectl get svc -l k8s-app=kube-dns --namespace=kube-system`. If said service does not exist, [these instructions][12] may help.
|
||||
|
||||
* *You should have `kubectl` installed.* If not, follow the instructions for [installing via Homebrew (MacOS)][10] or [building the binary (Linux)][11].
|
||||
|
||||
### 1. Download
|
||||
Clone or fork the Heptio Ark repo:
|
||||
```
|
||||
git clone git@github.com:heptio/ark.git
|
||||
```
|
||||
|
||||
> NOTE: Documentation may change between releases. See the [Changelog][20] for links to previous versions of this repository and its docs.
|
||||
>
|
||||
> To ensure that you are working off a specific release, `git checkout <VERSION_TAG>` where `<VERSION_TAG>` is the appropriate tag for the Ark version you wish to use (e.g. "v0.3.3"). You should `git checkout master` only if you're planning on [building the Ark image from scratch][7].
|
||||
NOTE: Make sure to check out the appropriate version. We recommend that you check out the latest tagged version. The master branch is under active development and might not be stable.
|
||||
|
||||
### 2. Setup
|
||||
### Set up server
|
||||
|
||||
There are two types of Ark instances that work in tandem:
|
||||
1. **Ark server**: Runs persistently on the cluster.
|
||||
2. **Ark client**: Launched by the user whenever they want to initiate an operation (e.g. a backup).
|
||||
1. Start the server and the local storage service. In the root directory of Ark, run:
|
||||
|
||||
To get the server started on your cluster (as well as the local storage service), execute the following commands in Ark's root directory:
|
||||
```bash
|
||||
kubectl apply -f examples/common/00-prereqs.yaml
|
||||
kubectl apply -f examples/minio/
|
||||
kubectl apply -f examples/common/10-deployment.yaml
|
||||
```
|
||||
|
||||
NOTE: If you get an error about Config creation, wait for a minute, then run the commands again.
|
||||
|
||||
1. Deploy the example nginx application:
|
||||
|
||||
```bash
|
||||
kubectl apply -f examples/nginx-app/base.yaml
|
||||
```
|
||||
|
||||
1. Check to see that both the Ark and nginx deployments are successfully created:
|
||||
|
||||
```
|
||||
kubectl get deployments -l component=ark --namespace=heptio-ark
|
||||
kubectl get deployments --namespace=nginx-example
|
||||
```
|
||||
|
||||
### Install client
|
||||
|
||||
For this example, we recommend that you [download a pre-built release][26].
|
||||
|
||||
You can also [build from source][7].
|
||||
|
||||
Make sure that you install somewhere in your `$PATH`.
|
||||
|
||||
### Back up
|
||||
|
||||
1. Create a backup for any object that matches the `app=nginx` label selector:
|
||||
|
||||
```
|
||||
ark backup create nginx-backup --selector app=nginx
|
||||
```
|
||||
|
||||
1. Simulate a disaster:
|
||||
|
||||
```
|
||||
kubectl delete namespace nginx-example
|
||||
```
|
||||
|
||||
1. To check that the nginx deployment and service are gone, run:
|
||||
|
||||
```
|
||||
kubectl get deployments --namespace=nginx-example
|
||||
kubectl get services --namespace=nginx-example
|
||||
kubectl get namespace/nginx-example
|
||||
```
|
||||
|
||||
You should get no results.
|
||||
|
||||
NOTE: You might need to wait for a few minutes for the namespace to be fully cleaned up.
|
||||
|
||||
### Restore
|
||||
|
||||
1. Run:
|
||||
|
||||
```
|
||||
ark restore create nginx-backup
|
||||
```
|
||||
|
||||
1. Run:
|
||||
|
||||
```
|
||||
ark restore get
|
||||
```
|
||||
|
||||
After the restore finishes, the output looks like the following:
|
||||
|
||||
```
|
||||
NAME BACKUP STATUS WARNINGS ERRORS CREATED SELECTOR
|
||||
nginx-backup-20170727200524 nginx-backup Completed 0 0 2017-07-27 20:05:24 +0000 UTC <none>
|
||||
```
|
||||
|
||||
NOTE: The restore can take a few moments to finish. During this time, the `STATUS` column reads `InProgress`.
|
||||
|
||||
After a successful restore, the `STATUS` column is `Completed`, and `WARNINGS` and `ERRORS` are 0. All objects in the `nginx-example` namespacee should be just as they were before you deleted them.
|
||||
|
||||
If there are errors or warnings, you can look at them in detail:
|
||||
|
||||
```
|
||||
kubectl apply -f examples/common/00-prereqs.yaml
|
||||
kubectl apply -f examples/minio/
|
||||
kubectl apply -f examples/common/10-deployment.yaml
|
||||
ark restore describe <RESTORE_NAME>
|
||||
```
|
||||
|
||||
*NOTE: If you encounter an error related to Config creation, wait for a minute and run the command again. (The Config CRD does not always finish registering in time.)*
|
||||
For more information, see [the debugging information][18].
|
||||
|
||||
Now deploy the example nginx app:
|
||||
```
|
||||
kubectl apply -f examples/nginx-app/base.yaml
|
||||
```
|
||||
### Clean up
|
||||
|
||||
Check to see that both the Ark and nginx deployments have been successfully created:
|
||||
```
|
||||
kubectl get deployments -l component=ark --namespace=heptio-ark
|
||||
kubectl get deployments --namespace=nginx-example
|
||||
```
|
||||
To remove the Kubernetes objects for this example from your cluster, run:
|
||||
|
||||
Finally, install the Ark client somehwere in your `$PATH`:
|
||||
* [Download a pre-built release][26], or
|
||||
* [Build it from scratch][7]
|
||||
|
||||
|
||||
### 3. Back up and restore
|
||||
First, create a backup specifically for any object matching the `app=nginx` label selector:
|
||||
|
||||
```
|
||||
ark backup create nginx-backup --selector app=nginx
|
||||
```
|
||||
|
||||
Now you can mimic a disaster with the following:
|
||||
```
|
||||
kubectl delete namespace nginx-example
|
||||
```
|
||||
Oh no! The nginx deployment and service are both gone, as you can see (though you may have to wait a minute or two for the namespace be fully cleaned up):
|
||||
```
|
||||
kubectl get deployments --namespace=nginx-example
|
||||
kubectl get services --namespace=nginx-example
|
||||
```
|
||||
Neither commands should yield any results. However, because Ark has your back(up), you can run this command:
|
||||
```
|
||||
ark restore create nginx-backup
|
||||
```
|
||||
|
||||
To check on the status of the Restore:
|
||||
```
|
||||
ark restore get
|
||||
```
|
||||
|
||||
The output should look something like the table below:
|
||||
```
|
||||
NAME BACKUP STATUS WARNINGS ERRORS CREATED SELECTOR
|
||||
nginx-backup-20170727200524 nginx-backup Completed 0 0 2017-07-27 20:05:24 +0000 UTC <none>
|
||||
```
|
||||
|
||||
If the Restore's `STATUS` column is "Completed", and `WARNINGS` and `ERRORS` are both zero, the restore is a success. All of the objects in the `nginx-example` namespace should be just as they were before.
|
||||
|
||||
Otherwise, if there are warnings or errors indicated, you can run the following command to look at them in more detail:
|
||||
```
|
||||
ark restore get <RESTORE NAME> -o yaml
|
||||
```
|
||||
See the [debugging documentation][18] for more details.
|
||||
|
||||
*NOTE*: In the example files, the `storage` volume is defined via `hostPath` for better visibility. If you're curious to see the [structure of the backup files][13] firsthand, you can find the compressed results in `/tmp/minio/ark/nginx-backup`.
|
||||
|
||||
### 4. Tear Down
|
||||
Using the following command, you can remove all Kubernetes objects associated with this example:
|
||||
```
|
||||
kubectl delete -f examples/common/
|
||||
kubectl delete -f examples/minio/
|
||||
kubectl delete -f examples/nginx-app/base.yaml
|
||||
```
|
||||
|
||||
## Architecture
|
||||
## More information
|
||||
|
||||
Each of Heptio Ark's operations (Backups, Schedules, and Restores) are custom resources themselves, defined using [CRDs][20]. Their accompanying [custom controllers][21] handle them when they are submitted to the Kubernetes API server.
|
||||
|
||||
As mentioned before, Ark runs in two different modes:
|
||||
|
||||
* **Ark client**: Allows you to query, create, and delete the Ark resources as desired.
|
||||
|
||||
* **Ark server**: Runs all of the Ark controllers. Each controller watches its respective custom resource for API operations, performs validation, and handles the majority of the cloud API logic (e.g. interfacing with object storage and persistent volumes).
|
||||
|
||||
Looking at a specific example--an `ark backup create test-backup` command triggers the following operations:
|
||||
|
||||
![19]
|
||||
|
||||
1. The *ark client* makes a call to the Kubernetes API server, creating a `Backup` custom resource (which is stored in [etcd][22]).
|
||||
|
||||
2. The `BackupController` sees that a new `Backup` has been created, and validates it.
|
||||
|
||||
3. Once validation passes, the `BackupController` begins the backup process. It collects data by querying the Kubernetes API Server for resources.
|
||||
|
||||
4. Once the data has been aggregated, the `BackupController` makes a call to the object storage service (e.g. Amazon S3) to upload the backup file.
|
||||
|
||||
5. By default, Ark also makes disk snapshots of any persistent volumes, using the appropriate cloud service API. (This can be disabled via the option `--snapshot-volumes=false`)
|
||||
|
||||
## Extensibility
|
||||
|
||||
Ark has multiple mechanisms for extending the core functionality to meet your individual backup/restore needs:
|
||||
|
||||
* [Hooks][27] allow you to specify commands to be executed within running pods during a backup. This is useful if you need to run a workload-specific command prior to taking a backup (for example, to flush disk buffers or to freeze a database).
|
||||
* [Plugins][28] enable you to develop custom object/block storage back-ends or per-item backup/restore actions that can execute arbitrary logic, including modifying the items being backed up/restored. Plugins can be used by Ark without needing to be compiled into the core Ark binary.
|
||||
|
||||
|
||||
## Further documentation
|
||||
|
||||
To learn more about Heptio Ark operations and their applications, see the [`/docs` directory][3].
|
||||
[The documentation][29] provides detailed information about building from source, architecture, extending Ark, and more.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@@ -186,7 +164,6 @@ Feedback and discussion is available on [the mailing list][24].
|
||||
|
||||
* We welcome pull requests. Feel free to dig through the [issues][4] and jump in.
|
||||
|
||||
|
||||
## Changelog
|
||||
|
||||
See [the list of releases][6] to find out about feature changes.
|
||||
@@ -194,12 +171,12 @@ See [the list of releases][6] to find out about feature changes.
|
||||
[0]: https://github.com/heptio
|
||||
[1]: https://travis-ci.org/heptio/ark.svg?branch=master
|
||||
[2]: https://travis-ci.org/heptio/ark
|
||||
[3]: /docs
|
||||
[3]: /docs/cloud-common.md
|
||||
[4]: https://github.com/heptio/ark/issues
|
||||
[5]: /CONTRIBUTING.md
|
||||
[6]: /CHANGELOG.md
|
||||
[5]: https://github.com/heptio/ark/blob/master/CONTRIBUTING.md
|
||||
[6]: https://github.com/heptio/ark/releases
|
||||
[7]: /docs/build-from-scratch.md
|
||||
[8]: /CODE_OF_CONDUCT.md
|
||||
[8]: https://github.com/heptio/ark/blob/master/CODE_OF_CONDUCT.md
|
||||
[9]: https://kubernetes.io/docs/setup/
|
||||
[10]: https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-with-homebrew-on-macos
|
||||
[11]: https://kubernetes.io/docs/tasks/tools/install-kubectl/#tabset-1
|
||||
@@ -214,9 +191,9 @@ See [the list of releases][6] to find out about feature changes.
|
||||
[20]: https://kubernetes.io/docs/concepts/api-extension/custom-resources/#customresourcedefinitions
|
||||
[21]: https://kubernetes.io/docs/concepts/api-extension/custom-resources/#custom-controllers
|
||||
[22]: https://github.com/coreos/etcd
|
||||
[23]: /docs/cloud-provider-specifics.md
|
||||
[24]: http://j.hept.io/ark-list
|
||||
[25]: http://slack.kubernetes.io/
|
||||
[26]: https://github.com/heptio/ark/releases
|
||||
[27]: /docs/hooks.md
|
||||
[28]: /docs/plugins.md
|
||||
[28]: /docs/plugins.md
|
||||
[29]: https://heptio.github.io/ark/
|
||||
|
||||
Reference in New Issue
Block a user