argocd

27 commands

27 shown

Login to ArgoCD Authenticate argocd CLI using the initial admin secret argocd login argocd.example.com --username admin --password $(kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath='{.data.password}' | base64 -d) #argocd#kubectl List all applications Show all ArgoCD applications with sync/health status argocd app list #argocd Sync an application Trigger sync and prune removed resources argocd app sync myapp --prune #argocd Force refresh (bypass cache) Force ArgoCD to re-fetch manifests from Git argocd app get myapp --refresh #argocd#debug Show app diff vs cluster Show what would change if the app were synced now argocd app diff myapp #argocd#debug Rollback to previous version Rollback to revision 3 of the application history argocd app rollback myapp 3 #argocd Create application from CLI Declaratively create an ArgoCD app with auto-sync argocd app create myapp --repo https://github.com/org/repo --path k8s/prod --dest-server https://kubernetes.default.svc --dest-namespace default --sync-policy automated #argocd#ci Delete application (keep resources) Remove ArgoCD app object without deleting Kubernetes resources argocd app delete myapp --cascade=false #argocd Add cluster to ArgoCD Register an external cluster using a kubeconfig context argocd cluster add my-k8s-context #argocd#kubectl List registered clusters Show all clusters managed by ArgoCD argocd cluster list #argocd Set image override Override container image for a Kustomize app without changing Git argocd app set myapp --kustomize-image myapp=myregistry/myapp:v1.2.3 #argocd#kustomize Pause auto-sync Disable automated sync for manual control argocd app set myapp --sync-policy none #argocd View application resources List all Kubernetes resources managed by an app argocd app resources myapp #argocd#debug Watch sync status Block until app is synced and healthy (CI use case) argocd app wait myapp --sync --health --timeout 120 #argocd#ci Create project with RBAC Isolate apps in a project with source/destination restrictions argocd proj create myproject --description 'Production apps' --dest 'https://kubernetes.default.svc,prod' --src 'https://github.com/org/*' #argocd#security Override Helm value at sync Override Helm values live without touching Git; note: drifts from source until committed argocd app set <name> --helm-set image.tag=v2 --helm-set replicaCount=3 #argocd#gitops#k8s#troubleshooting Set plain parameter override Set Kustomize/Helm parameter overrides via -p; modern: prefer Git-tracked overlays for audit argocd app set <name> -p key=val -p env=prod #argocd#gitops#k8s Diff rendered manifests vs cluster Diff Argo-rendered manifests against live cluster state before syncing argocd app manifests <name> | kubectl diff -f - #argocd#gitops#troubleshooting#debug Inspect ApplicationSet List/get ApplicationSets and their generated child apps and generators argocd appset list && argocd appset get <name> -o yaml #argocd#gitops#k8s Add private repo with credentials Register HTTPS repo with creds; modern: --ssh-private-key-path for SSH-based access argocd repo add https://git.example.com/repo.git --username <id> --password $TOKEN #argocd#gitops#secrets#security Patch app spec inline Merge-patch app spec without editing the CR; useful to bump targetRevision fast argocd app patch <name> --patch '{"spec":{"source":{"targetRevision":"v2.1"}}}' --type merge #argocd#gitops#k8s#troubleshooting Terminate stuck sync operation Cancel an in-progress sync stuck on a hook or pending resource argocd app terminate-op <name> #argocd#troubleshooting#debug#k8s Run resource restart action Trigger a Deployment rollout restart through Argo's resource actions argocd app actions run <name> restart --kind Deployment --resource-name <id> #argocd#k8s#troubleshooting Add project sync window Create a deny sync window to freeze deploys during off-hours; cron-based schedule argocd proj windows add <name> --kind deny --schedule '0 0 * * *' --duration 8h --applications '*' #argocd#gitops#ci#security Enable prune and server-side apply Set sync options for safe prune and SSA; note: SSA fixes large-CRD apply conflicts argocd app set <name> --sync-option Prune=true --sync-option ServerSideApply=true #argocd#gitops#k8s Backup all Argo objects Export/import all apps, projects and settings for DR; cluster-secret aware argocd admin export -n argocd > argo-backup.yaml # restore: argocd admin import -n argocd - < argo-backup.yaml #argocd#gitops#secrets#k8s Partial sync of single resource Sync only one resource by group:kind:name; isolates a fix without full app sync argocd app sync <name> --resource apps:Deployment:<id> #argocd#gitops#troubleshooting#k8s
no commands match