What is Ark?
Ark is an open source, kubernetes disaster recovery solution from Heptio. It allows you to backup all or part of your kubernetes cluster. It backs up all tags, deployments, persistent volumes, and more. I am going to walk through how to install and configure ark and then simulate a disaster recovery scenario.
How to start using Ark
The project can be found on github at https://github.com/heptio/ark . I am going to walk through some basic steps to get started using minio(https://github.com/minio/minio) as the storage for ark for simplicity. If you get stuck, just reach out on the #ark-dr channel in the Kubernetes Slack organization (http://slack.k8s.io/). People are usually pretty quick to respond.
I am going to use minio as the storage backend for simplicity. Minio is an S3 compatible object storage solution that runs inside a container. This allows ark to run all components within the cluster. This is not recommended for production backups. For production S3 is used on AWS, GCS Bucket on Google Cloud, etc.
Cloud provider specifics can be found here: https://git.io/vx4ZH
- Download the ark client: https://github.com/heptio/ark/releases
- Untar and place in path ( /usr/local/bin)
- Clone the ark repo: https://github.com/heptio/ark.git
- Checkout the tag matching the version downloaded:
Do not skip the above step, the example manifests need to line up to the version of the ark cli.
- Execute the following kubectl commands to install ark into the cluster:
kubectl apply -f examples/common/00-prereqs.yaml
kubectl apply -f examples/minio/
kubectl apply -f examples/common/10-deployment.yaml
Disaster Recovery Scenario:
I am now going to simulate a real-world scenario of deploying an application. Then I will use ark to backup the namespace. Finally I will simulate a disaster and show how we can use ark to bring back resources.
Using kubectl, create an example deployment:
Now that we have a deployment, use ark to backup the namespace:
Next we will simulate a disaster: “Someone deleted the nginx namespace”:
Finally, we will use ark to restore the namespace:
As you can see, this makes it simple to backup and restore. You can take this a step further by automating backups using ark’s scheduler(https://git.io/vpk1x).
- When using a label selector, make sure persistent volumes have the same label.
- When testing, make sure resources are fully deleted before restoring.
- To see the detailed errors/warning of a restore use the following:
Here are some features to look for in the future:
- Easier initial install of Ark
- One command to get ark installed into your cluster
- Backup & restore across multiple regions and zones
More upcoming features can be found at: https://github.com/heptio/ark/blob/master/ROADMAP.md
Ark is a great project with many use cases and great potential for growth in the future. It has a solid community around it already eager to help out the newcomers using their project. If you are looking for a backup solution for your cluster, it seems like Ark has it figured out.