Migrating Kubernetes Resources between ArgoCD Applications

2 years ago

1 min read

I've been using ArgoCD for a while now, and as time went by I started to splitting my Kubernetes resources into smaller ArgoCD Applications. However, I could not figure out clear guidelines on how to do it without downtime. Recently I figured it out and wanted to share the solution.

First, disable auto-syncing so that neither of your ArgoCD Application sync. Then, remove the relevant code on Git from the ArgoCD Application that you want to migrate it from and push it to Git. Now ArgoCD will mark the resource for deletion but won't sync since auto syncing is disabled. Now, we can manually remove the ArgoCD label argocd.argoproj.io/instance and then it should be removed from ArgoCD's state and in the ArgoCD UI you should see the Kubernetes resources disappear. Now we move the relevant code on Git from the old ArgoCD Application to the new. Enable auto-syncing and the ArgoCD will add the ArgoCD label argocd.argoproj.io/instance with the value of the new Application. It won't change any of the Kubernetes resources unless you've explicitly done so when migrating the resources. Neither Applications will be out-of-sync and you can re-enable auto-syncing now.

Similar Posts

2 years ago
jsonnet argo-cd tanka devops ci/cd

GitOps with ArgoCD and Tanka

10 min read

GitOps is becoming the standard of doing continuous delivery. Define your state in Git, automatically update and change the state when pull requests are merged. Within the Kubernetes ecosystem two tools have become very popular …

2 years ago
jsonnet argo-cd tanka vault devops ci/cd

GitOps Secret Management with Vault, ArgoCD and Tanka

7 min read

Recently I wrote a blog post on how to use Grafana's Tanka with ArgoCD which is my prefered way to write Kubernetes configuration in Jsonnet. However, the post does not go into detail on the …

3 years ago
mailgun statuscake terraform cloudflare devops s3 rds django

Kickstarting Infrastructure for Django Applications with Terraform

8 min read

When creating Django applications or using cookiecutters as Django Cookiecutter you will have by default a number of dependencies that will be needed to be created as a S3 bucket, a Postgres Database and a …