Velero gives you tools to back up and restore your Kubernetes cluster resources and persistent volumes. Velero have ability to backup cluster, migrate cluster resource to other cluster, and also replicate cluster to other cluster.
This is my first time trying Velero. correct me if I am wrong.
Requirement
docker CLI
docker-compose CLI
velero CLI
minio (mc) CLI
virtualbox
minikube
Setup Minio
Minio running as storage backend for velero to store the backup, you can using other storage backend like AWS S3, GCP GCS, and other defined in backend provider documentation. For simplicity, we use Minio.
Install Minio using docker-compose
get minio IP
create storage bucket
You can create bucket from web dashboard or via CLI.
Setup Kubernetes
For simplicity, we using minikube to run Kubernetes cluster.
Setup Velero
Velero have two system, the client-side and server-side. First install the CLI (client-side) using brew or asdf or other. It is depended on your environment.
Velero installation is a little complex, for now lets just use velero install. You must run this command from environment that have access directly to Kubernetes cluster (have kubectl working).
Add Velero credential
Install Velero in Kubernetes
Make sure velero working
Simulate disaster
Without PVC
create namespace & deployment
create namespace backup
check backup progress
You can also check Minio bucket.
simulate disaster
Please don’t delete namespace in production cluster guys
Check namespace & deployment already deleted
Restore namespaces
Check namespace & deployment already restored
With PVC
delete previous namespace
create namespace & deployment
create namespace backup
check backup progress
You can also check Minio bucket.
simulate disaster
Please don’t delete namespace in production cluster guys
Check namespace & deployment already deleted
Restore namespaces
Check namespace & deployment already restored
Conclusion
Velero is a powerful tools to prevent disaster in Kubernetes also have many storage backend support and easy to recover. But before deploying to production as disaster recovery system, we must deep dive how Velero can backup PVC if you have stateful application. Because PVC have multiple backend.