Introduction
ArgoCD continuously compares the desired state in Git with the actual state in Kubernetes. When differences are detected, the application shows "OutOfSync" status, indicating the cluster doesn't match the Git repository.
Symptoms
Application status:
```bash $ argocd app get my-app
Name: my-app Project: default Server: https://kubernetes.default.svc Repo: https://github.com/org/repo.git Target Revision: HEAD Status: OutOfSync Health Status: Healthy
GROUP KIND NAMESPACE NAME STATUS HEALTH apps Deployment default my-app OutOfSync Healthy ```
Sync status details:
```bash $ argocd app diff my-app
===== apps/Deployment default/my-app ====== 17c17 < image: my-app:v1.0.0 --- > image: my-app:v1.1.0 ```
Common Causes
- 1.Manual cluster changes - Someone modified resources directly
- 2.Git changes not synced - New commits not deployed
- 3.Helm values drift - Values changed in cluster vs Git
- 4.Auto-sync disabled - Manual sync required
- 5.Resource deletion - Resources deleted from cluster
- 6.Controller modification - Operators/controllers changing resources
- 7.Self-healing disabled - ArgoCD not correcting drift
Step-by-Step Fix
Step 1: Check Application Status
```bash # Get application details argocd app get my-app
# List all applications with status argocd app list
# Check via kubectl kubectl get applications -n argocd kubectl describe application my-app -n argocd ```
Step 2: View Sync Differences
```bash # Show detailed diff argocd app diff my-app
# Show diff for specific resource argocd app diff my-app --local ./manifests/
# Compare with specific revision argocd app diff my-app --revision v1.2.0
# View in UI # ArgoCD UI > Application > App Details > Diff ```
Step 3: Sync the Application
```bash # Sync to Git state argocd app sync my-app
# Sync specific resource argocd app sync my-app --resource Deployment:default:my-app
# Sync with prune (delete extra resources) argocd app sync my-app --prune
# Sync with replace strategy argocd app sync my-app --replace
# Force sync (bypass validation) argocd app sync my-app --force ```
Step 4: Enable Auto-Sync
```bash # Enable auto-sync argocd app set my-app --sync-policy automated
# Enable auto-prune argocd app set my-app --auto-prune
# Enable self-heal argocd app set my-app --self-heal
# Or in Application manifest: apiVersion: argoproj.io/v1alpha1 kind: Application spec: syncPolicy: automated: prune: true selfHeal: true ```
Step 5: Check for Manual Changes
```bash # Check who last modified resource kubectl audit-logs --resource deployments --name my-app
# Compare live resource with Git kubectl get deployment my-app -o yaml > live.yaml git show main:manifests/deployment.yaml > git.yaml diff live.yaml git.yaml
# Look for annotations indicating manual changes kubectl get deployment my-app -o jsonpath='{.metadata.annotations}'
# Common manual changes: # - kubectl edit # - kubectl patch # - kubectl scale # - Operator modifications ```
Step 6: Handle Helm Value Drift
```bash # Check current Helm values argocd app get my-app --show-params
# Compare with values in Git helm template my-app ./chart -f values.yaml > rendered.yaml kubectl get -f rendered.yaml -o yaml > live.yaml
# Update values in Git or override argocd app set my-app --helm-set image.tag=v1.2.0
# For ApplicationSets, update generator # Check ApplicationSet controller logs kubectl logs -n argocd -l app.kubernetes.io/name=argocd-applicationset-controller ```
Step 7: Check Controller Modifications
```bash # Some controllers modify resources (HPA, VPA, etc.) # Check for controller-owned fields
# HPA modifies replicas kubectl get hpa -o yaml
# VPA modifies resource requests kubectl get vpa -o yaml
# Use ignoreDifferences for controlled fields spec: ignoreDifferences: - group: apps kind: Deployment jsonPointers: - /spec/replicas # HPA managed - /spec/template/spec/containers/0/resources # VPA managed ```
Step 8: Handle Resource Deletion
```bash # Check if resources were deleted from cluster argocd app get my-app --refresh
# View managed resources argocd app resources my-app
# If resource exists in Git but not cluster: # 1. Sync will recreate it argocd app sync my-app
# 2. Or check if deletion was intentional # Check sync history argocd app history my-app ```
Step 9: Check Sync Windows
```bash # Check if sync is blocked by window argocd app get my-app
# View sync windows argocd proj get default
# Sync windows configuration: apiVersion: argoproj.io/v1alpha1 kind: AppProject spec: syncWindows: - kind: deny schedule: '0 0 * * *' # Midnight UTC duration: 8h namespaces: - production
# Manual sync during window argocd app sync my-app --force ```
Step 10: Debug Sync Failures
```bash # Check sync status argocd app get my-app
# View operation logs kubectl logs -n argocd -l app.kubernetes.io/name=argocd-application-controller
# Check application controller logs kubectl logs -n argocd deployment/argocd-application-controller
# View recent operations argocd app history my-app
# Check for admission webhook errors kubectl get events -n default --field-selector reason=Failed ```
Sync Status Types
| Status | Description | Action |
|---|---|---|
| Synced | Cluster matches Git | None needed |
| OutOfSync | Differences exist | Sync required |
| Unknown | Can't determine state | Check connectivity |
| Degraded | Sync failed | Check errors |
Verification
```bash # After syncing # Check application status argocd app get my-app
# Status should show: # Status: Synced # Health Status: Healthy
# Verify resources match Git argocd app diff my-app
# Should show: no differences
# Check sync history argocd app history my-app
# Monitor for drift watch argocd app get my-app ```
Prevention
To prevent ArgoCD application out of sync issues from recurring, implement these proactive measures:
1. Monitor Sync Status
groups:
- name: argocd-sync
rules:
- alert: ArgoCDAppOutOfSync
expr: |
argocd_app_sync_status{status="OutOfSync"} > 0
for: 10m
labels:
severity: warning
annotations:
summary: "ArgoCD application {{ $labels.name }} is out of sync"2. Enable Auto-Sync
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-app
spec:
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
retry:
limit: 5
backoff:
duration: 5s
factor: 2
maxDuration: 3m3. Implement Drift Detection
```bash # Schedule regular drift detection cat << 'EOF' > /usr/local/bin/drift_detection.sh #!/bin/bash APPS=$(argocd app list -o name)
for app in $APPS; do STATUS=$(argocd app get $app -o jsonpath='{.status.sync.status}') if [ "$STATUS" != "Synced" ]; then echo "WARNING: $app is $STATUS" argocd app diff $app fi done EOF
chmod +x /usr/local/bin/drift_detection.sh echo "*/15 * * * * root /usr/local/bin/drift_detection.sh" > /etc/cron.d/argocd-drift ```
Best Practices Checklist
- [ ] Monitor sync status
- [ ] Enable auto-sync for applications
- [ ] Implement drift detection
- [ ] Use GitOps best practices
- [ ] Test sync procedures
- [ ] Document sync policies
Related Issues
- [Fix ArgoCD Health Check Failed](/articles/fix-argocd-health-check-failed)
- [Fix ArgoCD Repo Server Unavailable](/articles/fix-argocd-repo-server-unavailable)
- [Fix ArgoCD Image Updater Not Working](/articles/fix-argocd-image-updater-not-working)
Related Articles
- [Technical troubleshooting: Fix Cicd Artifact Upload Failed Storage Issue in C](cicd-artifact-upload-failed-storage)
- [Technical troubleshooting: Fix Cicd Code Quality Gate Failed Sonarqube Issue ](cicd-code-quality-gate-failed-sonarqube)
- [Technical troubleshooting: Fix Cicd Deployment Failed Health Check Issue in C](cicd-deployment-failed-health-check)
- [Technical troubleshooting: Fix Cicd Github Actions Workflow Queue Timeout in ](cicd-github-actions-workflow-queue-timeout)
- [Technical troubleshooting: Fix Cicd Gitlab Runner Stuck Pending Issue in CI/C](cicd-gitlab-runner-stuck-pending)
<script type="application/ld+json"> { "@context": "https://schema.org", "@type": "TechArticle", "headline": "Fix ArgoCD Application Out of Sync (cicd)", "description": "Troubleshoot ArgoCD application out of sync issues. Check Git differences, resource drift, and sync settings.", "url": "https://www.fixwikihub.com/fix-argocd-app-out-of-sync", "publisher": { "@type": "Organization", "name": "FixWikiHub", "url": "https://www.fixwikihub.com" }, "author": { "@type": "Person", "name": "FixWikiHub Editorial Team" }, "datePublished": "2026-04-03T19:26:22.800Z", "dateModified": "2026-04-03T19:26:22.800Z" } </script>