Cheat Sheets / CI/CD & GitOps

Argo CD cheat sheet

68 commands from every lesson of Argo CD — Level by Level, on one page.

01 · GitOps principles & Argo CD architecture

GitOps principles (OpenGitOps)

DeclarativeThe desired state is described, not scripted
Versioned and immutableStored in Git: history, review, rollback
Pulled automaticallyAgents in the cluster fetch the desired state
Continuously reconciledAgents keep correcting drift

Argo CD components

argocd-serverAPI, web UI, CLI and SSO endpoint
argocd-repo-serverClones repos and renders manifests (plain YAML, Helm, Kustomize, plugins)
argocd-application-controllerCompares live vs desired, syncs, reports health
argocd-applicationset-controllerGenerates Applications from templates
argocd-redis / argocd-dex-serverCache / optional SSO connector

02 · Installing Argo CD & the first app

Install & log in

kubectl create namespace argocdNamespace for Argo CD
kubectl apply -n argocd --server-side --force-conflicts -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yamlInstall (non-HA; check the docs for your version)
argocd admin initial-password -n argocdInitial admin password
kubectl port-forward svc/argocd-server -n argocd 8080:443Reach the UI/API locally
argocd login localhost:8080 --insecureCLI login (lab only: self-signed cert)

Applications

argocd app list / argocd app get guestbookStatus of apps
argocd app diff guestbookLive vs Git
argocd app sync guestbookSync now
argocd app history guestbookDeployed revisions
kubectl get applications -n argocdApplications are just custom resources

03 · App-of-Apps pattern

Pattern

root Application → path: apps/The directory holds child Application manifests
kubectl apply -f root-app.yamlThe only manual step when bootstrapping
resources-finalizer.argocd.argoproj.ioFinalizer: deleting the Application deletes its resources

Projects

spec.sourceReposWhich repos a project's apps may use
spec.destinationsWhich clusters/namespaces they may deploy to
spec.clusterResourceWhitelistWhich cluster-scoped kinds are allowed (none by default for new projects)
argocd proj list / argocd proj get platformInspect projects

04 · Helm & Kustomize with Argo CD

Helm source

source.chart + targetRevisionA chart from a Helm repo, pinned
source.helm.valueFiles: [ values-prod.yaml ]Values files from the same source
source.helm.valuesObject: {…}Inline values
sources: [ {chart…}, {repoURL…, ref: values} ] + $values/…Chart from one repo, values from another

Kustomize source

path: overlays/prodPoint the Application at an overlay
kustomize build overlays/prodPreview locally what Argo CD will render
kustomize edit set image shop=registry.example.com/shop:1.4.2Bump an image tag in an overlay

05 · Multi-cluster management

Clusters

argocd cluster add <kube-context> --name edge-01Register a cluster (creates a ServiceAccount in it and a cluster Secret in argocd)
argocd.argoproj.io/secret-type: clusterLabel on declarative cluster Secrets
argocd cluster listRegistered clusters and their status

ApplicationSets

generators: - clusters: { selector: { matchLabels: { env: prod } } }One app per matching cluster
generators: - git: { directories: [ { path: apps/* } ] }One app per folder
generators: - matrix: { generators: [ … , … ] }Every combination of two generators
goTemplate: true → '{{.name}}', '{{index .metadata.labels "env"}}'Go template syntax
argocd appset list / kubectl get applicationsets -n argocdInspect ApplicationSets

06 · Sync policies, hooks & waves

Ordering

argocd.argoproj.io/sync-wave: "-1"Lower waves apply first (default 0); each wave must be healthy before the next
argocd.argoproj.io/hook: PreSync | Sync | PostSync | SyncFail | PostDeleteRun a resource (usually a Job) as a hook
argocd.argoproj.io/hook-delete-policy: HookSucceeded | HookFailed | BeforeHookCreationWhen to delete hook resources

Safety

argocd.argoproj.io/sync-options: Prune=falseNever prune this resource
argocd.argoproj.io/sync-options: Delete=falseKeep it even when the app is deleted
syncOptions: [ ServerSideApply=true, PruneLast=true, RespectIgnoreDifferences=true ]Common app-level options
spec.ignoreDifferences (e.g. /spec/replicas with an HPA)Don't fight other controllers
AppProject spec.syncWindowsAllow/deny syncs by schedule

07 · Production patterns

Access

argocd-cm: oidc.config (or dex.config)SSO with your identity provider
argocd-cm: admin.enabled: "false"Disable the local admin after SSO works
argocd-rbac-cm: policy.default: role:readonlyDefault role for logged-in users
p, role:shop-dev, applications, sync, shop/*, allowAllow syncing apps in project shop
g, shop-devs, role:shop-devMap an IdP group to a role
argocd admin settings rbac can role:shop-dev sync applications 'shop/cart' --policy-file policy.csvTest a policy offline

Operations

notifications.argoproj.io/subscribe.on-sync-failed.slack: platform-alertsSubscribe an app to a notification trigger
argocd_app_info{sync_status,health_status}Metric for alerting on OutOfSync/Degraded apps
manifests/ha/install.yaml or the Helm chart with HA valuesHighly available install

08 · Troubleshooting Argo CD

Look

argocd app get orders-api --show-operationStatus, conditions and the last sync operation
argocd app diff orders-apiWhat Argo CD thinks differs
argocd app resources orders-apiEvery resource with its sync and health status
argocd app manifests orders-api --source gitThe manifests Argo CD rendered from Git
kubectl -n argocd logs deploy/argocd-repo-server --tail=100Manifest generation errors (Helm/Kustomize)
kubectl -n argocd logs statefulset/argocd-application-controller --tail=100Sync, diff and health errors

Act

argocd app get orders-api --hard-refreshRe-render from Git, bypassing the cache
argocd app terminate-op orders-apiStop a stuck sync operation
argocd app sync orders-api --resource apps:Deployment:orders-apiSync just one resource
argocd app sync orders-api --retry-limit 3Retry a sync that hit a transient error