Migrating Kubernetes Resources between ArgoCD Applications

3 years ago 5941 views
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

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 for doing this FluxCD and …


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 last missing piece - how …


ArgoCD Monitoring with Prometheus and Grafana

5 min read

ArgoCD has by default support for notifying when an Application does not have the desired status through triggers. For example, when an application becomes OutOfSync or Unhealthy, a notification is sent to your configured notification service (e.g. Slack). This was …