Maintainers: Heptio
Ark gives you tools to back up and restore your Kubernetes cluster resources and persistent volumes. Ark lets you:
- 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.
Ark consists of:
- A server that runs on your cluster
- A command-line client that runs locally
The documentation provides detailed information about building from source, architecture, extending Ark, and more.
The following example sets up the Ark server and client, then backs up and restores a sample application.
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 for how to run on a cloud provider.
- 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
Clone or fork the Ark repository:
git clone git@github.com:heptio/ark.git
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.
-
Start the server and the local storage service. In the root directory of Ark, run:
kubectl apply -f examples/common/00-prereqs.yaml kubectl apply -f examples/minio/
NOTE: If you get an error about Config creation, wait for a minute, then run the commands again.
-
Deploy the example nginx application:
kubectl apply -f examples/nginx-app/base.yaml
-
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
For this example, we recommend that you download a pre-built release.
You can also build from source.
Make sure that you install somewhere in your $PATH
.
-
Create a backup for any object that matches the
app=nginx
label selector:ark backup create nginx-backup --selector app=nginx
Alternatively if you want to backup all objects except those matching the label
backup=ignore
:ark backup create nginx-backup --selector '(backup notin ignore)'
-
Simulate a disaster:
kubectl delete namespace nginx-example
-
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.
-
Run:
ark restore create --from-backup nginx-backup
-
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:
ark restore describe <RESTORE_NAME>
For more information, see the debugging information.
If you want to delete any backups you created, including data in object storage and persistent volume snapshots, you can run:
ark backup delete BACKUP_NAME
This asks the Ark server to delete all backup data associated with BACKUP_NAME
. You need to do
this for each backup you want to permanently delete. A future version of Ark will allow you to
delete multiple backups by name or label selector.
Once fully removed, the backup is no longer visible when you run:
ark backup get BACKUP_NAME
If you want to uninstall Ark but preserve the backup data in object storage and persistent volume
snapshots, it is safe to remove the heptio-ark
namespace and everything else created for this
example:
kubectl delete -f examples/common/
kubectl delete -f examples/minio/
kubectl delete -f examples/nginx-app/base.yaml
If you encounter issues, review the troubleshooting docs, file an issue, or talk to us on the #ark-dr channel on the Kubernetes Slack server.
Thanks for taking the time to join our community and start contributing!
Feedback and discussion is available on the mailing list.
- Please familiarize yourself with the Code of Conduct before contributing.
- See CONTRIBUTING.md for instructions on the developer certificate of origin that we require.
- We welcome pull requests. Feel free to dig through the issues and jump in.
See the list of releases to find out about feature changes.