9.2 Backup and Restore
Warning
This Lab only works on your local machine.Backup and Restore
As ArgoCD holds the whole state in native Kubernetes objects it’s quite straightforward to make a backup and restore it in case of a disaster recovery.
ArgoCD provides the utility argocd-util which is used by ArgoCD internally. The functions export and import can be used for backup and restore of a ArgoCD instance.
As the tool is contained inside the ArgoCD server image you just can execute it from inside the container.
First find the current version used of ArgoCD server to align the server version with the tool version:
$ argocd version | grep server
argocd-server: v2.6.3+e05298b
Export the version (without the postfix +eb3d1fb) to environment:
export VERSION=v2.6.3
Backup
docker run -v ~/.kube:/home/argocd/.kube --rm argoproj/argocd:$VERSION argocd admin export > backup.yaml
Note
If you should encounter permission errors like error loading config file \"/home/argocd/.kube/config\": open /home/argocd/.kube/config: permission denied
you should change temporarily the permission of the kube config:
chmod o+r ~/.kube/config
Don’t forget to remove the read permission for others after exporting:
chmod o-r ~/.kube/config
Restore
The same utility can be used to restore a previously made backup:
docker run -i -v ~/.kube:/home/argocd/.kube --rm argoproj/argocd:$VERSION argocd admin import - < backup.yaml
Reference: Disaster recovery