| name | argocd-sync |
| description | ArgoCD application management, sync operations, and GitOps troubleshooting |
| homepage | https://docs.aof.sh/skills/argocd-sync |
| metadata | {"emoji":"🔄","version":"1.0.0","author":"AOF Team","license":"Apache-2.0","requires":{"bins":["argocd"],"any_bins":["kubectl"]},"install":[{"id":"brew-argocd","kind":"brew","package":"argocd","bins":["argocd"]}],"tags":["argocd","gitops","deployments","sync","kubernetes"]} |
ArgoCD Sync Skill
Expert guidance for ArgoCD application management, sync operations, rollbacks, and GitOps troubleshooting.
When to Use This Skill
- Syncing applications to desired state
- Investigating sync failures
- Rolling back deployments
- Managing application configuration
- Troubleshooting health status issues
- Handling drift between Git and cluster
Quick Commands
Application Status
argocd app list
argocd app get <app-name>
argocd app get <app-name> -o json | jq '.status.sync'
argocd app get <app-name> -o json | jq '.status.health'
Sync Operations
argocd app sync <app-name>
argocd app sync <app-name> --prune
argocd app sync <app-name> --resource apps:Deployment:my-deploy
argocd app sync <app-name> --force
argocd app sync <app-name> --dry-run
Rollback
argocd app history <app-name>
argocd app rollback <app-name>
argocd app rollback <app-name> <revision>
Sync Status Explained
| Status | Description |
|---|
Synced | Application state matches Git |
OutOfSync | Live state differs from Git |
Unknown | Cannot determine sync status |
Health Status
| Status | Description |
|---|
Healthy | All resources healthy |
Progressing | Resources updating |
Degraded | One or more resources unhealthy |
Suspended | Resources suspended (e.g., paused rollout) |
Missing | Resource exists in Git but not cluster |
Unknown | Health cannot be determined |
Troubleshooting Sync Issues
Application Out of Sync
Diagnosis:
argocd app diff <app-name>
argocd app diff <app-name> --local <path-to-manifests>
Common Causes:
- Manual changes to cluster (drift)
- Resource was modified by another controller
- Helm values overrides not matching
Solutions:
argocd app sync <app-name>
argocd app sync <app-name> --prune
Sync Failed
Diagnosis:
argocd app get <app-name> -o json | jq '.status.operationState'
kubectl get events -n argocd --sort-by='.lastTimestamp' | grep <app-name>
Common Causes:
- Invalid manifests - YAML syntax errors
- Resource validation failed - CRD not installed, schema mismatch
- Permission denied - RBAC issues
- Namespace doesn't exist
- Resource already exists - Not managed by ArgoCD
Solutions:
kubectl apply --dry-run=client -f <manifest>
kubectl auth can-i create deployments --as=system:serviceaccount:argocd:argocd-application-controller -n <namespace>
Application Degraded
Diagnosis:
argocd app resources <app-name>
argocd app get <app-name> --resource <kind>:<name>
Common Causes:
- Pod not ready (probe failing)
- Deployment replicas mismatch
- PVC not bound
- Service endpoints not ready
Stuck in Progressing
Diagnosis:
argocd app get <app-name> -o json | jq '.status.resources[] | select(.health.status=="Progressing")'
Common Causes:
- Deployment stuck waiting for pods
- HPA scaling in progress
- PDB blocking rollout
Solution:
kubectl get pods -n <namespace> -l app=<app>
kubectl rollout status deployment/<name> -n <namespace>
Application Management
Create Application
argocd app create <app-name> \
--repo https://github.com/org/repo.git \
--path <path> \
--dest-server https://kubernetes.default.svc \
--dest-namespace <namespace>
argocd app create <app-name> \
--repo https://charts.example.com \
--helm-chart <chart-name> \
--revision <version> \
--dest-server https://kubernetes.default.svc \
--dest-namespace <namespace>
Update Application
argocd app set <app-name> --revision <branch/tag>
argocd app set <app-name> --helm-set key=value
argocd app set <app-name> --values-literal-file values.yaml
Delete Application
argocd app delete <app-name>
argocd app delete <app-name> --cascade
Sync Policies
Auto-Sync
apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
syncPolicy:
automated:
prune: true
selfHeal: true
allowEmpty: false
Sync Options
spec:
syncPolicy:
syncOptions:
- CreateNamespace=true
- PrunePropagationPolicy=foreground
- PruneLast=true
- ApplyOutOfSyncOnly=true
- ServerSideApply=true
Hooks and Waves
Sync Hooks
metadata:
annotations:
argocd.argoproj.io/hook: PreSync
argocd.argoproj.io/hook: PostSync
argocd.argoproj.io/hook: SyncFail
argocd.argoproj.io/hook-delete-policy: HookSucceeded
Sync Waves
metadata:
annotations:
argocd.argoproj.io/sync-wave: "-1"
Best Practices
- Use sync waves for dependencies (CRDs before CRs)
- Enable auto-sync with selfHeal for GitOps compliance
- Use prune cautiously - can delete unintended resources
- Set resource tracking appropriately (annotation vs label)
- Use Projects for RBAC and source restrictions
- Monitor sync status in dashboards/alerts
CLI Authentication
argocd login <argocd-server> --username admin --password <password>
argocd login <argocd-server> --sso
kubectl port-forward svc/argocd-server -n argocd 8080:443
argocd login localhost:8080 --insecure
Useful Commands Reference
| Task | Command |
|---|
| List apps | argocd app list |
| Sync app | argocd app sync <app> |
| Diff app | argocd app diff <app> |
| Get app | argocd app get <app> |
| Rollback | argocd app rollback <app> <rev> |
| History | argocd app history <app> |
| Terminate sync | argocd app terminate-op <app> |
| Refresh | argocd app get <app> --refresh |
| Hard refresh | argocd app get <app> --hard-refresh |