> ## Content Index
> Fetch the complete content index at: https://skills.devopscube.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# ArgoCD Sync Waves (Create Resources in specific order)
- URL: https://skills.devopscube.com/argocd-sync-waves/
- Published: 2026-10-26T12:45:22.000Z
- Updated: 2026-11-26T07:40:46.000Z
- Author: Aswin Vijayan
- Tags: #tipcat-kubernetes, #tips, #template-no-img

[ArgoCD](https://devopscube.com/argo-cd-architecture/?ref=skills.devopscube.com) normally deploys multiple Kubernetes resources as part of the same Application. However, these resources are not always independent. Some resources depend on others.

For example, lets say you have an application with a backend and frontend. The frontend depends on the backend, so you want the backend healthy before Argo CD deploys the frontend.

But Argo CD doesn't know that your frontend depends on the backend. By default, it orders resources by their kind and name. This means Argo CD could deploy the frontend while the backend is still starting.

To handle such deployment dependencies, Argo CD provides **Sync Waves**.

## What are Argo CD Sync Waves?

[Argo CD Sync Waves](https://argo-cd.readthedocs.io/en/stable/user-guide/sync-waves/?ref=skills.devopscube.com#how-sync-waves-work) lets you control the order in which Argo CD deploys resources during a deployment.

You give each resource a wave number with the **`argocd.argoproj.io/sync-wave`** annotation, and Argo CD starts deploying from the lowest number, waits until it's healthy, and moves to the next highest number.

Here is an example of how sync wave numbers are used:

```yaml
metadata:
  annotations:
    argocd.argoproj.io/sync-wave: "2"
```

> Resources without a **`sync-wave`** annotation uses **`0`** by default.  
>  
> You can also use negative numbers such as `**-1**` when something needs to be deployed before the wave `0`.

Also, Sync Waves let you define resource ordering directly in Git instead of relying on someone to manually sync resources in the correct sequence.

A typical flow could look like:

![image showing how Argo CD Sync Waves Works](https://storage.ghost.io/c/25/1a/251ae7d7-1d78-4128-b9cb-68a35ee6596c/content/images/2026/10/image-131.png)

Here is something you should know. Argo CD does not deploy every wave immediately. It deploys them one by one.

First, it deploys the lowest wave and waits until the resource is up and running. So if a resource in the previous wave is unhealthy, it won't apply the next wave.

Argo CD also adds a **2-second** delay between waves so Kubernetes controllers have time to react to the resources that were just created.

Next, lets understand how to configure sync waves.

## Configuring Sync Waves

Let's use an example of a frontend and backend application to understand how this works. We want Argo CD to deploy the backend first and wait until it is healthy before deploying the frontend.

For that, we will assign wave **`0`** to the backend deployment manifest and wave **`1`** to the frontend deployment manifest.

For example, the backend Deployment can use:

```yaml
metadata:
  name: backend
  annotations:
    argocd.argoproj.io/sync-wave: "0"
```

The frontend Deployment can use:

```yaml
metadata:
  name: frontend
  annotations:
    argocd.argoproj.io/sync-wave: "1"
```

When both resources belong to the same Argo CD Application, the backend is processed in wave 0, and the frontend is processed in wave 1.

Argo CD moves to the frontend wave once the backend has become healthy.

But what if you need to run a task before or after these Deployments, such as a database migration?

## Using Sync Waves and Sync Phases Together

In the previous section, you saw how Sync Waves deploys the resources from Git in order. However, Sync Waves only controls the order of your application resources. But sometimes you need to run tasks before or after the resources from Git are synced.

For example, the backend may need a database migration before the new version starts. Also, you may want to run a smoke test after the backend and frontend are deployed.

This is where we will use Argo CD **Sync Phases**. This helps you to decide what needs to be run before or after the resources from Git are deployed.

Argo CD uses three phases during an application sync. They are,

- **PreSync** runs tasks before applying the resources from Git. For example, database migration.
- **Sync** is the phase where Argo CD deploys the resources from Git. This is the phase where the Sync Waves deploy the resources from Git.
- **PostSync** runs tasks after Argo CD deploys the application resources. For example, tasks like application smoke tests are run in this phase.

The following image shows an example of how the sync phases work.

![image showing three phases of Argo CDs application deployment](https://storage.ghost.io/c/25/1a/251ae7d7-1d78-4128-b9cb-68a35ee6596c/content/images/2026/11/image-37.png)

Like Sync Waves, Sync Phases are set with annotations. You add the **`argocd.argoproj.io/hook`** annotation to the task's manifest.

Here is an example of a database migration Job manifest which shows the part where the Sync Phase is specified:

```yaml
apiVersion: batch/v1
kind: Job
metadata:
  name: database-migration
  annotations:
    argocd.argoproj.io/hook: PreSync
    argocd.argoproj.io/sync-wave: "0"
```

The **`argocd.argoproj.io/hook: PreSync`** annotation tells Argo CD to run this Job before it deploys the backend and frontend. If the Job fails, the sync stops and is marked as failed. So Argo CD doesn't deploy the next **`Sync`** phase.

Once the migration succeeds, Argo CD enters the Sync phase.

It applies the backend Deployment in wave **`0`** and waits until it is healthy. Then it applies the frontend Deployment in wave **`1`**.

After both Deployments are synced and healthy, Argo CD enters the PostSync phase and runs the smoke-test Job.

```yaml
apiVersion: batch/v1
kind: Job
metadata:
  name: smoke-test
  annotations:
    argocd.argoproj.io/hook: PostSync
    argocd.argoproj.io/sync-wave: "0"
```

The **`argocd.argoproj.io/hook: PostSync`** annotation tells Argo CD to run this smoke-test Job after the backend and frontend are healthy.

If the smoke test fails, Argo CD marks the sync operation as failed, even though the Deployments have already been applied.

You may notice that the migration Job, the backend Deployment, and the smoke test are all in wave `0`. But they don't run together. Because Argo CD checks the phase first and the wave number second. So wave **`0`** in PreSync, wave **`0`** in Sync, and wave **`0`** in PostSync are three separate steps.

As a rule of thumb, use phases for tasks that must run before or after the deployment. Use waves to order resources inside a phase.