All technological notes.
Sync status
| Sync status | Description |
|---|---|
Synced |
The Live State matches the Desired State |
OutOfSync |
The Live State does not match the Desired State. Configuration drift has happened. |
Progressing |
The Application is currently undergoing a sync operation. Is temporary. |
Health status
| Health status | Description |
|---|---|
Healthy |
All the resources associated with the application are in a good state. |
Degraded |
At least one resource is in a failed or unhealthy state. The application might be perfectly Synced, but still be Degraded. |
| Command | Description |
|---|---|
argocd app create <app-name> --sync-policy automated |
Create app with automated sync policy |
argocd app sync <app-name> |
Manually sync one application. |
argocd app sync <app-name> --dry-run |
Preview sync without applying changes. |
argocd app sync <app-name> --prune |
Sync and delete resources that are no longer defined in Git. |
argocd app sync <app-name> --force |
Force apply resources, when normal apply fails |
argocd app sync <app-name> --replace |
Use replace instead of apply for some immutable field issues. |
argocd app sync <app-name> --resource <resource> |
Sync only a specific Kubernetes resource. |
argocd app sync <app-name> --label <key=value> |
Sync only resources matching a label selector. |
argocd app sync <app-name> --revision <revision> |
Sync the app to a specific Git revision, tag, or branch. |
argocd app sync <app-name> --async |
Start sync and return immediately without waiting. |
argocd app wait <app-name> --sync |
Wait until the app becomes synced. |
argocd app wait <app-name> --health |
Wait until the app becomes healthy. |
argocd app wait <app-name> --sync --health |
Wait until the app is both synced and healthy. |
argocd app terminate-op <app-name> |
Stop a running sync operation. |
argocd app diff <app-name> |
Compare Git desired state with live cluster state before syncing. |
argocd app history <app-name> |
Show previous sync/deployment history. |
argocd app rollback <app-name> <history-id> |
Roll back to a previous deployment state. |
# auto sync
spec:
syncPolicy:
automated: {}
# auto sync with
spec:
syncPolicy:
automated:
prune: true # automated pruning
selfHeal: true # self heal
Sync Policies
spec:
syncPolicy:
automated:
enabled: true # Enables auto-sync when Git changes are detected
prune: true # Automatically removes resources no longer in Git
selfHeal: true # Reverts manual changes made directly in the cluster
Out-Of-Sync.
SYNC.Automated Sync:
desired manifests in Git, and the live state in the cluster.argocd app create --sync-policy automated
spec:
syncPolicy:
automated: {}
# or
spec:
syncPolicy:
enabled: true
Pruning
argocd app create --auto-prune
spec:
syncPolicy:
automated:
enabled: true
prune: true
Automated sync policies only trigger when the Git repository changes, not if someone changes something in the cluster.
Self-healing:
live cluster state deviates from Git state.live state = desired stateargocd app create --self-heal
spec:
syncPolicy:
automated:
enabled: true
selfHeal: true
Sync Options
spec.syncPolicy.syncOptions| Sync Option (Default) | Description |
|---|---|
ApplyOutOfSyncOnly=false |
Only applies resources that are out of sync (skips in-sync ones) |
CreateNamespace=false |
Creates the target namespace if it does not exist. |
FailOnSharedResource=true |
prevents an app from syncing if it detects that another application already owns the resource. |
Force=false |
Deletes and recreates resources when a patch cannot be applied |
Prune=false |
protect specific resources from being deleted |
PruneLast=false |
Prunes resources only after all other resources are healthy |
Replace=false |
Uses kubectl replace instead of kubectl apply (destructive) |
RespectIgnoreDifferences=false |
Respects ignored fields during sync, not just during diff display |
ServerSideApply=false |
Uses server-side apply instead of client-side apply |
Validate=false |
Enable client-side Kubernetes schema validation |
apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
syncPolicy:
syncOptions:
- Prune=false
metadata:
annotations:
argocd.argoproj.io/sync-options: Prune=false
Propagation Policies (PrunePropagationPolicy)
foreground (waits for children to delete)Foreground
PrunePropagationPolicy=foregroundBackground:
PrunePropagationPolicy=backgroundOrphan:
PrunePropagationPolicy=orphanapiVersion: argoproj.io/v1alpha1
kind: Application
spec:
syncPolicy:
syncOptions:
- PrunePropagationPolicy=background