Argo CD Hour 1: GitOps and Argo CD Core
- First, master GitOps itself (tool-independent): use the OpenGitOps four principles (declarative, versioned and immutable, automatically pulled, continuously reconciled) to judge whether a delivery workflow “is GitOps”, and to explain push-based CI/CD and pull-based GitOps the differences in credentials, drift and auditing; understand why “running kubectl apply in CI” does not count as GitOps, as well as the benefits and costs of GitOps.
- Compare the two mainstream implementations Argo CD and Flux (object model, UI, multi-tenancy, multi-cluster, Helm handling), and know which to choose in which scenario; this course then goes deep on Argo CD.
- Draw the Argo CD component diagram: API Server, Repo Server, Application Controller, Redis, and the roles of ApplicationSet Controller, Dex and Notifications Controller; be able to explain clearly one reconciliation loop and what each component does in it.
- Use the official Helm chart (
argo/argo-cd10.18.0) to install Argo CD v3.6.1 into a kind clusterlab, get the initial password and log in with theargocdCLI; understand what “core mode” is and when to use it. - Set up the gitops-lab repository skeleton that runs through all 8 hours (Kustomize base + dev/staging/prod overlays), and create the first Application both with the CLI and with declarative YAML
podinfo-dev. - Read Sync Status (Synced / OutOfSync / Unknown) and Health Status (Healthy / Progressing / Degraded / Suspended / Missing / Unknown) combined meanings, and use diff, refresh, hard refresh, and manual and automatic sync.
- Understand selfHeal, prune and drift: who gets reverted, who gets deleted, and who is not managed; use the troubleshooting tree to locate
ComparisonError, such as OutOfSync or Progressing that won't go away, and other beginner-level issues.
lab, Deployment / Service / probes) and Helm 8 hours(charts, values,helm upgrade --install). Hour 5 of the Helm course already covered deploying charts with Argo CD and Flux hands-on. This course is a systematic deep dive into GitOps and Argo CD: Module 1 first explains the GitOps principles and the architectural differences between Argo CD and Flux, then uses Argo CD as the main thread, starting from the mechanics without repeating introductory operations.1-hour time allocation
| # | Time | Module | Core content | Animation / interaction | Lab (kind cluster lab) |
|---|---|---|---|---|---|
| 0 | Before class | Environment setup | kind cluster lab, Helm, argocd CLI, GitHub repo gitops-lab skeleton (podinfo base + 3 overlays) | Environment self-check list | Push the repo skeleton,kustomize build local validation |
| 1 | 00–06 | GitOps principles | OpenGitOps four principles, push vs pull, what GitOps is not, benefits and costs,Argo CD vs Flux | Push / pull deployment comparison animation (credentials and drift) | Manually create drift and observe that push-based deployment cannot detect it |
| 2 | 06–13 | Argo CD architecture | API Server, Repo Server, Application Controller, Redis, ApplicationSet, Dex, Notifications; CRDs; reconciliation triggers | Core animation: one complete reconciliation loop | Check component Pods and logs one by one |
| 3 | 13–21 | Install Argo CD | Helm chart vs official manifests, values file, CRD lifecycle, initial password, port-forward, CLI login, core mode | helm install component readiness simulation | Install v3.6.1, log in to the UI and CLI, change the password |
| 4 | 21–28 | First Application | source (repoURL / targetRevision / path), destination, project, syncOptions, finalizer | Application field builder (live YAML generation and validation) | CLI creation podinfo-dev and manual sync |
| 5 | 28–35 | State model | Sync Status × Health Status, resource-level and application-level health, v3 no longer writes health status into the CR | Event → state combination simulator | Produce Degraded (wrong image) and Missing |
| 6 | 35–42 | Diff, refresh and sync | diff rules, normal / hard refresh, polling every 120s + 60s jitter, Webhook, manual vs automatic sync, sync retries | Change detection timeline (polling / Webhook / manual refresh) | Git commit upgrade 6.16.0 → 6.17.0 |
| 7 | 42–50 | Self-heal and prune | selfHeal, prune, allowEmpty, resource tracking (v3 default annotations), drift types, what will not be reverted | Drift simulator (toggle selfHeal / prune) | kubectl scale gets reverted, deleted files get pruned |
| 8 | 50–60 | Readiness review and introductory troubleshooting | Pre-launch checklist, common errors, diagnostic command order, component logs | Readiness scorecard + interactive troubleshooting tree | Reproduce and fix 3 common failures |
| — | After class | Cheat sheet · Comprehensive lab | declarative argocd/apps/podinfo-dev.yaml, drift and self-heal, prune acceptance | Final quiz (12 questions) | Comprehensive lab |
Knowledge Coverage Matrix
| Target skills | M1 | M2 | M3 | M4 | M5 | M6 | M7 | M8 | Key commands | Lab |
|---|---|---|---|---|---|---|---|---|---|---|
| Compare Argo CD and Flux and make a selection | ✓ | ✓ | ✓ | · | · | · | · | · | argocd vs flux CLI | Scenario questions |
| Judge whether a workflow complies with GitOps principles | ✓ | · | · | · | · | · | ✓ | ✓ | git log,argocd app history | Drift comparison |
| Explain component responsibilities and the reconciliation loop | · | ✓ | ✓ | · | ✓ | ✓ | · | ✓ | kubectl -n argocd get pods,logs | Component inspection |
| Install / upgrade Argo CD with Helm | · | · | ✓ | · | · | · | · | ✓ | helm upgrade --install | Install v3.6.1 |
| CLI login and account security | · | · | ✓ | · | · | · | · | ✓ | argocd login,account update-password | Change the initial password |
| Write an Application (source / destination / options) | · | · | · | ✓ | · | ✓ | ✓ | · | argocd app create,kubectl apply | podinfo-dev |
| Kustomize base / overlay repository layout | ✓ | · | · | ✓ | · | ✓ | · | · | kubectl kustomize | gitops-lab skeleton |
| Read Sync / Health status | · | ✓ | · | ✓ | ✓ | ✓ | ✓ | ✓ | argocd app get | Degraded / Missing |
| Diff, refresh, manual / automatic sync | · | ✓ | · | ✓ | · | ✓ | ✓ | · | app diff,app sync,--hard-refresh | Version upgrade |
| Drift, self-heal and prune | ✓ | · | · | · | · | ✓ | ✓ | ✓ | app set --self-heal --auto-prune | scale gets reverted |
| Beginner troubleshooting (ComparisonError, etc.) | · | ✓ | ✓ | ✓ | ✓ | · | · | ✓ | app get, component logs | reproduce 3 failures |
What this course does not cover (and where to learn it)
| Topic | Why it is not in this course | Where to learn |
|---|---|---|
| Helm / multi-source Applications, Sync Waves, hooks, sync option details, ignoreDifferences | belongs to “manifest sources and sync control”; this course only uses single-source Kustomize | Hour 2 |
| App of Apps, ApplicationSet generators | This course manages only one application | Hour 3 |
multi-cluster (lab2), AppProject, RBAC, SSO | This course uses default projects and the local admin account | Hour 4 |
| Sealed Secrets, External Secrets, SOPS | podinfo does not need secrets | Hour 5 |
| Argo Rollouts, Image Updater, Notifications, Kargo | progressive delivery and automation | Hour 6 |
| HA, controller sharding, performance tuning, deep troubleshooting | This course only installs a single-replica lab environment | Hour 7 |
| Flux installation and use (HelmRelease, OCI, AKS GitOps extension) | This course only does an architecture comparison (Module 1); the main thread is Argo CD | Helm course Hour 5 · AKS course Hour 5 |
| How CI modifies Git (image tag commits, PR workflow) | belongs to the CI topic | GitHub 8 hours · GitLab 8 hours |
How to use this courseware
Theory · diagrams · animation · commands · labs · production cases · troubleshooting · quiz · voice · video. Suggested: read “Theory” and “Animation” first, then do the “Lab” hands-on. The reconciliation loop animation in Module 2 is the course's “map”; every later module returns to it.
A quiz score of ≥ 70% or clicking “Mark this module complete” counts toward progress, saved in this browser (cleared on refresh if local storage is disabled).
The “Voice” page reads the narration script aloud with the browser's built-in Web Speech API (en-US), with English terms pronounced in en-US; without a Chinese voice pack, the script can still be read or passed to a TTS tool.
argo/argo-cd 10.18.0 (2026-11-11, appVersion v3.6.1). Patch lines still maintained are v3.5.7, v3.4.13 and v3.3.19 (2026-11-02). Readers upgrading from v2 should pay special attention to the v3.0 behavior changes: use annotations by default for resource tracking,viewing logs requires explicitly logs, get permissions,update/delete fine-grained RBAC no longer inherited by managed resources,argocd-cm in the repositories and other legacy repo configuration removed; resource health status is no longer written to the Application CR by default,ignoreResourceStatusField default becomes all. The cluster is kind v0.33.0's default Kubernetes v1.37.0; the official Argo CD “tested Kubernetes versions” table follows the release notes.Module 0 · Environment setup: kind cluster, tools and gitops-lab repo
lab, Argo CD (installed in Module 3), your own GitHub repo gitops-lab- Lab machine: Ubuntu 24.04 (Azure VM
Standard_D4s_v5or local machine), or macOS / Windows WSL2; Docker Engine / Docker Desktop available, with at least 4 vCPU and 8 GiB RAM (all Argo CD components + podinfo's 3 environments use about 1.5–2 GiB). - Tools:
kubectl1.37,kindv0.33.0,helm(the Helm course uses v4; v3.x can also install this chart),git,argocdCLI v3.6.1 (step 2 on this page). - A GitHub account, used to create the repo
gitops-lab(a public repo is recommended so this course does not handle credentials; for private repos see Module 4 troubleshooting).
lab (context kind-lab, 1 control-plane + 2 workers), reuse it directly; namespaces already in it shop will not affect this course. If you have no results from the previous course, follow step 1 below to create one from scratch; this is the course's “minimum starting point”.
Step 1: create (or reuse) the kind cluster lab
kind get clusters # if lab already exists, skip to step 2 mkdir -p ~/gitops-lab/bootstrap cat > ~/gitops-lab/bootstrap/kind-lab.yaml <<'EOF' kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 name: lab nodes: - role: control-plane image: kindest/node:v1.37.0@sha256:a1ed56cfb0e7b93589bdf97c8cd566405a265939e3620fc4f5de89adff580ae5 - role: worker image: kindest/node:v1.37.0@sha256:a1ed56cfb0e7b93589bdf97c8cd566405a265939e3620fc4f5de89adff580ae5 - role: worker image: kindest/node:v1.37.0@sha256:a1ed56cfb0e7b93589bdf97c8cd566405a265939e3620fc4f5de89adff580ae5 EOF kind create cluster --config ~/gitops-lab/bootstrap/kind-lab.yaml kubectl config use-context kind-lab kubectl get nodes
Creating cluster "lab" ... ✓ Ensuring node image (kindest/node:v1.37.0) 🖼 ✓ Preparing nodes 📦 📦 📦 ... Set kubectl context to "kind-lab" NAME STATUS ROLES AGE VERSION lab-control-plane Ready control-plane 60s v1.37.0 lab-worker Ready <none> 40s v1.37.0 lab-worker2 Ready <none> 40s v1.37.0
The kind config file is placed under bootstrap/ , so that “how to rebuild the cluster” itself enters Git; this is the first step of GitOps thinking. Node image digests match the Kubernetes course (the v1.37.0 image given in the kind v0.33.0 release notes).
Step 2: install the argocd CLI v3.6.1
# Linux amd64 (macOS can use brew install argocd; check the version)
VERSION=v3.6.1
curl -sSL -o /tmp/argocd https://github.com/argoproj/argo-cd/releases/download/${VERSION}/argocd-linux-amd64
sudo install -m 555 /tmp/argocd /usr/local/bin/argocd
rm /tmp/argocd
argocd version --client --short
argocd: v3.6.1+<commit>
federated_claims.user_id, and the official upgrade notes require using the new CLI to obtain tokens containing the correct claims; this is used in Hour 4 when doing SSO.Step 3: create GitHub repo gitops-lab and write the skeleton
Create a new one on the GitHub website empty repo gitops-lab (do not tick README), then initialize it locally. All the files below are the directory conventions shared by Hours 1–8; later courses will only add content into them.
cd ~/gitops-lab
git init -b main
mkdir -p apps/podinfo/base apps/podinfo/overlays/{dev,staging,prod} \
argocd/apps argocd/appsets argocd/projects bootstrap
touch argocd/appsets/.gitkeep argocd/projects/.gitkeep
gitops-lab/
├── README.md
├── apps/
│ └── podinfo/
│ ├── base/ # Kustomize base: Deployment + Service
│ │ ├── kustomization.yaml
│ │ ├── deployment.yaml
│ │ └── service.yaml
│ └── overlays/
│ ├── dev/kustomization.yaml # podinfo-dev, 1 replica, 6.16.0
│ ├── staging/kustomization.yaml # podinfo-staging, 2 replicas
│ └── prod/kustomization.yaml # podinfo-prod, 3 replicas
├── argocd/
│ ├── apps/ # Application manifests (this lesson: podinfo-dev.yaml)
│ ├── appsets/ # ApplicationSet (Hour 3)
│ └── projects/ # AppProject (Hour 4)
└── bootstrap/
├── kind-lab.yaml # cluster definition
└── argocd-values.yaml # Argo CD Helm values (Module 3)
apps/podinfo/base/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: podinfo
labels:
app.kubernetes.io/name: podinfo
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: podinfo
template:
metadata:
labels:
app.kubernetes.io/name: podinfo
spec:
containers:
- name: podinfod
image: ghcr.io/stefanprodan/podinfo:6.17.0
ports:
- name: http
containerPort: 9898
protocol: TCP
env:
- name: PODINFO_UI_MESSAGE
value: "hello from base"
readinessProbe:
httpGet:
path: /readyz
port: http
periodSeconds: 5
livenessProbe:
httpGet:
path: /healthz
port: http
periodSeconds: 10
resources:
requests:
cpu: 10m
memory: 32Mi
limits:
memory: 128Mi
apps/podinfo/base/service.yaml
apiVersion: v1
kind: Service
metadata:
name: podinfo
labels:
app.kubernetes.io/name: podinfo
spec:
type: ClusterIP
selector:
app.kubernetes.io/name: podinfo
ports:
- name: http
port: 9898
targetPort: http
protocol: TCP
apps/podinfo/base/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - deployment.yaml - service.yaml
apps/podinfo/overlays/dev/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: podinfo-dev
resources:
- ../../base
images:
- name: ghcr.io/stefanprodan/podinfo
newTag: "6.16.0" # Module 6 upgrades this via a Git commit to 6.17.0
replicas:
- name: podinfo
count: 1
patches:
- target:
kind: Deployment
name: podinfo
patch: |-
- op: replace
path: /spec/template/spec/containers/0/env/0/value
value: "hello from dev"
apps/podinfo/overlays/staging/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: podinfo-staging
resources:
- ../../base
images:
- name: ghcr.io/stefanprodan/podinfo
newTag: "6.16.0"
replicas:
- name: podinfo
count: 2
patches:
- target:
kind: Deployment
name: podinfo
patch: |-
- op: replace
path: /spec/template/spec/containers/0/env/0/value
value: "hello from staging"
apps/podinfo/overlays/prod/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: podinfo-prod
resources:
- ../../base
images:
- name: ghcr.io/stefanprodan/podinfo
newTag: "6.16.0"
replicas:
- name: podinfo
count: 3
patches:
- target:
kind: Deployment
name: podinfo
patch: |-
- op: replace
path: /spec/template/spec/containers/0/env/0/value
value: "hello from prod"
- op: replace
path: /spec/template/spec/containers/0/resources/limits/memory
value: 256Mi
README.md
# gitops-lab GitOps repository for the 8-hour Argo CD course (default branch main). - apps/ workload manifests (Kustomize / Helm); Argo CD reads the desired state from here - argocd/ Argo CD's own objects: apps/ (Application), appsets/, projects/, root.yaml - bootstrap/ bootstrap files: kind cluster definition, Argo CD Helm values Rule: every change to the cluster goes through a Pull Request merged into main; no direct kubectl apply.
Step 4: local validation and push
cd ~/gitops-lab kubectl kustomize apps/podinfo/overlays/dev | grep -E 'namespace:|image:|replicas:|hello from' git add -A git commit -m "gitops-lab skeleton: podinfo base + dev/staging/prod overlays" git remote add origin https://github.com/<you>/gitops-lab.git git push -u origin main
namespace: podinfo-dev
namespace: podinfo-dev
replicas: 1
value: hello from dev
image: ghcr.io/stefanprodan/podinfo:6.16.0
<you> with your GitHub username; all following https://github.com/<you>/gitops-lab.git is the same. kubectl kustomize Use the Kustomize built into kubectl; Argo CD's repo-server renders with its own bundled kustomize binary, so the two versions may differ. Hour 2 explains how to pin the version. Note that the base image is 6.17.0, and the dev overlay uses images.newTag changed to 6.16.0 — this is so that Module 6 can demonstrate an “upgrade” with a single Git commit.Warm-up: answer from memory (30 seconds)
What does a Kubernetes “controller” do?
An infinite loop: watch the actual state → compare it with the desired state (spec) → take action to close the gap → write back status. Argo CD's Application Controller extends this same pattern to “desired state in Git vs actual state in the cluster”.
helm upgrade --install Afterwards, someone kubectl edit changed the replica count. Will Helm know?
No. Helm only compares when you run a command (three-way merge); normally no process watches the cluster. This is exactly the “drift” problem Module 1 addresses.
Module 1 · GitOps principles: declarative, versioned, pull-based, continuously reconciled
- Recite and explain the four OpenGitOps principles: Declarative, Versioned and Immutable, Pulled Automatically, Continuously Reconciled.
- Compare push-based (inside CI,
kubectl apply/helm upgrade) and pull-based (in-cluster agent) deployment in terms of credential exposure, drift detection, rollback and auditing. - Recognize “pseudo-GitOps”: YAML in Git but pushed by CI, someone bypassing Git to change the cluster directly, or Git holding only templates with no fixed version; weigh the benefits and costs of GitOps.
- Compare Argo CD and Flux by object model, UI, multi-tenancy, multi-cluster and Helm handling Argo CD and Flux, and make a selection for a given scenario.
What: what GitOps is
GitOps is an operations model: the system's desired state is stored as declarative files in a version control system (usually Git), and a software agent running in the target environment automatically pulls these declarations and continuously reconciles the actual state to the desired state. The OpenGitOps working group under CNCF summarizes this as 4 principles (v1.0.0):
| Principle | Key points of the original text | How it appears in Argo CD | Typical symptoms when violated |
|---|---|---|---|
| 1. Declarative | The system's desired state is expressed declaratively | Kubernetes manifests, Kustomize, Helm chart + values; the Application itself is also a CR | Deployment relies on a chain of imperative scripts (kubectl scale,set image) |
| 2. Versioned and Immutable | Storage of the desired state is enforced as immutable and versioned, with full history retained | Git commit SHA; targetRevision resolved to a concrete SHA and recorded in sync history | Images used with latest; chart version not pinned; force push rewrites history |
| 3. Pulled Automatically | A software agent automatically pulls desired-state declarations from the source | repo-server periodically git fetch (default 120s + up to 60s jitter), or triggered by a Webhook | CI holds cluster-admin credentials and “pushes” changes in |
| 4. Continuously Reconciled | The agent continuously observes the actual state and attempts to apply the desired state | Application Controller watches the cluster, computes the diff, auto-syncs + selfHeal | Aligned only at deploy time; later manual changes go unnoticed (drift) |
Why: why GitOps
- Security: with pull-based deployment, cluster credentials never leave the cluster; CI only needs Git write access (push a commit or open a PR), not a kubeconfig.
- Auditable and rollback-able: every change is a commit (who, when, why, who approved), and rollback is just
git revert. - Drift detection and self-heal: the controller compares continuously; manual changes show as OutOfSync, and with selfHeal enabled they are automatically reverted.
- Disaster recovery: a new cluster with Argo CD installed, pointed at the same repo, can rebuild all applications (Hour 3, App of Apps).
- Developer experience: developers only deal with Git / PRs; the platform team sets boundaries through repo structure and AppProject.
How: the lifecycle of a change
Developer commits code → CI builds and pushes the image podinfo:6.17.0 → CI (or a human, or Image Updater) commits to gitops-lab the commit “change dev's newTag to 6.17.0” → merged into main → Argo CD detects the new commit at the next poll or Webhook → repo-server renders the manifests → controller computes the diff → sync (kubectl apply semantics) → health check → status and history written back to the Application.
When: when it fits / does not fit
- Suitable: applications and platform components on Kubernetes (Ingress controllers, cert-manager, monitoring stacks), multi-environment / multi-cluster setups, teams with audit requirements.
- Needs extra design: secrets (cannot be stored in plaintext in Git; Hour 5), database schema migrations (hooks and Sync Waves; Hour 2), production releases that need manual approval (PR approval + sync windows).
- Not a great fit: frequently changing runtime data (current HPA replica count, Job instances), cloud resources themselves (usually Terraform, or Crossplane to turn them into K8s resources and then GitOps them).
Comparison with similar technologies
| Push-based CI/CD (kubectl / helm in CI) | Argo CD | Flux CD | |
|---|---|---|---|
| Who performs the deployment | CI runner (outside the cluster) | Application Controller inside the cluster | kustomize-controller / helm-controller inside the cluster |
| Where cluster credentials live | In CI secret variables | In-cluster ServiceAccount | In-cluster ServiceAccount |
| Drift detection | None (only overwritten at the next deployment) | Continuous comparison + visual diff in UI + selfHeal | Continuous reconciliation (periodic re-apply) |
| Interface | CI logs | Web UI, CLI, API, multi-tenant RBAC | Mainly CLI; UI needs a third party |
| Helm semantics | A real Helm release | helm template Rendered and then applied by Argo CD (no Helm release record) | helm-controller uses the Helm SDK and keeps the release |
Note: the OpenGitOps original text says “state store” and does not require Git. OCI image registries (Flux's OCIRepository, Argo CD's OCI sources) can equally satisfy “versioned and immutable”. Git is just the most common implementation.
What GitOps is not
| Looks like GitOps | Which principle is missing | Why it does not count |
|---|---|---|
Runs after CI merges kubectl apply -f k8s/ or helm upgrade | ③ pull, ④ continuous reconciliation | Deployment happens only at the moment the pipeline runs; CI holds cluster credentials; later drift goes unnoticed |
YAML is in Git, but people often also use kubectl edit to change production | ② source of truth | Git is no longer the only source of truth; rolling back to a commit cannot reproduce the real state |
Manifest references image: app:latest, chart version written * | ② immutable | The same commit renders different results at different times |
Deployment script deploy.sh calls the API step by step | ① declarative | Describes “how to do it”; the agent cannot compare “desired vs actual” |
A CronJob in the cluster runs every hour kubectl apply once | ④ (partial) | Close to pull-based, but has no diff detection, health assessment, status feedback or pruning; deleted files stay in the cluster forever |
Benefits and costs
- Credentials never leave the cluster; CI only needs Git write access
- Changes = PRs: review, approval, audit, rollback (
git revert) - Drift is visible and self-healing
- Disaster recovery: a new cluster pointed at the same repo can be rebuilt
- Environment differences made explicit (diff of overlays / values)
- One more platform component that must be operated, upgraded and monitored
- Secrets cannot be stored in plaintext in Git; extra tooling is needed (Hour 5)
- “Emergency manual changes” need a process (pause auto-sync / commit afterwards)
- Repo structure, branches and promotion strategy must be designed (environments = directories, not branches)
- Debugging chain gets longer: Git → render → diff → apply → health
Argo CD vs Flux: two mainstream GitOps implementations
Both are CNCF graduated projects and both satisfy the four principles. This course chooses Argo CD; Flux was already practiced in Hour 5 of the Helm course(HelmRelease, OCI charts) and Hour 5 of the AKS course(the AKS GitOps extension microsoft.flux). Here it is only compared at the architecture level, without re-teaching. Verified versions: Argo CD v3.6.1 (2026-11-04), Flux v2.10.0 (2026-10-26).
| Dimension | Argo CD | Flux (v2 / GitOps Toolkit) |
|---|---|---|
| Core API objects | Application (one source → one target),ApplicationSet (template + generator),AppProject (boundary) | Sources: GitRepository / OCIRepository / HelmRepository / Bucket; applications: Kustomization,HelmRelease; plus notification and image-automation CRDs |
| Architecture | All-in-one: API Server + Repo Server + Application Controller + Redis | A set of independent controllers: source-controller, kustomize-controller, helm-controller, notification-controller, image-reflector / image-automation-controller |
| Interface | Built-in Web UI (resource tree, diff, logs, manual sync), CLI, API | Mainly CLI (flux) and CRDs; UI comes from third parties or cloud platforms (such as the GitOps view in the Azure portal) |
| Multi-tenancy model | Argo CD's own RBAC (Casbin policies) + SSO groups + AppProject restricting source / destination / resource kinds | Entirely relies on Kubernetes RBAC: each tenant's Kustomization / HelmRelease uses serviceAccountName impersonating a restricted SA |
| Multi-cluster | Commonly hub-and-spoke: one Argo CD manages multiple registered clusters (or one per cluster) | Commonly one per cluster Flux, each pulling from the same repo; remote clusters can also be referenced with kubeConfig |
| Helm handling | repo-server uses helm template to render plain manifests and then apply them: no Helm release record,helm list not visible; Helm hooks are mapped to Argo CD hooks, and lookup and similar functions behave differently | helm-controller uses Helm SDK to perform the real install / upgrade: keeps release history and supports Helm-native hooks, tests and failure rollback (remediation) |
| Drift handling | Continuous comparison, UI shows the diff; corrected immediately when selfHeal is on | Re-applied periodically by interval ; HelmRelease can enable drift detection |
| Bootstrap method | Helm / manifest install (this course), can self-manage later | flux bootstrap Commit Flux's own manifests to Git and self-manage |
microsoft.flux). Avoid letting both manage the same object; they will keep “correcting” each other.kubectl apply, the “pull” and “continuous reconciliation” parts are missing, and manual changes will not be detected. ② “GitOps means you cannot use kubectl” — read operations during troubleshooting are perfectly fine, and in an emergency you can change things temporarily, but then either commit to Git afterwards or accept that selfHeal will revert them. ③ “GitOps only applies to Kubernetes” — the principles are platform-independent; Kubernetes's declarative API and controller pattern simply make it easiest to adopt. ④ “With Argo CD you no longer need CI” — building, testing and image scanning remain in CI; GitOps takes over only the “deployment” stage.Comparison diagram: push vs pull
Principle relationship diagram: all four principles are required
Interactive animation: the different outcomes of the same “manually change the replica count” under push vs GitOps
Click “Next” to step through. The left is the push-based pipeline; the right is Argo CD (with automatic sync and selfHeal enabled). Observe where the credentials live and whether the drift is detected.
Commands related to this module (conceptual level)
| Command | Purpose | GitOps perspective |
|---|---|---|
git log --oneline -- apps/podinfo/overlays/dev | View the change history of the dev environment | “Who changed dev, and when” — auditing is the Git history |
git revert <sha> | Generate a reverse commit | The recommended GitOps rollback method (keeps Git = cluster) |
kubectl diff -k apps/podinfo/overlays/dev | Compare the local manifests with the cluster | a one-off manual comparison; Argo CD turns it into a continuous, automatic one |
argocd app history podinfo-dev | sync history (each entry corresponds to a Git SHA) | trace back from a deployment to its commit |
argocd app diff podinfo-dev | Git render output vs live cluster state | direct evidence of drift (Module 6) |
# Experience “without GitOps, drift cannot be detected” (do this before installing Argo CD in Module 3) kubectl create namespace drift-demo kubectl apply -k ~/gitops-lab/apps/podinfo/base -n drift-demo kubectl -n drift-demo scale deploy podinfo --replicas=3 # “emergency manual scale-out” kubectl diff -k ~/gitops-lab/apps/podinfo/base -n drift-demo; echo "exit=$?"
deployment.apps/podinfo scaled diff -u -N /tmp/LIVE-1234/apps.v1.Deployment.drift-demo.podinfo /tmp/MERGED-5678/apps.v1.Deployment.drift-demo.podinfo @@ -6,7 +6,7 @@ - generation: 2 + generation: 3 ... - replicas: 3 + replicas: 1 exit=1
Note:kubectl diff It only tells you about drift if you remember to run it; exit code 1 means there is a difference. Common errors: Writing -k as -f pointing at a directory bypasses Kustomize and parses kustomization.yaml directly, which errors. Cleanup:kubectl delete namespace drift-demo.
Lab 1: do a GitOps health check on your current deployment workflow (about 4 minutes)
kubectl get deploy -n drift-demo (3/3), whereas Git says 1.gitops-lab/README.md end as a team convention):
## GitOps health check 1. Declarative: can the environment's entire desired state be rendered from the repo alone? (Can kubectl kustomize produce the complete manifests?) 2. Versioned: are image tags pinned (no latest)? Is force push to main forbidden? 3. Pull-based: does CI still hold the production cluster kubeconfig? 4. Continuous reconciliation: how long until a manual change is detected? Who gets notified?
kubectl delete namespace drift-demo cd ~/gitops-lab && git add README.md && git commit -m "docs: gitops checklist" && git push
Case 1: a kubeconfig leaked from CI
Problem: A team stored the production cluster's cluster-admin kubeconfig in CI variables, and a poisoned third-party Action read it and exfiltrated it. Approach: Migrate to Argo CD pull-based deployment: CI only has gitops commit access to the repo (fine-grained PAT or GitHub App), and the cluster API is no longer open to the CI network. Limitation: Git write access itself becomes a new critical asset and must be paired with branch protection, CODEOWNERS and signed commits.
Case 2: a “hotfix” overwritten by the next release
Problem: An on-call engineer fixed a configuration in the middle of the night; kubectl set env the routine release the next day overwrote it and the incident recurred. Approach: After enabling Argo CD, manual changes immediately show as OutOfSync, and with selfHeal enabled they are reverted within seconds. This forces the habit of “open a PR first, then fix”; in emergencies, temporarily turn off auto-sync in the UI and commit afterwards. Limitation: Requires incident process support (who may turn off auto-sync, and how soon a commit must follow).
Case 3: auditors ask “who approved this production change”
Approach: Changes to the production overlay must go through a PR with two-person approval; Argo CD sync history records the Git SHA, so any deployment can be traced back to its PR and approvers. Limitation: If parameter overrides are allowed in the UI during sync, state appears that exists outside Git; production projects should forbid this (Hour 4 RBAC).
Common “pseudo-GitOps” problems and fixes
The version running in the cluster differs from Git, with no alert at all
Cause: Deployment still happens through a push-based pipeline with no continuous comparison; or the Argo CD application has automatic sync off and nobody looks at the UI.
argocd app list -o wide | grep -v Synced
Fix: Bring all environments under Argo CD; at minimum configure notifications for OutOfSync (Hour 6 Notifications).
image: ghcr.io/stefanprodan/podinfo:latest — Git has not changed, but the image in the cluster has
Cause: A mutable tag violates “versioned and immutable”; when Pods were recreated they pulled a new image, which the Git history cannot explain.
Fix: Use a pinned tag or digest (@sha256:); have CI or Image Updater commit the new tag back to Git.
After git push --force to main, Argo CD deployed a “past” version
Cause: After history was rewritten the branch pointed to an old commit, and Argo CD faithfully synced it.
git reflog; argocd app history podinfo-dev
Fix: Restore the correct commit; enable branch protection to forbid force push.
1. With one command, show the commits and authors of the last 5 changes to the dev environment.
git -C ~/gitops-lab log -5 --format='%h %an %ad %s' --date=short -- apps/podinfo/overlays/dev
2. Without Argo CD, check once whether the dev manifests match the cluster, and judge from the exit code.
kubectl diff -k ~/gitops-lab/apps/podinfo/overlays/dev >/dev/null; echo $? # 0 = match, 1 = differences, >1 = error
A team says “we are already GitOps: all YAML is in Git, and GitHub Actions runs helm upgrade after merge.” Please assess this and suggest improvements.
It satisfies declarative and versioned (provided the version is pinned), but not “automatically pulled” or “continuously reconciled”: CI holds cluster credentials, and manual changes go unnoticed. Improvement: deploy Argo CD in the cluster with an Application pointing at the same repo; change CI to only commit image tags; remove the CI kubeconfig; configure notifications for OutOfSync and gradually enable selfHeal. Note that Argo CD renders Helm with helm template , so when migrating, evaluate the differences between Helm hooks and lookup (Hour 2).
A platform team must roll out GitOps for 20 AKS clusters: the dev teams want a UI for self-service viewing of deployment status and diffs; the security team requires SSO and per-team isolation; and one team strongly depends on Helm release history and automatic rollback on failure. Argo CD or Flux?
Choose Argo CD as the main platform: a hub-and-spoke model with one control plane managing 20 clusters, a built-in UI (resource tree, diff), and SSO + RBAC + AppProject for per-team isolation (Hour 4). For the team that depends on native Helm semantics there are two options: evaluate switching to Argo CD hooks and sync retries / Rollouts to replace Helm's automatic rollback; or use Flux's HelmRelease only in their clusters / namespaces (for example via the AKS GitOps extension), but draw a clear boundary so that the same object is managed by only one tool.
Verified instructional videos
Official docs
Video storyboard (about 90 seconds)
This courseware cannot directly generate video / MP3; the storyboard and narration script below can be handed to a video tool.
Scene: a CI pipeline icon holds a key labeled kubeconfig and reaches toward the cluster.
Narration: in push-based deployment, CI carries the cluster key and pushes changes in. The key lives outside the cluster, and nobody watches the drift.
Scene: the key is withdrawn into the cluster, and the Argo CD icon pulls from the Git repository with an arrow.
Narration: GitOps reverses the direction: an agent inside the cluster goes to Git itself to pull the desired state, and CI only needs to change Git.
Scene: someone runs kubectl scale to 5, the replica icon turns yellow, and a few seconds later it returns to 1; the screen shows OutOfSync → Synced.
Narration: continuous reconciliation means any manual change will be detected, and with self-heal enabled it is reverted to what is in Git.
Scene: four cards light up in turn: declarative, versioned, automatically pulled, continuously reconciled.
Narration: all four principles are required. Putting YAML into Git alone is not GitOps.
Module 2 · Argo CD architecture: API Server, Repo Server, Application Controller and Redis
- State each component's responsibility and “what happens when it breaks”: argocd-server (API / UI / auth), argocd-repo-server (fetches Git, renders manifests), argocd-application-controller (compares, syncs, assesses health), Redis (cache).
- State the optional components: ApplicationSet Controller, Dex (SSO), Notifications Controller, Commit Server (used by Source Hydrator).
- Describe one reconciliation loop in order reconciliation loop: trigger → repo-server renders → controller compares with live state → computes Sync / Health → auto-sync / self-heal → writes back Application status.
What: component list
| Component (default resources in the Helm chart) | Type | Responsibility | Stateless? | Behavior on failure |
|---|---|---|---|---|
| argocd-server | Deployment | gRPC / REST API, Web UI, authentication (local accounts / SSO), RBAC decisions; both the CLI and UI call it | Yes | UI / CLI unavailable, but reconciliation continues (the controller does not depend on the server) |
| argocd-repo-server | Deployment | Clones / fetches Git (or Helm / OCI repos), runs Kustomize, Helm (helm template), Jsonnet, CMP plugins, and returns rendered manifests | Yes (has a local Git cache directory) | Applications show ComparisonError, and Sync Status becomes Unknown |
| argocd-application-controller | StatefulSet | Watches the live cluster state (a watch-based cache), compares desired and actual, performs sync, assesses health, and writes back to the Application status | No (can be sharded by cluster; Hour 7) | Status stops updating, no more auto-sync, no more self-heal |
| argocd-redis | Deployment (redis-ha under HA) | Caches render results, application resource trees and cluster info; not a source of truth | Cache (can be lost) | Degraded performance, brief errors; refilled automatically after rebuild |
| argocd-applicationset-controller | Deployment | Creates Applications in bulk from generators (Hour 3) | Yes | ApplicationSet stops generating / updating applications |
| argocd-dex-server | Deployment | SSO proxy (GitHub, LDAP, SAML, etc.; Hour 4) | Yes | SSO login fails; the local admin is unaffected |
| argocd-notifications-controller | Deployment | Sends notifications based on triggers (Slack, Teams, Webhooks; Hour 6); merged into the Argo CD main repo | Yes | Notifications stop being sent |
| argocd-commit-server (optional) | Deployment | Source Hydrator commits rendered results back to Git (introduced in v3; disabled by default in the chart) | Yes | — |
How: one reconciliation loop
- Triggers: ① periodic refresh (default
timeout.reconciliationby default120s, plus up to60sof jitter, i.e. at most about 3 minutes); ② Git Webhook push to argocd-server; ③ the user clicks Refresh / CLI--refresh; ④ the controller sees a managed resource change (this only triggers a “comparison”, with no need to re-fetch Git). - Resolve version: the controller asks repo-server to resolve
targetRevision: mainto a concrete commit SHA. - Render: if the “SHA + source config” is already cached in Redis, it is returned directly; otherwise repo-server fetches that commit, runs
kustomize build(orhelm templateetc.) to get the manifest list, and writes it to the cache. - Compare: the controller compares the desired manifests one by one against its cluster cache (the live objects maintained via watch), normalizing first (ignoring defaults,
ignoreDifferences, status fields, etc.), and derives Synced / OutOfSync for each resource. - Health assessment: runs built-in (or Lua custom) health checks on each resource and aggregates them into the application-level Health.
- Action: if automatic sync is enabled and the application is OutOfSync (and this SHA has not previously failed to sync), the controller starts a sync operation: applies the manifests in order (kubectl apply semantics, or Server-Side Apply); with prune enabled, deletes extra resources; selfHeal makes an “OutOfSync caused only by a cluster change” also trigger a sync.
- Write back: writes
status.sync,status.health,status.operationState,status.historyetc. back to the Application CR; argocd-server pushes the changes to the UI via watch.
v3 change: resource-level health is by default no longer written to status.resources[].health (status.resourceHealthSource: appTree, read from the resource tree in Redis), to reduce writes to etcd; to restore the old behavior, set argocd-cmd-params-cm in controller.resource.health.persist: "true".
CRDs: Argo CD is itself declarative
Application(applications.argoproj.io): a “source → destination” mapping.AppProject: the boundary for a group of applications (allowed repos, target clusters / namespaces, resource kinds). It comes with a built-indefaultproject after installation.ApplicationSet: templates + generators for Applications.- Configuration mainly lives in ConfigMaps / Secrets:
argocd-cm(general settings),argocd-cmd-params-cm(component startup parameters),argocd-rbac-cm(RBAC),argocd-secret, and Secrets withargocd.argoproj.io/secret-type: repository|clusterlabels (repository and cluster credentials).
Comparison with similar technologies
| Argo CD | Flux | kubectl / Helm CLI | |
|---|---|---|---|
| Where rendering happens | A separate repo-server (isolatable, scalable, pluggable) | source-controller fetches + kustomize/helm-controller renders | The operator's own machine |
| Live state | watch cache (whole-cluster resource tree, visualized in UI) | Queried at the reconciliation interval | None |
| Multi-cluster | One control plane manages multiple clusters (cluster Secrets) | Usually one installation per cluster | Multiple kubeconfigs |
Architecture diagram: components and data flow
Sequence diagram: reconciliation loop
Core animation: one reconciliation loop
Choose a trigger scenario, then step through. The highlighted box is the component currently working; the terminal below shows real information (examples) that you would see in the corresponding component logs or CLI. Tick “automated / selfHeal” to observe the branch at step 5.
Commands for observing the components
| Command | Purpose | Notes |
|---|---|---|
kubectl -n argocd get pods,svc,sts,deploy | List all components | The controller is a StatefulSet, and its Pod name is fixed to argocd-application-controller-0 |
kubectl get crd | grep argoproj | View CRDs | applications / applicationsets / appprojects |
kubectl -n argocd logs sts/argocd-application-controller | Reconciliation logs | search Reconciliation completed,Updated sync status |
kubectl -n argocd logs deploy/argocd-repo-server | Render logs | search manifest,git,kustomize |
kubectl -n argocd get cm argocd-cm -o yaml | General configuration | timeout.reconciliation,url, resource tracking method, etc. |
kubectl -n argocd get cm argocd-cmd-params-cm -o yaml | Component parameters | server.insecure,controller.status.processors etc. |
kubectl -n argocd get pods -o wide kubectl -n argocd logs argocd-application-controller-0 --tail=200 | grep -E 'Reconciliation completed|Updated sync status|Updated health status' | tail -5
NAME READY STATUS RESTARTS AGE argocd-application-controller-0 1/1 Running 0 10m argocd-applicationset-controller-6d8b7c9f7d-x2k4p 1/1 Running 0 10m argocd-notifications-controller-7c9c6b8d5f-9bq7m 1/1 Running 0 10m argocd-redis-5b6f8d7c9b-kd8sn 1/1 Running 0 10m argocd-repo-server-7f9d8c6b5d-mz2wq 1/1 Running 0 10m argocd-server-6c8b9f7d4c-p7lrx 1/1 Running 0 10m time="..." level=info msg="Reconciliation completed" application=argocd/podinfo-dev ... comparison-level=1 ... time_ms=48 time="..." level=info msg="Updated sync status: OutOfSync -> Synced" application=podinfo-dev ... time="..." level=info msg="Updated health status: Progressing -> Healthy" application=podinfo-dev ...
How to read:comparison-level indicates how far this reconciliation went (only refreshed the resource tree / compared against cached manifests / re-rendered). Note: This course's values turn off Dex (Module 3), so there is no argocd-dex-server; in the chart, commit-server and redis-ha are off by default; for which components are actually enabled, refer to helm get values argocd -n argocd --all and the actual Pods are authoritative. Log formats and fields may differ slightly between versions.
Lab 2: component “health check” and fault injection (do after installing in Module 3, about 5 minutes)
kubectl -n argocd get deploy,sts,svc kubectl get crd -o name | grep argoproj.io
customresourcedefinition.apiextensions.k8s.io/applications.argoproj.io customresourcedefinition.apiextensions.k8s.io/applicationsets.argoproj.io customresourcedefinition.apiextensions.k8s.io/appprojects.argoproj.io
kubectl -n argocd scale deploy argocd-server --replicas=0 kubectl -n podinfo-dev scale deploy podinfo --replicas=4 # create drift sleep 15; kubectl -n podinfo-dev get deploy podinfo # selfHeal still reverts it to 1 kubectl -n argocd scale deploy argocd-server --replicas=1
NAME READY UP-TO-DATE AVAILABLE AGE podinfo 1/1 1 1 20m
kubectl -n argocd delete pod -l app.kubernetes.io/name=argocd-redis kubectl -n argocd rollout status deploy/argocd-redis argocd app get podinfo-dev --refresh | head -20 # briefly slower, then back to normal
argocd app manifests podinfo-dev --source git | grep -E 'kind:|image:'
--source git shows the desired manifests rendered by repo-server,--source live shows the live objects in the cluster.
Case 1: repo-server OOMKilled causes all applications to be Unknown
Problem: A large Helm chart (hundreds of templates) exceeded repo-server's memory limit while rendering, and every application showed ComparisonError … rpc error: code = Unavailable. Approach: Raise the repo-server memory limit and increase the replica count, and limit concurrent rendering with reposerver.parallelism.limit ; split the giant application. Limitation: Scaling repo-server cannot solve the memory peak of a single huge render; it must be optimized at the manifest structure level (Hour 7).
Case 2: mistaking a frozen UI for an Argo CD outage
Problem: An expired Ingress certificate made the UI unreachable; the on-call engineer restarted the controller, which actually triggered a full re-comparison. Approach: Separate by component: UI / CLI problems look at argocd-server and the Ingress; status not updating looks at the controller; ComparisonError looks at repo-server. Limitation: At large scale, a controller restart costs several minutes of cache rebuilding.
Case 3: security isolation for plugin code
Problem: A team wanted to run custom scripts during rendering. Approach: Run the Config Management Plugin as a sidecar inside the repo-server Pod; repo-server has no cluster access, and a NetworkPolicy allows it to reach only Git. Limitation: A plugin can still read the repository credentials mounted into repo-server, so plugin images must be reviewed (Hours 2 and 5).
Locate problems by component
ComparisonError: rpc error: code = Unavailable desc = connection error: ... dial tcp ...:8081: connect: connection refused
Cause: The controller cannot reach repo-server (port 8081): repo-server is not ready, is restarting from OOM, or is blocked by a NetworkPolicy.
kubectl -n argocd get pods -l app.kubernetes.io/name=argocd-repo-server kubectl -n argocd describe pod -l app.kubernetes.io/name=argocd-repo-server | grep -A5 'Last State'
Fix: Restore repo-server; if it is OOM, raise memory or limit concurrency.
The UI opens, but application status does not change for minutes
Cause: application-controller is unhealthy, its work queue is backed up, or RBAC cannot watch certain resources.
kubectl -n argocd logs argocd-application-controller-0 --tail=100 kubectl -n argocd get pod argocd-application-controller-0
Fix: Check the errors in the logs; in large environments adjust controller.status.processors / controller.operation.processors or shard (Hour 7).
dial tcp: lookup argocd-redis on 10.96.0.10:53: no such host / redis: connection refused
Cause: Redis is not ready, or the Service name is inconsistent (for example, after enabling redis-ha the service name becomes argocd-redis-ha-haproxy).
kubectl -n argocd get svc | grep redis
Fix: Wait for Redis to be ready; when using the Helm chart, let the chart configure the Redis address automatically and do not override it by hand.
1. View the desired manifests and the live manifests for podinfo-dev; each should show only the kind and image lines.
argocd app manifests podinfo-dev --source git | grep -E '^kind:|image:' argocd app manifests podinfo-dev --source live | grep -E '^kind:|image:'
2. View the current periodic refresh interval configuration.
kubectl -n argocd get cm argocd-cm -o jsonpath='{.data.timeout\.reconciliation}{" / jitter "}{.data.timeout\.reconciliation\.jitter}{"\n"}'All applications suddenly show Sync Status = Unknown, but Health is still Healthy and the workloads are normal. Which component is most likely at fault? Why are the workloads unaffected?
Most likely repo-server (or Git is unreachable): the controller cannot obtain the desired manifests, so it cannot compare, and Sync is Unknown; health assessment depends only on live state, so it can still compute Healthy. Argo CD is not in the data path, so a component failure does not affect running workloads; it only pauses “changes and self-healing”.
Verified instructional videos
Official docs
Video storyboard (about 100 seconds)
Scene: three boxes appear in turn: server (person icon), repo-server (Git icon), controller (gear). Redis flashes in the middle.
Narration: Argo CD has three core processes: the API server facing people, the repo server facing Git, and the application controller facing the cluster. Redis is the cache they share.
Scene: a new commit appears in Git, an arrow flows to repo-server, and a stack of YAML is generated.
Narration: each reconciliation, the controller first asks the repo server to resolve the branch to a commit SHA, then renders the manifests. Results for the same SHA are cached.
Scene: desired manifests on the left, live cluster objects on the right; red diff lines appear in the middle and the status badge changes to OutOfSync.
Narration: the controller compares desired and actual one by one to derive the sync status; then it runs health checks to derive the health status.
Scene: the automatic sync switch turns on, an apply arrow enters the cluster, the status badge changes to Synced and Healthy, and the result is written back to the Application.
Narration: with automatic sync on, the controller performs the apply, then writes the result back to the Application status, and the interface updates accordingly.
Module 3 · Install Argo CD: Helm chart, core mode and CLI login
- Compare three installation methods: the official manifests
install.yaml(and the HA version), the official manifestscore-install.yaml(core mode), and the community-maintained Helm chartargo/argo-cd, and explain why this course chooses the Helm chart. - Write
~/gitops-lab/bootstrap/argocd-values.yaml, and usehelm upgrade --installto install theargocdrelease in the namespaceargocd. - From
argocd-initial-admin-secretget the initial password,port-forwardaccess the UI,argocd loginlog in with the CLI, change the password and delete the initial Secret.
helm upgrade --install, and the relationship between CRDs and Helm. Importance:★★★★★What: three installation methods
| Method | Source | Contents | Suitable for |
|---|---|---|---|
manifests/install.yaml | argoproj/argo-cd repo (one manifest per version) | All components, single replica; requires kubectl apply --server-side --force-conflicts (the CRDs are large) | Quick trial, one-to-one correspondence with the official docs |
manifests/ha/install.yaml | Same as above | Multi-replica + redis-ha | Production (official manifest route) |
manifests/core-install.yaml | Same as above | Core mode: only controller, repo-server, Redis, ApplicationSet, etc.,no API Server / UI, Dex or local users | Platform teams that treat Argo CD only as an “in-cluster GitOps engine”, with access controlled by Kubernetes RBAC |
Helm chart argo/argo-cd | argoproj/argo-helm (community-maintained) | All components corresponding to the official manifests, with all settings managed via values | Chosen by this course: configuration is centralized in one values file, which can be versioned, and later courses use helm upgrade incremental changes |
The chart version and the Argo CD version are two separate numbering schemes: chart 10.18.0 → appVersion v3.6.1 (released 2026-11-11). When upgrading Argo CD, read Argo CD's upgrade notes first (the Upgrading page), then the changes for the corresponding major version in the chart's README.
How: this course's values file (full text)
# Argo CD Helm values — shared by the 8-hour Argo CD course
# chart: argo/argo-cd 10.18.0 (appVersion v3.6.1)
# Install/upgrade: helm upgrade --install argocd argo/argo-cd -n argocd --create-namespace \
# --version 10.18.0 -f ~/gitops-lab/bootstrap/argocd-values.yaml
# Later courses only append/modify settings in this file, then repeat the command above.
global:
# URL used to generate argocd-cm (UI links, SSO callbacks, links in notifications)
# The lab accesses it via kubectl port-forward, so localhost:8080 is written
domain: localhost:8080
crds:
install: true
keep: true # keep CRDs (and the Application objects in them) on helm uninstall
configs:
cm:
# v3 defaults to annotations; written out explicitly here for review and cross-version consistency
application.resourceTrackingMethod: annotation
# Periodic refresh: 120s + up to 60s jitter (chart default, written out explicitly)
timeout.reconciliation: 120s
timeout.reconciliation.jitter: 60s
admin.enabled: true
exec.enabled: false
params:
# Keep argocd-server terminating TLS itself (self-signed certificate); port-forward to 443
server.insecure: false
# Lab environment: no SSO (enabled and configured via dex.config in Hour 4)
dex:
enabled: false
# Single-replica lab configuration (switched to HA in Hour 7)
controller:
replicas: 1
server:
replicas: 1
repoServer:
replicas: 1
applicationSet:
replicas: 1
redis-ha:
enabled: false
# Notification controller kept (triggers and templates configured in Hour 6)
notifications:
enabled: true
Every item corresponds to chart 10.18.0's values.yaml Keys in: global.domain,crds.install/keep,configs.cm (written to argocd-cm),configs.params (written to argocd-cmd-params-cm),dex.enabled,redis-ha.enabled,notifications.enabled.
Why: a few key design points
- CRD lifecycle: Helm does not upgrade by default
crds/CRDs in the directory, whereas the argo-cd chart manages CRDs as ordinary templates (crds.install: true), and usescrds.keep: trueplushelm.sh/resource-policy: keep, to avoidhelm uninstalldeleting the CRDs during uninstall, which would cascade-delete all Applications. - Initial password: a random password is generated on first start and stored in
argocd-initial-admin-secret(plain base64). The official advice is to log in, change the password, and then delete this Secret; when needed you can useargocd admin initial-passwordto read it (while the Secret still exists). - TLS: argocd-server uses a self-signed certificate by default to serve both HTTPS and gRPC.
--insecureonly makes the CLI skip verification of this self-signed certificate; production should use a trusted certificate provided via Ingress / Gateway + cert-manager (Hour 4 / AKS course). - Who manages Argo CD itself: this course installs it manually with Helm (the bootstrap problem: you need Argo CD before you can do GitOps). Hour 3 turns Argo CD itself into an Application (“Argo CD manages itself”).
When: when to use core mode
Core mode suits scenarios where “cluster admins only want a GitOps engine and do not need a multi-tenant UI or SSO”: access control relies entirely on Kubernetes RBAC, and the CLI argocd login --core talks directly to the Kubernetes API using kubeconfig; when a temporary UI is needed, use argocd admin dashboard -n argocd to start a local UI. The cost is no Argo CD RBAC, SSO, Webhook receiver endpoint (no API Server), UI links in notifications, etc.
Comparison with similar technologies
| Argo CD (Helm chart) | Argo CD (official manifests) | Flux (flux bootstrap) | Managed service (AKS GitOps extension, etc.) | |
|---|---|---|---|---|
| Configuration method | values file | Kustomize overlay on official manifests | commit its own manifests to Git during bootstrap | Cloud platform API / CLI |
| Upgrade | helm upgrade + change the chart version | change the version number in the URL | flux bootstrap re-run | Handled by the platform |
argocd login --insecure “--insecure” means the connection is plaintext”——the connection is still TLS, it just does not verify the certificate. ② “Turning server.insecure: true the server's insecure flag on makes it safer”——on the contrary, it makes the server serve plain HTTP and should only be used behind an Ingress that terminates TLS. ③ “Chart version = Argo CD version”——10.18.0 is the chart version, corresponding to Argo CD v3.6.1. ④ “helm uninstall cleanly uninstalls”——CRDs are retained (keep), and the Application objects and the workloads they manage are still there; handle them with the “cleanup” steps.Installation flow diagram
Core mode vs full installation
--core direct access to the Kubernetes APIInteractive animation: after helm install, components become ready in turn
Click “Start install” and watch how Kubernetes creates each component. You can tick “Simulate slow repo-server image pull” to get a feel for helm --wait what it is waiting for.
Install and login commands
| Command | Purpose | Key parameters |
|---|---|---|
helm repo add argo https://argoproj.github.io/argo-helm | Add the chart repository | then helm repo update |
helm search repo argo/argo-cd --versions | head | List available chart versions and appVersion | Pin --version, do not use “latest” |
helm upgrade --install argocd argo/argo-cd | Install or upgrade | -n argocd --create-namespace --version 10.18.0 -f … --wait --timeout 10m |
argocd admin initial-password -n argocd | Read the initial password | Uses the current kubeconfig; no login required |
kubectl -n argocd port-forward svc/argocd-server 8080:443 | Access the UI / API locally | Keep this terminal running |
argocd login localhost:8080 --insecure | CLI login | --username admin --password …; credentials are saved in ~/.config/argocd/config |
argocd account update-password | Change the current account's password | --current-password … --new-password … |
argocd login --core | Core mode / bypass the API Server | uses kubeconfig; argocd admin dashboard start a local UI |
helm repo add argo https://argoproj.github.io/argo-helm helm repo update helm search repo argo/argo-cd --versions | head -3
NAME CHART VERSION APP VERSION DESCRIPTION argo/argo-cd 10.18.0 v3.6.1 A Helm chart for Argo CD, a declarative, GitOps... argo/argo-cd 10.17.2 v3.6.1 A Helm chart for Argo CD, a declarative, GitOps...
# First render to see what would be created (does not touch the cluster) helm template argocd argo/argo-cd --version 10.18.0 -n argocd \ -f ~/gitops-lab/bootstrap/argocd-values.yaml | grep -E '^kind:' | sort | uniq -c | sort -rn | head
How to verify: The rendered output should contain no dex-related Deployment (disabled in values). Common errors: Writing in values as configs.cm.timeout.reconciliation the nested form —argocd-cm the key name itself contains a dot, so it must be written as timeout.reconciliation: 120s a single key like this.
Lab 3: install Argo CD v3.6.1 and log in (about 7 minutes)
argocd-values.yaml full text from the “Theory” page and save it to ~/gitops-lab/bootstrap/argocd-values.yaml, then commit:
cd ~/gitops-lab git add bootstrap/argocd-values.yaml bootstrap/kind-lab.yaml git commit -m "bootstrap: argo-cd chart 10.18.0 values" && git push
kubectl config use-context kind-lab helm upgrade --install argocd argo/argo-cd \ --namespace argocd --create-namespace \ --version 10.18.0 \ -f ~/gitops-lab/bootstrap/argocd-values.yaml \ --wait --timeout 10m helm list -n argocd kubectl -n argocd get pods
Release "argocd" does not exist. Installing it now. NAME: argocd NAMESPACE: argocd STATUS: deployed REVISION: 1 ... NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION argocd argocd 1 ... deployed argo-cd-10.18.0 v3.6.1 NAME READY STATUS RESTARTS AGE argocd-application-controller-0 1/1 Running 0 90s argocd-applicationset-controller-6d8b7c9f7d-x2k4p 1/1 Running 0 90s argocd-notifications-controller-7c9c6b8d5f-9bq7m 1/1 Running 0 90s argocd-redis-5b6f8d7c9b-kd8sn 1/1 Running 0 90s argocd-redis-secret-init-xxxxx 0/1 Completed 0 95s argocd-repo-server-7f9d8c6b5d-mz2wq 1/1 Running 0 90s argocd-server-6c8b9f7d4c-p7lrx 1/1 Running 0 90s
argocd-redis-secret-init is the chart's pre-install Job, which generates the Redis auth password (redisSecretInit.enabled: true by default); after completion it stays as Completed or is cleaned up — both are normal.
kubectl -n argocd port-forward svc/argocd-server 8080:443
Open in the browser https://localhost:8080, accept the self-signed certificate warning. Username admin, password: see the next step. When running the lab on a remote VM, use ssh -L 8080:localhost:8080 user@vm to forward the port to the local machine.
ARGO_PWD=$(argocd admin initial-password -n argocd | head -1)
# Equivalent: kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d
argocd login localhost:8080 --username admin --password "$ARGO_PWD" --insecure
argocd version --short
argocd cluster list
'admin:login' logged in successfully Context 'localhost:8080' updated argocd: v3.6.1+... argocd-server: v3.6.1+... SERVER NAME VERSION STATUS MESSAGE PROJECT https://kubernetes.default.svc in-cluster Unknown Cluster has no applications and is not being monitored.
in-cluster refers to the cluster where Argo CD itself runs (https://kubernetes.default.svc). With no applications, a status of Unknown is normal.
argocd account update-password --current-password "$ARGO_PWD" --new-password 'Lab-Argo-2026!' kubectl -n argocd delete secret argocd-initial-admin-secret argocd login localhost:8080 --username admin --password 'Lab-Argo-2026!' --insecure
admin.enabled: "false", Hour 4); do not write passwords into shell history (you can use read -s).kubectl config set-context --current --namespace=argocd argocd login --core argocd app list # now goes through the Kubernetes API kubectl config set-context --current --namespace=default argocd login localhost:8080 --username admin --password 'Lab-Argo-2026!' --insecure # switch back to normal mode
argocd (namespace argocd, chart argo-cd-10.18.0), values file ~/gitops-lab/bootstrap/argocd-values.yaml, CLI context localhost:8080. In later courses, all configuration changes follow the same pattern: edit values → commit → repeat this step's helm upgrade --install command.Cleanup (do this after the course is fully finished)
helm uninstall argocd -n argocd # CRDs are kept because of keep kubectl get crd -o name | grep argoproj.io | xargs kubectl delete # deletes the remaining Application and other objects kubectl delete namespace argocd
Case 1: values go into Git, not the command line --set
Problem: Multiple people using different --set upgrade Argo CD; one upgrade lost the SSO configuration and nobody could log in. Approach: All settings are written in bootstrap/argocd-values.yaml, changes go through PRs; upgrade commands are fixed in the README / Makefile. Limitation: The bootstrap stage still needs one manual helm install; afterwards Argo CD can manage itself (Hour 3).
Case 2: accidentally deleting CRDs makes all applications disappear
Problem: To “reinstall cleanly”, someone deleted the applications.argoproj.io CRDs; all Application objects were cascade-deleted; applications with resources-finalizer also deleted their workloads. Approach: the chart's crds.keep: true; all Application manifests are in Git (argocd/apps/), so they can be rebuilt; use cascade-delete finalizers cautiously for production applications. Limitation: Rebuilding Applications triggers a full sync; the impact must be assessed.
Case 3: a private cluster cannot reach the public chart repository
Approach: Mirror the argo/argo-cd chart and images (quay.io/argoproj/argocd,ecr-public.aws.com/docker/library/redis etc.; follow the image settings in values) to an internal registry, and use global.image.repository etc. to override values. Limitation: New images must be mirrored on every upgrade.
Common install and login errors
FATA[0000] dial tcp [::1]:8080: connect: connection refused
Cause: port-forward is not running (or has disconnected).
Fix: Re-run in another terminal kubectl -n argocd port-forward svc/argocd-server 8080:443; port-forward disconnects when the Pod restarts and must be run again.
x509: certificate signed by unknown authority
Cause: argocd-server uses a self-signed certificate, and the CLI verifies certificates by default.
Fix: In the lab environment add --insecure; in production configure a trusted certificate (Ingress + cert-manager).
FATA[0000] rpc error: code = Unauthenticated desc = Invalid username or password
Cause: Wrong password; the initial Secret has been deleted; or the password has already been changed.
kubectl -n argocd get secret argocd-initial-admin-secret # check whether it still exists
Fix: If the password is forgotten, the official FAQ approach is to clear the argocd-secret in admin.password and admin.passwordMtime and restart argocd-server to regenerate the initial password (lab environments only):
kubectl -n argocd patch secret argocd-secret -p '{"data": {"admin.password": null, "admin.passwordMtime": null}}'
kubectl -n argocd rollout restart deploy/argocd-serverError: INSTALLATION FAILED: ... CustomResourceDefinition "applications.argoproj.io" ... exists and cannot be imported into the current release
Cause: The cluster already has Argo CD installed with kubectl apply -f install.yaml ; the CRDs do not belong to this Helm release.
Fix: In the lab environment, first uninstall the old installation (kubectl delete -n argocd -f install.yaml); when the CRDs must be kept, add Helm ownership labels and annotations to them (app.kubernetes.io/managed-by=Helm,meta.helm.sh/release-name=argocd,meta.helm.sh/release-namespace=argocd) and then install.
Error: context deadline exceeded (helm --wait timed out)
Cause: Slow or failed image pulls, or insufficient node resources.
kubectl -n argocd get pods kubectl -n argocd describe pod POD | tail -20
Fix: Investigate the events ImagePullBackOff / Insufficient memory; once images can be pulled, re-run helm upgrade --install (idempotent).
1. View the dex-related parts of all values actually in effect for the current release (including defaults).
helm get values argocd -n argocd --all | grep -A3 '^dex:'
2. Without logging in to the API Server, list all Applications.
kubectl -n argocd get applications.argoproj.io # or: kubectl config set-context --current --namespace=argocd && argocd login --core && argocd app list
The security team requires “Argo CD must not expose any web interface; only the platform team operates it with kubectl”. How would you install it? What is the cost?
Use core mode (core-install.yaml, or disable components such as server / dex in the chart; follow the chart documentation). Access control is delegated to Kubernetes RBAC, and the platform team uses argocd login --core or kubectl directly to manage Applications. Cost: no Argo CD RBAC / SSO / multi-tenant UI, no Webhook receiver endpoint (polling only; change detection takes up to about 3 minutes), and UI links in notifications are unavailable; when a temporary UI is needed, use argocd admin dashboard.
Verified instructional videos
Official docs
- Getting Started
- Installation (including Core / HA / Helm)
- Argo CD Core
- Artifact Hub: argo/argo-cd
- argo-helm: charts/argo-cd README
Video storyboard (about 90 seconds)
Scene: the editor opens argocd-values.yaml, highlighting global.domain and dex.enabled false.
Narration: first write all installation settings into one values file and commit it to the bootstrap directory in Git.
Scene: the terminal runs helm upgrade --install, and the Pods change to Running one by one.
Narration: install with a pinned chart version. Chart 10.18.0 corresponds to Argo CD 3.6.1.
Scene: port-forward, browser certificate warning, login page.
Narration: access the UI through port forwarding; the initial password is in argocd-initial-admin-secret.
Scene: argocd login succeeds, update-password runs, the initial Secret is deleted.
Narration: after logging in on the command line, change the password immediately and delete the initial password Secret.
Module 4 · First Application: source, destination and sync
- Read and write the key Application fields:
project,source.repoURL / targetRevision / path,destination.server|name / namespace,syncPolicy.syncOptions, and the resource-deletion finalizer. - Use
argocd app createto createpodinfo-dev, then run the first manual sync and wait for health. - Understand that “the Application itself is a declarative object”: it should be placed in the Git
argocd/apps/directory (the comprehensive lab completes this step).
What: the structure of an Application
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: podinfo-dev
namespace: argocd # the Application object lives in the namespace where Argo CD runs
spec:
project: default # AppProject: restricts usable sources and destinations (Hour 4)
source:
repoURL: https://github.com/<you>/gitops-lab.git
targetRevision: main # branch / tag / commit SHA; HEAD = default branch
path: apps/podinfo/overlays/dev # if the directory contains kustomization.yaml → automatically detected as Kustomize
destination:
server: https://kubernetes.default.svc # in-cluster; or use name: in-cluster
namespace: podinfo-dev # applies only to “resources without a namespace set”
syncPolicy:
syncOptions:
- CreateNamespace=true # create the target namespace if it does not exist
| Field | Meaning | Notes |
|---|---|---|
source.repoURL | Git repo, Helm repo or OCI repo address | Private repos require registering credentials first (argocd repo add, credentials are stored as a Secret with the argocd.argoproj.io/secret-type: repository label) |
source.targetRevision | Version to track | Branch → follows the latest commit; tag / SHA → pinned version (common in production). Every sync records the actual SHA in the history |
source.path | Directory in the repo | Tool type is detected automatically: if there is kustomization.yaml → Kustomize; if there is Chart.yaml → Helm; otherwise → plain YAML / JSON in the directory |
destination | Target cluster and default namespace | server and name pick one; resources whose manifest already sets a namespace (written by Kustomize in this example) are not affected, but inconsistency between the two is confusing, so keep them consistent |
project | belonging to the AppProject | default A project that allows any source and destination — only suitable for labs |
syncPolicy.automated | Automatic sync (Module 6) | Not enabled in this module yet; observe the manual workflow |
metadata.finalizers | resources-finalizer.argocd.argoproj.io | When an Application is deleted, the resources it manages are cascade-deleted; without this, only the Application is deleted and the workloads are kept |
How: what the first sync does
- After the Application is created, the controller immediately performs one reconciliation: renders the manifests and compares them. The cluster has none of these resources, so Sync = OutOfSync, Health = Missing.
argocd app syncWritingoperationfield on the Application; once the controller sees it, it performs the sync: first runs the PreSync hooks (if any), then applies resources in resource-type order (Namespace → … → Service → Deployment) and sync waves, and finally PostSync.- After the sync completes, Sync = Synced; during the Deployment rollout Health = Progressing, and once ready, Healthy.
- Results are written to
status.operationStateandstatus.history(including the commit SHA), you can useargocd app historyto view,argocd app rollbackroll back to a historical version (only available when automatic sync is not enabled).
Why: why the Application should also go into Git
An Application created with the CLI / UI only exists in the cluster's etcd, and is lost if the cluster is rebuilt. Putting the Application YAML in argocd/apps/ and managing it with a “root application” (Hour 3 App of Apps) is complete GitOps. This module uses the CLI first to understand the fields; the comprehensive lab switches to declarative.
When: choosing CLI, UI or declarative
| Method | Suitable for | Not suitable for |
|---|---|---|
| UI “+ NEW APP” | Learning, exploring fields | Any environment that must be reproduced |
argocd app create | Scripts, quick experiments; --upsert idempotent | Long-term management (state is not in Git) |
kubectl apply -f argocd/apps/*.yaml | Declarative, reviewable in Git | — (recommended) |
argocd namespace are recognized; “applications in any namespace” requires extra configuration (Hour 4).Field mapping diagram: Application → Git → cluster
Sync operation flow
Interactive: Application field builder
Change the fields on the left; the YAML and the equivalent CLI command are generated live on the right, with validation hints (these hints correspond to real errors or risks you will encounter).
Common Application commands
| Command | Purpose | Key parameters |
|---|---|---|
argocd app create NAME | Create an application | --repo --path --revision --dest-server|--dest-name --dest-namespace --project --sync-option CreateNamespace=true --upsert |
argocd app get NAME | Status and resource list | --refresh,--hard-refresh,-o yaml|json|tree |
argocd app sync NAME | Manual sync | --prune,--dry-run,--resource GROUP:KIND:NAME,--revision |
argocd app wait NAME | wait until reaching the state | --sync --health --timeout 120 |
argocd app history NAME | Sync history | ID and Git SHA |
argocd app delete NAME | Delete an application | --cascade=false Keep resources; -y skip confirmation |
argocd repo add URL | Register a private repository | --username --password (PAT) or --ssh-private-key-path, GitHub App parameters |
argocd app create podinfo-dev \ --project default \ --repo https://github.com/<you>/gitops-lab.git \ --revision main \ --path apps/podinfo/overlays/dev \ --dest-server https://kubernetes.default.svc \ --dest-namespace podinfo-dev \ --sync-option CreateNamespace=true argocd app get podinfo-dev
application 'podinfo-dev' created
Name: argocd/podinfo-dev
Project: default
Server: https://kubernetes.default.svc
Namespace: podinfo-dev
URL: https://localhost:8080/applications/podinfo-dev
Source:
- Repo: https://github.com/<you>/gitops-lab.git
Target: main
Path: apps/podinfo/overlays/dev
SyncWindow: Sync Allowed
Sync Policy: Manual
Sync Status: OutOfSync from main (7c1e9a2)
Health Status: Missing
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE
Service podinfo-dev podinfo OutOfSync Missing
apps Deployment podinfo-dev podinfo OutOfSync Missing
How to read it:“OutOfSync from main (7c1e9a2)” means the desired state comes from commit 7c1e9a2 on the main branch; Missing means the resource does not exist in the cluster. Common errors:--path Starting with / or a misspelled directory will produce app path does not exist.
Lab 4: create and manually sync podinfo-dev (about 6 minutes)
argocd app create and confirm OutOfSync / Missing.argocd app diff podinfo-dev | head -30 argocd app sync podinfo-dev --dry-run
argocd app sync podinfo-dev argocd app wait podinfo-dev --sync --health --timeout 180 kubectl -n podinfo-dev get deploy,svc,pod
Name: argocd/podinfo-dev
...
Operation: Sync
Sync Revision: 7c1e9a2...
Phase: Succeeded
Message: successfully synced (all tasks run)
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE
Namespace podinfo-dev Running Synced namespace/podinfo-dev created
Service podinfo-dev podinfo Synced Healthy service/podinfo created
apps Deployment podinfo-dev podinfo Synced Progressing deployment.apps/podinfo created
...
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/podinfo 1/1 1 1 40skubectl -n podinfo-dev port-forward svc/podinfo 9898:9898 & sleep 2; curl -s localhost:9898 | grep -E '"version"|"message"'; kill %1
"version": "6.16.0", "message": "hello from dev",
kubectl -n podinfo-dev get deploy podinfo -o jsonpath='{.metadata.annotations.argocd\.argoproj\.io/tracking-id}{"\n"}'
argocd app history podinfo-dev
podinfo-dev:apps/Deployment:podinfo-dev/podinfo ID DATE REVISION 0 2026-11-17 10:21:33 +0000 UTC main (7c1e9a2)
v3 uses annotations by default argocd.argoproj.io/tracking-id (format app-name:group/kind:namespace/name) to decide “which application this resource belongs to”; this is what prune relies on in Module 7.
Case 1: a production application tracking a branch leads to an “accidental release”
Problem: A production application targetRevision: main has automatic sync enabled, and a base change prepared for dev was merged and went straight into production. Approach: Isolate environments with directories (overlays), and make sure base changes are reviewed; production can track a tag (such as prod-2026.11.17) or have its SHA updated by a promotion process (Hour 6 Kargo / Hour 3). Limitation: When tracking a fixed SHA, the Application itself must be changed on every release.
Case 2: deleting an Application by mistake takes the production database with it
Problem: While cleaning up a “duplicate application”, an Application with a resource finalizer was deleted, cascade-deleting the StatefulSet and PVC. Approach: Add annotations to stateful resources argocd.argoproj.io/sync-options: Delete=false (Hour 2), and before deleting the application first --cascade=false; restrict the delete permission with RBAC. Limitation: Resources must be tagged in advance.
Case 3: a private repository credential expires
Problem: A personal PAT expired, and every application reported ComparisonError. Approach: Register the repository using a GitHub App or deploy key, and manage it uniformly with a credential template (matched by URL prefix). Limitation: A GitHub App requires an organization administrator to install it.
Common errors at creation and first sync
rpc error: code = InvalidArgument desc = application spec for podinfo-dev is invalid: InvalidSpecError: Unable to generate manifests in apps/podinfo/overlay/dev: rpc error: code = Unknown desc = apps/podinfo/overlay/dev: app path does not exist
Cause: Path typo (overlay vs overlays), or the path has not been pushed to the branch targetRevision points to.
git -C ~/gitops-lab ls-tree -d --name-only -r origin/main | grep overlays
Fix: Correct --path; confirm git push is done.
failed to list refs: authentication required: Repository not found.
Cause: The repository is private (or the URL is mistyped), and Argo CD has no credentials.
argocd repo add https://github.com/<you>/gitops-lab.git --username <you> --password <fine-grained-PAT-read-only Contents> argocd repo list
Fix: Register read-only credentials; in production use a GitHub App or SSH deploy key.
namespaces "podinfo-dev" not found
Cause: not set CreateNamespace=true, and the target namespace does not exist.
argocd app set podinfo-dev --sync-option CreateNamespace=true
Fix: Add the sync option and sync again; or put the Namespace manifest into Git (which allows labels, quotas, etc., and gives more control).
application destination server 'https://kubernetes.default.svc' and namespace 'podinfo-dev' do not match any of the allowed destinations in project 'xxx'
Cause: A restricted AppProject is being used, and the destination is not in the spec.destinations allow list.
Fix: This course uses --project default; project restrictions are explained in detail in Hour 4.
1. Export podinfo-dev as YAML, keep only the spec, and use it as the starting point for putting it into Git.
kubectl -n argocd get application podinfo-dev -o yaml | yq '{"apiVersion": .apiVersion, "kind": .kind, "metadata": {"name": .metadata.name, "namespace": .metadata.namespace}, "spec": .spec}'2. Delete the podinfo-dev application but keep the workloads in the cluster.
argocd app delete podinfo-dev --cascade=false -y
A colleague changed destination.namespace to default, but after sync podinfo is still in podinfo-dev . Why? What are the risks of this configuration?
The Kustomize overlay has already written the namespace on all resources through namespace: podinfo-dev ; destination.namespace only applies to resources in the manifest that have no namespace. Risks: the configuration appears to point to default, which does not match reality and is misleading; any resource added later without a namespace would land in default; in a restricted project, destination validation is based on this field, so a mismatch with the actual resource location can lead to unexpected permission decisions. Keep the two consistent.
Verified instructional videos
Official docs
Video storyboard (about 80 seconds)
Scene: the Application YAML is split into three highlighted blocks: source, destination, syncPolicy.
Narration: an Application answers three questions: where to fetch from, where to put it, and how to sync.
Scene: argocd app create runs, and yellow OutOfSync and Missing cards appear in the UI.
Narration: right after creation, the resources are not yet in the cluster, so the status is out of sync and missing.
Scene: click Sync; the resource tree shows Namespace, Service and Deployment in turn, and the Deployment changes from Progressing to green.
Narration: sync creates resources in type order, and the Deployment becomes healthy once its rollout completes.
Scene: the app history list shows commit SHAs.
Narration: every sync records its corresponding commit, so deployments can be traced back to Git.
Module 5 · State model: Sync Status and Health Status
- State the 3 values of Sync Status and the 6 values of Health Status, and explain any combination (for example Synced + Degraded, or OutOfSync + Healthy).
- Know how built-in health checks judge Deployment, Service, Ingress, PVC, Job and other resources, and how application-level health is aggregated from resource health.
- Distinguish between the operation state (operationState.phase: Running / Succeeded / Failed / Error / Terminating) and Sync Status.
What: two dimensions
- Synced: the live state of all managed resources matches the rendered desired state (after normalization and ignoreDifferences).
- OutOfSync: at least one resource differs, is missing, or (when prune is considered) is extra.
- Unknown: cannot be compared — usually a rendering failure (ComparisonError) or an unreachable repository.
- Healthy: the resource is 100% healthy.
- Progressing: not yet healthy, but still progressing and expected to become healthy (for example during a rollout).
- Degraded: failed, or could not become healthy within the time limit.
- Suspended: paused, waiting for an external event (a paused CronJob, a paused Deployment / Rollout).
- Missing: the resource does not exist in the cluster.
- Unknown: health assessment failed; status unknown.
How: how health is determined
| Resource | Built-in health check rules (summary) |
|---|---|
| Deployment / ReplicaSet / StatefulSet / DaemonSet | Whether the observed generation has caught up with the spec; whether the updated and available replica counts reach the desired values; a Deployment that exceeds progressDeadlineSeconds (default 600 seconds) → Degraded; spec.paused → Suspended |
| Service | type: LoadBalancer requires status.loadBalancer.ingress a value to be Healthy, otherwise Progressing (common in kind!); other types are Healthy directly |
| Ingress | Same as above, requires status.loadBalancer.ingress |
| PersistentVolumeClaim | Bound → Healthy; Pending → Progressing |
| Pod / Job | Judged by Pod phase / Job conditions; a failed Job → Degraded |
| CRDs such as Argo Rollouts and cert-manager Certificate | Built-in Lua health scripts (can be customized in argocd-cm of resource.customizations.health.<group_kind> , Hour 2) |
| Stateless objects such as ConfigMaps and Secrets | No health concept; not included in the aggregation |
Application-level health = the “worst” of the resource healths (the severity order is roughly Healthy < Suspended < Progressing < Missing < Degraded < Unknown; follow the official Resource Health docs). Hook resources are not included in application health aggregation.
v3 change
- Resource-level health by default is no longer persisted to
.status.resources[].health, and the Application status showsresourceHealthSource: appTree; scripts that need resource health should useargocd app get <app> -o jsonor the resource tree in the API. To restore the old behavior:argocd-cmd-params-cmincontroller.resource.health.persist: "true". - Metrics
argocd_app_sync_status,argocd_app_health_statusetc. have been removed; the information is merged intoargocd_app_infolabels (related to the Prometheus & Grafana course). ignoreResourceStatusFieldDefault isall: each resource'sstatusfield differences no longer cause OutOfSync.
Operation state (do not confuse with Sync Status)
status.operationState.phase Description Most recent sync operation: Running → Succeeded / Failed / Error, or terminated (Terminating). A sync can Succeed and then someone modifies the resources, so the app becomes OutOfSync again; a sync can also Fail (for example, apply rejected by admission control), and the app remains OutOfSync.
When: how to judge using these two dimensions
| Combination | Typical meaning | What to check first |
|---|---|---|
| Synced + Healthy | All normal | — |
| Synced + Progressing | Just synced, rolling out; or a LoadBalancer has not yet received an IP | Wait; if it times out, check the resource events |
| Synced + Degraded | The Git content itself is bad (wrong image, wrong configuration) | Fix Git (revert), rather than syncing again |
| OutOfSync + Healthy | Drift, or new commits not yet synced | argocd app diff |
| OutOfSync + Missing | New resources not yet created / deleted by someone | Sync (or enable self-heal) |
| Unknown + anything | Cannot render / compare | Check status.conditions for the ComparisonError |
Comparison with similar technologies
| Argo CD | Flux | kubectl | |
|---|---|---|---|
| Consistency | Sync Status (per-resource diff) | Kustomization Ready Conditions + last applied revision | kubectl diff (one-off) |
| Health | Health Status (built-in + Lua custom) | kstatus-style readiness judgment (wait / healthChecks) | kubectl rollout status |
Status matrix diagram
Decision flow for Deployment health
kubectl rollout status )Interactive simulator: events → state combinations
Starting from podinfo-dev in “Synced + Healthy”, click the events in turn and observe how the two states change, and what Argo CD displays when automatic sync is not enabled (manual mode).
Commands for reading status
| Command | Purpose | Notes |
|---|---|---|
argocd app list | SYNC / HEALTH columns for all applications | by default -o wide; can filter by -p project,-l label,-r repository (there is no parameter to filter by health; use -o json | jq) |
argocd app get NAME | Status and message of applications and each resource | the MESSAGE column gives the reason for the health status |
argocd app get NAME -o json | jq '.status.health, .status.sync' | Machine-readable | Since v3 resource health is not in the CR; CLI output still contains resource-tree information |
argocd app resources NAME | Resource list and status | --orphaned View orphaned resources |
kubectl -n argocd get applications | Read status without going through the API Server | Columns SYNC STATUS / HEALTH STATUS |
argocd app list
kubectl -n argocd get applications.argoproj.io
kubectl -n argocd get application podinfo-dev -o jsonpath='{.status.sync.status}{" / "}{.status.health.status}{" / "}{.status.operationState.phase}{"\n"}'
NAME PROJECT CLUSTER NAMESPACE STATUS HEALTH SYNCPOLICY CONDITIONS REPO PATH TARGET argocd/podinfo-dev default https://kubernetes.default.svc podinfo-dev Synced Healthy Manual <none> https://github.com/<you>/gitops-lab.git apps/podinfo/overlays/dev main NAME SYNC STATUS HEALTH STATUS podinfo-dev Synced Healthy Synced / Healthy / Succeeded
Lab 5: produce Missing and Degraded (about 6 minutes)
kubectl -n podinfo-dev delete svc podinfo argocd app get podinfo-dev --refresh | tail -4
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE
Service podinfo-dev podinfo OutOfSync Missing
apps Deployment podinfo-dev podinfo Synced Healthy
Application level: OutOfSync + Missing (the “worst” resource health). Run argocd app sync podinfo-dev to restore.
# 1) Use a Kustomize image override to point dev at a non-existent tag
argocd app set podinfo-dev --kustomize-image ghcr.io/stefanprodan/podinfo:0.0.0
# 2) Only to shorten the demo: change progressDeadlineSeconds to 60 (this field is not declared in Git, so Argo CD will not revert it)
kubectl -n podinfo-dev patch deploy podinfo --type merge -p '{"spec":{"progressDeadlineSeconds":60}}'
argocd app sync podinfo-dev
sleep 75; argocd app get podinfo-dev | grep -E 'Health Status|Deployment'
Health Status: Degraded apps Deployment podinfo-dev podinfo Synced Degraded deployment.apps/podinfo configured Deployment "podinfo" exceeded its progress deadline
Synced + Degraded: the desired state (including the override) is itself bad. The old ReplicaSet's Pods are still running (rolling-update protection), so the service was not interrupted.
argocd app unset podinfo-dev --kustomize-image ghcr.io/stefanprodan/podinfo
argocd app sync podinfo-dev
argocd app wait podinfo-dev --health --timeout 120
kubectl -n podinfo-dev patch deploy podinfo --type json -p '[{"op":"replace","path":"/spec/progressDeadlineSeconds","value":600}]'argocd app set --kustomize-image This changes the Application object (in the cluster), not Git. As long as the Application itself is not managed in Git, such an override is “state outside Git”. The comprehensive lab puts the Application into Git, and then such overrides will be overwritten back by the definition in Git.Case 1: a LoadBalancer Service leaves the application “Progressing forever”
Problem: In a local / private cluster without a cloud load balancer,type: LoadBalancer never obtains an IP, so the application stays Progressing for a long time and blocks subsequent sync waves. Approach: In kind, use ClusterIP + port-forward, or install cloud-provider-kind / MetalLB; in production, check the load-balancer controller. Limitation: Do not use custom health checks to hide real problems just to turn the status green.
Case 2: monitoring watched only Sync and missed Degraded
Problem: Alerts were configured only for OutOfSync, so after a bad-image release the application stayed Synced + Degraded for hours with nobody aware of it. Approach: Configure separate alerts for Health=Degraded, Sync=OutOfSync for more than N minutes, and operationState=Failed (Notifications, Hour 6; metrics argocd_app_info, Prometheus course).
Case 3: after the v3 upgrade, a custom script cannot read resource health
Problem: The script reads .status.resources[].health, which becomes empty after upgrading to v3. Approach: Change it to argocd app get -o json or the resource tree from the API; if necessary, temporarily set controller.resource.health.persist: "true". Limitation: Persisting it adds etcd writes, which is not recommended in large environments.
Common status-related problems
Health Status: Progressing —— Waiting for rollout to finish: 0 of 1 updated replicas are available...
Cause: New Pods not ready: image pull failure, failing probes, insufficient resources.
kubectl -n podinfo-dev get pods kubectl -n podinfo-dev describe pod -l app.kubernetes.io/name=podinfo | tail -15
Fix: Handle according to the Pod events; if it is a configuration error in Git,git revert.
Service podinfo Synced Progressing Waiting for the LoadBalancer to get an IP
Cause: The cluster has no load-balancer implementation.
Fix: Change to ClusterIP, or install cloud-provider-kind / MetalLB in kind.
Sync Status: Unknown —— ComparisonError: Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = `kustomize build ...` failed exit status 1: Error: ...
Cause: Rendering failed (YAML syntax, Kustomize field error, referenced file does not exist).
kubectl kustomize ~/gitops-lab/apps/podinfo/overlays/dev argocd app get podinfo-dev -o json | jq '.status.conditions'
Fix: Run kubectl kustomize locally first; add render validation to CI (kustomize build + kubeconform).
1. List all applications that are Degraded.
argocd app list -o json | jq -r '.[] | select(.status.health.status=="Degraded") | .metadata.name' # or without going through the API Server: kubectl -n argocd get applications -o json | jq -r '.items[] | select(.status.health.status=="Degraded") | .metadata.name'
2. Output podinfo-dev's sync status, health status and most recent operation phase in one command.
kubectl -n argocd get app podinfo-dev -o jsonpath='{.status.sync.status} {.status.health.status} {.status.operationState.phase}{"\n"}'While on duty you see podinfo-prod showing Synced + Degraded, and a colleague suggests “just click Sync and see”. How do you respond, and what is the correct order of handling?
Synced means the cluster already matches Git; syncing again only reapplies the same configuration and will not fix the problem. Order: ① argocd app get check which resource is Degraded and its message; ② check the Pod events / logs to confirm the cause; ③ confirm which recent commit introduced it (argocd app history the corresponding SHA,git log); ④ fix Git through git revert (roll back the GitOps way), then wait for sync or sync manually; ⑤ afterwards add CI validation or progressive delivery (Hour 6).
Verified instructional videos
No verified video was found that specifically explains the Argo CD v3 Sync / Health state model. The following is a general introductory video (which shows the status display); use it together with the storyboard.
Official docs
Video storyboard (about 80 seconds)
Scene: two dashboards, the left labeled “Does it match Git?”, the right labeled “Is it running well?”
Narration: Argo CD describes an application with two independent states: sync status and health status.
Scene: Git commits a bad image; the left turns green Synced, and the right changes from blue Progressing to red Degraded.
Narration: a successful sync does not mean the application is healthy. If the configuration in Git is bad, you will see synced but degraded.
Scene: kubectl scale; the left turns yellow OutOfSync, and the right stays green.
Narration: conversely, a manual change can leave the application out of sync while it is still completely healthy.
Scene: the worst red state among the resource list spreads to the application card.
Narration: an application's health is the worst health of all its resources.
Module 6 · Diff, refresh and manual / automatic sync
- Explain three kinds of “refresh”: periodic refresh (
timeout.reconciliation), normal refresh, hard refresh (clears the manifest cache and re-renders), and the role of Git Webhooks. - Read
argocd app diffoutput and exit codes, and know which normalization happens before the diff. - Configure automatic sync
syncPolicy.automated, understand its trigger conditions (only when OutOfSync), the rule that “a failed same SHA is not retried”, and theretryconfiguration.
What: refresh and sync are two different things
| Action | What it does | Does it change the cluster? | Trigger |
|---|---|---|---|
| Periodic refresh | Re-resolves targetRevision, re-renders when necessary, and re-compares | No | every timeout.reconciliation (default 120s) + random jitter of at most 60s, i.e. at most about 3 minutes; setting it to 0 disables polling (must be combined with a Webhook) |
| Normal refresh | Performs the comparison above immediately; if the SHA has not changed, uses the cached manifests | No | UI “Refresh”,argocd app get --refresh, annotation argocd.argoproj.io/refresh: normal, Webhook |
| Hard refresh | Invalidates the manifest cache and forces repo-server to re-render | No | UI “Hard Refresh”,--hard-refresh, annotation value hard; periodic hard refresh timeout.hard.reconciliation (default 0s , i.e. off) |
| Sync | Applies the desired manifests to the cluster (and can prune) | Yes | Manual (UI / CLI), or automatic sync policy |
When is a hard refresh needed? When the render result depends on something other than Git while the SHA has not changed: the content of a remote repository that a Helm chart depends on has changed, a CMP plugin read external data, or the cache is suspected to be corrupted. Routine Git commits only need a normal refresh (the SHA changes, so the cache key naturally differs).
How: what the diff compares
- Desired state: the manifests rendered by repo-server. Live state: the objects in the controller's cache.
- Normalization: removes the default values and metadata that Kubernetes fills in automatically (
managedFields,resourceVersionetc.), ignores fields by default in v3 (status), and applies the rules inignoreResourceStatusField: allandignoreDifferences(Hour 2).resource.customizationsBy default, differences are computed with client-side three-way merge semantics (consistent with - by default, differences are computed with client-side three-way merge semantics (consistent with
kubectl apply, based on the last-applied annotation); enabling Server-Side Diff (argocd.argoproj.io/compare-options: ServerSideDiff=true, or when v3.6 uses theServerSideApply=truesync option, automatically enabled) computes via the kube-apiserver dry-run, which handles admission webhooks and defaults more accurately, at the cost of extra API Server load. - Any resource with a difference → the application is OutOfSync.
How: the automatic sync policy
spec:
syncPolicy:
automated:
enabled: true # explicit switch; when false, other fields are kept but automatic sync is off (treated as on when unset)
prune: false # Module 7
selfHeal: false # Module 7
allowEmpty: false # prevents deleting all resources when the render output is empty
syncOptions:
- CreateNamespace=true
retry: # retry after a failed sync (example values, not defaults)
limit: 5
backoff:
duration: 5s
factor: 2
maxDuration: 3m
- only triggers when OutOfSync: applications that are Synced, or in an error state, are not auto-synced.
- After the same SHA + parameters fail, automatic retries stop (to prevent loops), unless
retryis configured or a new commit appears. - When
selfHealis not enabled, automatic sync only reacts to “Git changes”; drift on the cluster side shows as OutOfSync but is not corrected automatically (Module 7). - With automatic sync enabled,
argocd app rollbackis unavailable; rollback should be done through Git (git revert).
Why / When: manual or automatic
| Environment | Recommendation | Rationale |
|---|---|---|
| dev | automated + prune + selfHeal | Fast feedback, Git is the truth |
| staging | automated + prune + selfHeal | An automated flow consistent with production validation |
| prod | Automatic sync + changes controlled by PR approval, or manual sync + sync windows (Hour 2) | “Who presses the button” should be a PR merge, not a UI click; both are common, what matters is a consistent process |
Webhook: shrink “up to about 3 minutes” to seconds
In the GitHub repository settings, point the Webhook at https://<argocd external address>/api/webhook (content type application/json), and argocd-secret in webhook.github.secret to verify the signature. After argocd-server receives a push event, it triggers a refresh for the applications that reference that repository and branch. In the kind lab, GitHub cannot reach your localhost, so this course uses a manual --refresh instead; Hour 7 demonstrates a Webhook with an in-cluster Gitea.
Comparison with similar technologies
| Argo CD | Flux | |
|---|---|---|
| Change detection | Polling (default 120s + jitter) + Webhook | Each Source's spec.interval + Receiver (Webhook) |
| Application | automatically syncs when OutOfSync | Periodic apply at each Kustomization's interval |
| Manual trigger | argocd app sync / UI | flux reconcile kustomization … --with-source |
Change detection paths
The relationship between cache and refresh
Interactive timeline: how long after a git push it is deployed
Choose a detection method and sync policy, then click “Play”. The timeline is compressed at 1 second ≈ 10 seconds; the polling jitter is generated randomly each time (0–60 seconds), matching real behavior.
Diff, refresh and sync commands
| Command | Purpose | Notes |
|---|---|---|
argocd app diff NAME | Desired vs live | Exit codes: 0 no difference, 1 differences, 2 error; --refresh / --hard-refresh; --local DIR preview using a local directory (uncommitted changes); --server-side-diff |
argocd app get NAME --refresh | Normal refresh | you can also add an annotation to the Application argocd.argoproj.io/refresh=normal |
argocd app get NAME --hard-refresh | Hard refresh | clear the manifest cache |
argocd app sync NAME | Manual sync | --dry-run,--prune,--resource apps:Deployment:podinfo,--revision SHA (temporarily sync to a specified version) |
argocd app set NAME --sync-policy automated | Enable automatic sync | --sync-policy none Disable; --auto-prune,--self-heal,--allow-empty |
argocd app terminate-op NAME | terminate an in-progress sync | Use when a sync is stuck |
argocd app rollback NAME ID | Roll back to a historical version | Only available in manual sync mode |
argocd app diff podinfo-dev --refresh; echo "exit=$?"
===== apps/Deployment podinfo-dev/podinfo ====== 33c33 < image: ghcr.io/stefanprodan/podinfo:6.16.0 --- > image: ghcr.io/stefanprodan/podinfo:6.17.0 exit=1
How to read it:< is the live cluster state,> is the desired state. You can set the environment variable KUBECTL_EXTERNAL_DIFF="diff -u" (or tools such as dyff) to change the output format.
# preview an uncommitted local change (bypassing Git) argocd app diff podinfo-dev --local ~/gitops-lab/apps/podinfo/overlays/dev
Lab 6: upgrade 6.16.0 → 6.17.0 via a Git commit (about 7 minutes)
cd ~/gitops-lab sed -i 's/newTag: "6.16.0"/newTag: "6.17.0"/' apps/podinfo/overlays/dev/kustomization.yaml git diff git commit -am "dev: podinfo 6.16.0 -> 6.17.0" && git push
On macOS, sed needs to be written as sed -i ''.
argocd app get podinfo-dev --refresh | grep -E 'Sync Status|Health Status' argocd app diff podinfo-dev
Sync Status: OutOfSync from main (9f3b6d1) Health Status: Healthy
argocd app sync podinfo-dev
argocd app wait podinfo-dev --health --timeout 180
kubectl -n podinfo-dev get deploy podinfo -o jsonpath='{.spec.template.spec.containers[0].image}{"\n"}'
argocd app history podinfo-dev
ghcr.io/stefanprodan/podinfo:6.17.0 ID DATE REVISION 0 2026-11-17 10:21:33 +0000 UTC main (7c1e9a2) 1 2026-11-17 10:40:02 +0000 UTC main (9f3b6d1)
argocd app set podinfo-dev --sync-policy automated cd ~/gitops-lab sed -i 's/value: "hello from dev"/value: "hello from dev (auto-sync)"/' apps/podinfo/overlays/dev/kustomization.yaml git commit -am "dev: change UI message" && git push # auto-syncs after at most about 3 minutes; to see the effect immediately: argocd app get podinfo-dev --refresh >/dev/null argocd app wait podinfo-dev --sync --health --timeout 300 argocd app get podinfo-dev | grep -E 'Sync Policy|Sync Status'
Sync Policy: Automated Sync Status: Synced to main (1d4e8c0)
argocd app rollback podinfo-dev 1 # expected to fail: not allowed while automatic sync is enabled cd ~/gitops-lab && git revert --no-edit HEAD && git push # the correct approach argocd app get podinfo-dev --refresh >/dev/null
FATA[0000] rpc error: code = FailedPrecondition desc = rollback cannot be initiated when auto-sync is enabled
Case 1: many applications with default polling overwhelm the Git server
Problem: Thousands of applications point at the same monorepo, every 3 minutes ls-remote and rendering triggers GitHub rate limits. Approach: Configure a Webhook, and increase timeout.reconciliation (for example to 600s); use the manifest-generate-paths annotation to re-render only when the relevant directories change (Hour 7). Limitation: If Webhooks are lost, detection slows down, so polling must be kept as a fallback.
Case 2: going “silent” after an automatic sync fails
Problem: A sync failed because an admission webhook rejected it; afterwards the app stayed OutOfSync and nobody noticed, because the same SHA is not retried automatically. Approach: Configure retry (limited attempts and backoff); alert on operationState.phase=Failed alerts. Limitation: Retries cannot fix configuration errors; they only suit transient errors (API timeouts, CRDs not yet ready).
Case 3: risk of deleting all resources because the render output is empty
Problem: A refactor wrote the overlay's resources incorrectly, so the render output was empty. Approach: Keep allowEmpty: false (default); Argo CD refuses to empty an application under automatic sync + prune. Limitation: Manual sync can still run, so the diff must be reviewed.
Common sync and refresh problems
git push has already been done, but after several minutes the UI still shows Synced (old SHA)
Cause: The polling interval has not yet elapsed; the push went to another branch; the Application tracks a tag or a fixed SHA; the Webhook is not configured or the signature does not match.
argocd app get podinfo-dev --refresh | grep -E 'Target|Sync Status' git -C ~/gitops-lab log -1 --format=%h origin/main
Fix: Confirm the branch and targetRevision; configure the Webhook; check the webhook processing records in the argocd-server logs.
rollback cannot be initiated when auto-sync is enabled
Cause: Under automatic sync a rollback would be overwritten immediately, so it is forbidden.
Fix:git revert; in an emergency, first argocd app set NAME --sync-policy none, then after rolling back, fix Git and restore automatic sync.
another operation is already in progress
Cause: The previous sync is still running (waiting for health, hooks not finished).
argocd app get podinfo-dev | sed -n '/Operation/,/Message/p' argocd app terminate-op podinfo-dev
Fix: Wait or terminate, then sync again; identify the stuck resource.
The diff shows many differences related to replicas and default fields, and they reappear after sync
Cause: The fields are modified by other controllers (HPA, mutating webhooks).
Fix: Use ignoreDifferences or Server-Side Diff (Hour 2); in HPA scenarios do not write replicas in Git.
1. In CI, check whether the cluster matches Git, and fail the pipeline if there are differences.
argocd app diff podinfo-dev --refresh --exit-code=true >/dev/null
rc=$?; [ $rc -eq 0 ] && echo "in sync" || { echo "drift or error ($rc)"; exit 1; }2. Without using the CLI, add an annotation to the Application to trigger a hard refresh.
kubectl -n argocd annotate application podinfo-dev argocd.argoproj.io/refresh=hard --overwrite
Developers complain that “after merging, it takes several minutes to deploy”, and the platform team worries that shortening the polling interval would overwhelm Git. Propose a solution.
Configure a Git Webhook (on argocd-server's /api/webhook, together with a signing secret) to achieve second-level refresh; you can also timeout.reconciliation increase it appropriately as a fallback to reduce Git load. When Argo CD is not exposed to the public internet, you can use the Git platform's outbound proxy or an internal Gitea, or have CI call argocd app get --refresh (requires a restricted token).
Verified instructional videos
Official docs
- Automated Sync Policy
- Git Webhook Configuration
- Diffing Customization
- Diff Strategies (Server-Side Diff)
- argocd app diff
Video storyboard (about 80 seconds)
Scene: a timeline, with git push at 10 seconds, and polling points appearing randomly between 120 and 180 seconds.
Narration: by default Git is checked every two minutes plus up to one minute of jitter, so the wait can be up to about three minutes.
Scene: a Webhook lightning icon, with the detection point right next to the push.
Narration: once a Webhook is configured, a refresh is triggered within seconds of a push.
Scene: diff view, old on the left, new on the right.
Narration: refresh only compares. To change the cluster, you need to sync.
Scene: the automatic sync switch is turned on; as soon as OutOfSync appears it automatically changes to Synced.
Narration: with automatic sync enabled, whenever a difference appears the controller syncs by itself. To roll back, use git revert.
Module 7 · Self-heal and prune: selfHeal, prune and drift
- Distinguish four kinds of drift: a field declared in Git was modified, a managed resource was deleted, an unmanaged resource was added to the cluster, and a resource was removed from Git; state the outcome of each under the selfHeal / prune switches.
- Understand resource tracking (v3 default
annotation, annotationargocd.argoproj.io/tracking-id) decides “which application this resource belongs to”, and how it relates to prune. - Protect critical resources with resource-level annotations (
Prune=false,Delete=false), and know the roles ofPruneLastandallowEmpty.
What: two switches
| Switch | Effect | Default | CLI |
|---|---|---|---|
automated.selfHeal: true | When OutOfSync is caused by a cluster-side change (not a new Git commit), it also auto-syncs, restoring the live state to the desired state. To avoid “fighting” with other controllers, it waits for the self-heal timeout before correcting (default 5 seconds, controller parameter --self-heal-timeout-seconds) | false | argocd app set NAME --self-heal |
automated.prune: true | During automatic sync, deletes resources that are “still tracked by this application but no longer in the Git render output” | false (safety first) | argocd app set NAME --auto-prune |
Both only take effect when automated are enabled. For manual sync, use argocd app sync --prune to decide whether to prune this time.
How: the outcome of the four kinds of drift
| Drift | What Argo CD sees | automated (no selfHeal) | + selfHeal | + prune |
|---|---|---|---|---|
① Modify a field declared in Git (kubectl scale,set image) | OutOfSync (the diff shows the field) | stays OutOfSync, not corrected | reverted after about 5 seconds | — |
② Delete a managed resource (kubectl delete svc podinfo) | OutOfSync + Missing | stays Missing | recreated | — |
③ Add a resource / field to the cluster that Git does not have (kubectl create cm,kubectl label, adding an env var) | Resource: not visible (no tracking annotation, belongs to no application); field: fields not declared in Git do not take part in the comparison | not handled | not handled | not deleted (unmanaged) |
| ④ Remove a resource from Git (delete the file and remove it from kustomization) | OutOfSync; the resource is marked “requires pruning” | not deleted | not deleted | deleted |
Key takeaway: Argo CD only manages “what is declared in Git”. Type ③ is the blind spot of GitOps: manually added resources need the AppProject's orphaned resource monitoring (orphanedResources, Hour 4) or admission policies (Kyverno / Gatekeeper) to be detected or blocked; manually added fields (for example an extra environment variable) are not detected under the default client-side diff, because the three-way merge only compares “fields last applied by Argo CD”.
How: resource tracking (Resource Tracking)
- v3 default
annotation: Argo CD writes to every resource of the applicationargocd.argoproj.io/tracking-id: <app-name>:<group>/<kind>:<namespace>/<name>. A resource belongs to the application only if the annotation content exactly matches “application + resource identity”; copying someone else's resource (carrying the annotation) will not be mistaken for it. label(v2 default): uses a label to record the owning application. The upstream Argo CD default label key isapp.kubernetes.io/instance, whereas the argo-cd Helm chart setsapplication.instanceLabelKeyby default toargocd.argoproj.io/instance(visible in the chart 10.18.0 values). Problems: label values are limited to 63 characters, andapp.kubernetes.io/instanceconflicts with a same-named label commonly used by Helm charts.annotation+label: the annotation is authoritative, and labels are also written (to make querying with label selectors easy).- Where to configure:
argocd-cmin theapplication.resourceTrackingMethod(this course explicitly writes annotation in values). When switching from label to annotation, the annotations appear only after the next sync; the official note warns that during the first sync after switching, deletions may not be recognized correctly, so sync once first.
Why: why prune is off by default
prune is a destructive operation: one accidental deletion in Git (or a wrong Kustomize path) can cause production resources to be deleted. Argo CD provides multiple layers of protection: allowEmpty: false (refuses to auto-prune all resources when the render output is empty), resource-level annotations argocd.argoproj.io/sync-options: Prune=false (never prune this resource),Delete=false (keep on application deletion), sync options PruneLast=true (prune last, after other resources are healthy), and the confirmation before pruning in the UI.
When: recommended combinations
| Scenario | selfHeal | prune | Notes |
|---|---|---|---|
| dev / staging | On | On | Git is the truth; the fastest way to expose problems |
| prod stateless service | On | On (combined with PR review and PruneLast) | prevents long-term drift from accumulating |
| prod stateful resources (PVCs, databases) | On | application-level on,resource-level Prune=false + Delete=false | prevent accidental deletion |
| during incident handling | temporarily turn off (--sync-policy none) | — | allows the on-call engineer to intervene manually, then backfill Git afterwards |
Comparison with similar technologies
| Argo CD | Flux | |
|---|---|---|
| Self-heal | selfHeal (triggered by cluster changes; corrected after a 5-second timeout) | each interval re-apply (Kustomization); HelmRelease can enable drift detection |
| Prune | prune, based on tracking annotations / labels | spec.prune: true, based on labels Flux writes and the inventory |
Decision diagram: how a resource is handled
selfHeal timeline
Drift simulator
Turn selfHeal and prune on / off (assuming automated is enabled), then perform actions on the cluster or Git and observe Argo CD's reaction. Each result corresponds to the table on the “Theory” page.
Commands related to self-heal and prune
| Command / configuration | Purpose | Notes |
|---|---|---|
argocd app set NAME --self-heal | Enable self-heal | Disable: --self-heal=false |
argocd app set NAME --auto-prune | Enable automatic pruning | Disable: --auto-prune=false |
argocd app sync NAME --prune | Prune during manual sync | first --dry-run preview |
argocd app resources NAME | List resources, including the “requires pruning” marker | --orphaned List orphaned resources (requires orphaned-resource monitoring enabled in the project) |
annotation argocd.argoproj.io/sync-options: Prune=false | this resource is never pruned | the application keeps showing an OutOfSync warning |
annotation argocd.argoproj.io/sync-options: Delete=false | keep this resource when the application is deleted | PVCs, databases, etc. |
Sync option PruneLast=true | prune after other resources have synced and become healthy | application-level or resource-level |
argocd app set podinfo-dev --self-heal --auto-prune argocd app get podinfo-dev -o json | jq '.spec.syncPolicy'
{
"automated": {
"prune": true,
"selfHeal": true
}
}
Note: Fields in the output depend on the actual version (for example whether it shows enabled). Verify:argocd app get podinfo-dev | grep "Sync Policy" shows Automated (Prune).
Lab 7: drift, self-heal and prune (about 8 minutes)
argocd app set podinfo-dev --sync-policy automated --self-heal=false --auto-prune=false kubectl -n podinfo-dev scale deploy podinfo --replicas=3 sleep 10; argocd app get podinfo-dev | grep -E 'Sync Status|Deployment' kubectl -n podinfo-dev get deploy podinfo
Sync Status: OutOfSync from main (2a7f5c3) apps Deployment podinfo-dev podinfo OutOfSync Healthy NAME READY UP-TO-DATE AVAILABLE AGE podinfo 3/3 3 3 30m
Drift is detected (OutOfSync), but not corrected.
argocd app set podinfo-dev --self-heal sleep 10; kubectl -n podinfo-dev get deploy podinfo kubectl -n podinfo-dev scale deploy podinfo --replicas=5; sleep 10; kubectl -n podinfo-dev get deploy podinfo
NAME READY UP-TO-DATE AVAILABLE AGE podinfo 1/1 1 1 31m deployment.apps/podinfo scaled NAME READY UP-TO-DATE AVAILABLE AGE podinfo 1/1 1 1 31m
kubectl -n podinfo-dev label deploy podinfo team=manual kubectl -n podinfo-dev create configmap manual-cm --from-literal=k=v sleep 10; argocd app get podinfo-dev | grep -E 'Sync Status' kubectl -n podinfo-dev get deploy podinfo --show-labels; kubectl -n podinfo-dev get cm manual-cm
The application is still Synced: the label and the ConfigMap are both outside the scope declared in Git. Cleanup: kubectl -n podinfo-dev label deploy podinfo team- ; kubectl -n podinfo-dev delete cm manual-cm.
apiVersion: v1 kind: ConfigMap metadata: name: demo-cm data: purpose: "prune demo"
cd ~/gitops-lab
cat > apps/podinfo/overlays/dev/demo-cm.yaml <<'EOF'
apiVersion: v1
kind: ConfigMap
metadata:
name: demo-cm
data:
purpose: "prune demo"
EOF
sed -i 's#^- ../../base#- ../../base\n- demo-cm.yaml#' apps/podinfo/overlays/dev/kustomization.yaml
kubectl kustomize apps/podinfo/overlays/dev | grep -A3 'kind: ConfigMap'
git add -A && git commit -m "dev: add demo-cm" && git push
argocd app get podinfo-dev --refresh >/dev/null; argocd app wait podinfo-dev --sync --timeout 120
kubectl -n podinfo-dev get cm demo-cm -o jsonpath='{.metadata.annotations.argocd\.argoproj\.io/tracking-id}{"\n"}'
# now delete it from Git (prune is still off)
git rm -q apps/podinfo/overlays/dev/demo-cm.yaml
sed -i '/- demo-cm.yaml/d' apps/podinfo/overlays/dev/kustomization.yaml
git commit -am "dev: remove demo-cm" && git push
argocd app get podinfo-dev --refresh | grep -E 'Sync Status|ConfigMap'
podinfo-dev:/ConfigMap:podinfo-dev/demo-cm
Sync Status: OutOfSync from main (5b2c9e8)
ConfigMap podinfo-dev demo-cm OutOfSync requires pruning
argocd app set podinfo-dev --auto-prune sleep 10; kubectl -n podinfo-dev get cm demo-cm
Error from server (NotFound): configmaps "demo-cm" not found
For core resources (empty group), the group part of the tracking-id is empty, so it is podinfo-dev:/ConfigMap:….
podinfo-dev: automated + selfHeal + prune, image 6.17.0; compared with Module 0, the dev overlay in Git differs only in newTag. The comprehensive lab writes these settings into argocd/apps/podinfo-dev.yaml.Case 1: HPA and selfHeal fight each other
Problem: The Deployment in Git sets replicas: 3, HPA scales to 8, selfHeal reverts to 3, and the replica count oscillates repeatedly. Approach: Workloads that use HPA do not set replicas in Git (remove that field in Kustomize), or configure /spec/replicas for ignoreDifferences (Hour 2). Limitation: On first creation it uses the default of 1 replica until HPA takes over.
Case 2: a directory rename deleted production
Problem: A refactor renamed overlays/prod but the Application's path was not updated, so rendering failed; in another case the path was corrected but the resource name changed, and prune deleted the Deployment with the old name, causing a brief outage. Approach: For rename-type changes, turn off prune first and clean up only after confirming the new resources are healthy; use PruneLast=true; production PRs must attach argocd app diff --local results.
Case 3: on-call manual scale-out gets “reverted”
Problem: Traffic spiked, and the on-call engineer kubectl scale scaled out, and selfHeal reverted it 5 seconds later. Approach: Incident runbook: ① pause automatic sync for this application in the UI / CLI (--sync-policy none), ② handle it manually, ③ raise a PR to make it permanent, ④ restore automatic sync. A better approach is HPA. Limitation: While paused, new Git commits will not be deployed automatically either.
Common self-heal and prune problems
The application stays OutOfSync, and the resource MESSAGE is "requires pruning"
Cause: The resource was removed from Git but prune is not enabled (or the resource carries Prune=false).
argocd app resources podinfo-dev | grep -i prun argocd app sync podinfo-dev --prune --dry-run
Fix: After confirming it can be deleted, argocd app sync --prune or enable --auto-prune.
The replica count jumps back and forth between two values (selfHeal conflicts with HPA / other controllers)
Cause: Multiple controllers manage the same field.
kubectl -n podinfo-dev get hpa kubectl -n podinfo-dev get deploy podinfo -o yaml | grep -B2 -A6 managedFields | head -30
Fix: Remove the field from Git or configure ignoreDifferences.
A manually added environment variable is never removed by selfHeal
Cause: The default client-side three-way merge only compares fields Argo CD has applied; entries not declared in Git do not take part in the comparison.
Fix: This is expected behavior; when strict control is needed, use admission policies to forbid manual changes, or evaluate the field-ownership semantics of Server-Side Apply / Server-Side Diff (Hour 2).
After switching to annotation tracking, old resources were not pruned
Cause: Old resources do not yet have the tracking annotation (annotations are written only after the next sync).
Fix: After switching, first run one sync on all applications, and only then make deletion-type changes (the recommendation in the official v3 upgrade notes).
1. Protect a PVC: never prune it, and keep it when the application is deleted.
kubectl -n podinfo-dev annotate pvc data argocd.argoproj.io/sync-options='Prune=false,Delete=false' --overwrite # A more GitOps approach: write this annotation into the PVC manifest in Git
2. Find all objects in the cluster that carry a tracking annotation and belong to podinfo-dev (Deployments and Services among any kinds).
kubectl -n podinfo-dev get deploy,svc,cm -o json | jq -r '.items[] | select(.metadata.annotations["argocd.argoproj.io/tracking-id"] // "" | startswith("podinfo-dev:")) | .kind + "/" + .metadata.name'A security audit found an “unclaimed” Deployment in the production namespace, while Argo CD shows all applications as Synced. Why did Argo CD not notice it? How can this be prevented?
The Deployment has no application's tracking annotation, so it belongs to no application, and Argo CD will neither compare nor prune it (type ③ drift). Prevention: enable in the AppProject orphanedResources orphaned resource monitoring (warn: true, Hour 4) so orphaned resources are visible in the UI / status; use Kubernetes RBAC to restrict human users' write permissions on production namespaces; use admission policies (Kyverno / Gatekeeper) to require resources to carry tracking annotations or to reject writes from non-Argo CD service accounts.
Verified instructional videos
Official docs
- Automated Sync Policy (Automatic Pruning / Self-Healing)
- Resource Tracking
- Sync Options (Prune=false, Delete=false, PruneLast)
- Orphaned Resources Monitoring
Video storyboard (about 90 seconds)
Scene: kubectl scale to 5, the replica icon increases and the Argo CD card turns yellow; after the selfHeal switch is turned on, a 5-second countdown, and the replicas shrink back to 1.
Narration: self-heal handles cluster-side drift: a field declared in Git that was changed is reverted within seconds.
Scene: the demo-cm file is deleted in Git; in the cluster demo-cm shows a red “requires pruning” marker; it disappears once prune is turned on.
Narration: prune handles resources deleted from Git. It is off by default because deletion is destructive.
Scene: kubectl create configmap manual-cm; Argo CD does not react, and a magnifying glass and a question mark appear beside it.
Narration: resources without a tracking annotation belong to no application; Argo CD cannot see them and will not delete them.
Scene: a shield labeled Prune=false, Delete=false is attached to the PVC.
Narration: for stateful resources, add protection with annotations.
Module 8 · Readiness review and introductory troubleshooting
- Review the Argo CD installation and the first application against a 12-item readiness checklist (security, rebuildability, observability, process).
- Master the fixed order of troubleshooting: application status and conditions → resource-level messages → Kubernetes events → Argo CD component logs.
- Independently resolve 5 types of beginner problems: ComparisonError, authentication failures, sync failures (apply rejected), stuck Progressing, and stuck OutOfSync.
What: readiness checklist (within the scope of this course)
| # | Category | Check item | Status in this course | Completed in |
|---|---|---|---|---|
| 1 | Rebuildable | All Argo CD installation parameters are in Git (bootstrap/argocd-values.yaml), chart version pinned | ✓ | — |
| 2 | Rebuildable | Application manifests are in Git (argocd/apps/) | Completed in the comprehensive lab | Hour 3 (App of Apps) |
| 3 | Security | Change the initial password and delete argocd-initial-admin-secret | ✓ | — |
| 4 | Security | Use SSO; disable or restrict the local admin | ✗ (lab) | Hour 4 |
| 5 | Security | Do not use default a project to host production applications | ✗ (lab) | Hour 4 |
| 6 | Security | Repository credentials are read-only and minimally scoped (GitHub App / deploy key) | public repository | Hours 4–5 |
| 7 | Security | Trusted TLS certificate (not relying on --insecure) | ✗ (lab) | Hour 4 / AKS course |
| 8 | Versioned | Images use pinned tags / digests; the main branch is protected | ✓ / recommended | — |
| 9 | Observable | Alerts for Degraded, persistent OutOfSync, and sync failures | ✗ | Hour 6 Notifications, Prometheus course |
| 10 | Process | the process and permissions for pausing automatic sync during an incident | Documented | Hour 4 RBAC |
| 11 | Resilience | Component resource requests/limits, HA, backup (argocd admin export) | ✗ (single replica) | Hour 7 |
| 12 | Change detection | Webhook or a reasonable polling interval | Polling | Hour 7 |
How: the fixed troubleshooting order
- Application layer:
argocd app get NAME— look at Sync / Health,CONDITIONS(ComparisonError, SyncError, InvalidSpecError, OrphanedResourceWarning, etc.), and the Operation's Phase and Message. - Resource layer: the MESSAGE column of the resource table in the same output;
argocd app resources;argocd app diff. - Kubernetes layer:
kubectl describe/kubectl get events/ Pod logs — most health problems are found here. - Argo CD component layer: for rendering problems check the repo-server logs; for sync, self-heal and status not updating check the application-controller logs; for login, Webhook and UI check the argocd-server logs.
Why: look at the reasons in conditions first
Argo CD aggregates problems such as comparison failures, sync failures and spec errors in status.conditions , together with the raw error text (usually the error reported by repo-server in kustomize build / git ). Most beginner problems can be located in the first step, without digging through component logs.
When: common problems grouped by layer
| Symptom | Layer | Typical causes |
|---|---|---|
| Sync Unknown + ComparisonError | Rendering | Wrong path, Kustomize syntax, repository authentication, repo-server failure |
| Sync failed (Operation Failed) | Sync | apply rejected (admission webhook, immutable field, CRD not installed, namespace does not exist) |
| Synced but stuck in Progressing / Degraded | Kubernetes | Image, probes, insufficient resources, LoadBalancer without an IP |
| OutOfSync again right after sync | Diff | Other controllers modify fields, default-value normalization differences (Hour 2 ignoreDifferences / SSD) |
| CLI / UI login failure | API | port-forward, certificate, password, RBAC |
Troubleshooting layer diagram
Quick routing by symptom
Interactive: readiness scorecard
Tick the items that match your actual environment (results are saved in this browser). Each item is weighted by importance; red items must be resolved before going to production.
Troubleshooting command list
| Layer | Command | What to look at |
|---|---|---|
| Application | argocd app get NAME | CONDITIONS, Operation, resource MESSAGE |
| Application | kubectl -n argocd get app NAME -o jsonpath='{.status.conditions}' | does not depend on the API Server |
| Resource | argocd app diff NAME / argocd app manifests NAME | desired vs live differences / render output |
| Kubernetes | kubectl -n NS get events --sort-by=.lastTimestamp | scheduling, image pulls, probes |
| Kubernetes | kubectl apply --dry-run=server -k DIR | reproduce why apply was rejected |
| Component | kubectl -n argocd logs deploy/argocd-repo-server | grep -i error | rendering, Git |
| Component | kubectl -n argocd logs argocd-application-controller-0 | grep podinfo-dev | sync, self-heal |
| Component | kubectl -n argocd logs deploy/argocd-server | login, Webhook |
| Backup | argocd admin export -n argocd > backup.yaml | export Applications / Projects / configuration (includes secrets; keep safe) |
argocd app get podinfo-dev -o json | jq '{sync: .status.sync.status, health: .status.health.status, conditions: .status.conditions, op: .status.operationState.phase, msg: .status.operationState.message}'
{
"sync": "Synced",
"health": "Healthy",
"conditions": null,
"op": "Succeeded",
"msg": "successfully synced (all tasks run)"
}
Lab 8: reproduce and fix 3 common failures (about 9 minutes)
Prerequisite: podinfo-dev has automated + selfHeal + prune enabled (the state at the end of Module 7). Every fault is created through Git and fixed through Git.
cd ~/gitops-lab sed -i 's/^images:/imagez:/' apps/podinfo/overlays/dev/kustomization.yaml git commit -am "break: typo in kustomization" && git push argocd app get podinfo-dev --refresh | grep -A3 CONDITION
CONDITION MESSAGE LAST TRANSITION ComparisonError Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = `kustomize build <path>/apps/podinfo/overlays/dev` failed exit status 1: Error: invalid Kustomization: json: unknown field "imagez" ...
kubectl kustomize apps/podinfo/overlays/dev >/dev/null # reproduce locally git revert --no-edit HEAD && git push argocd app get podinfo-dev --refresh | grep -E 'Sync Status|CONDITION'
Note: workloads are not affected while rendering fails (Argo CD does not delete anything just because it cannot render).
sed -i 's/newTag: "6.17.0"/newTag: "6.99.99"/' apps/podinfo/overlays/dev/kustomization.yaml git commit -am "break: bad image tag" && git push argocd app get podinfo-dev --refresh >/dev/null; sleep 30 argocd app get podinfo-dev | grep -E 'Sync Status|Health Status|Deployment' kubectl -n podinfo-dev get pods kubectl -n podinfo-dev get events --sort-by=.lastTimestamp | tail -3
Sync Status: Synced to main (e41a7b9) Health Status: Progressing apps Deployment podinfo-dev podinfo Synced Progressing Waiting for rollout to finish: 1 old replicas are pending termination... NAME READY STATUS RESTARTS AGE podinfo-5d8c7b9f6d-k2m4x 1/1 Running 0 20m podinfo-7f6b5c4d3e-q9w8e 0/1 ImagePullBackOff 0 30s ... Failed to pull image "ghcr.io/stefanprodan/podinfo:6.99.99": ... not found
git revert --no-edit HEAD && git push argocd app get podinfo-dev --refresh >/dev/null; argocd app wait podinfo-dev --health --timeout 180
The old Pods keep serving (protected by maxUnavailable during the rolling update); after progressDeadlineSeconds (default 600 seconds) is exceeded, health becomes Degraded.
cat >> apps/podinfo/overlays/dev/kustomization.yaml <<'EOF'
- target:
kind: Deployment
name: podinfo
patch: |-
- op: add
path: /spec/selector/matchLabels/tier
value: web
- op: add
path: /spec/template/metadata/labels/tier
value: web
EOF
kubectl kustomize apps/podinfo/overlays/dev | grep -A4 'selector:'
git commit -am "break: change immutable selector" && git push
argocd app get podinfo-dev --refresh >/dev/null; sleep 15
argocd app get podinfo-dev | sed -n '/Operation/,/Message/p'
Operation: Sync Sync Revision: b7d2e10... Phase: Failed Message: one or more objects failed to apply, reason: Deployment.apps "podinfo" is invalid: spec.selector: Invalid value: ...: field is immutable
The appended block is patches: the second item of the list (the end of the file happens to be the patches list). The Deployment's selector is immutable, so apply is rejected by the API Server. The fix is to revert; if the selector really must change, use the sync option Replace=true or delete and then recreate (this interrupts service; Hour 2).
git revert --no-edit HEAD && git push argocd app get podinfo-dev --refresh >/dev/null; argocd app wait podinfo-dev --sync --health --timeout 180
kubectl kustomize ~/gitops-lab/apps/podinfo/overlays/dev | grep -E 'image:|tier' argocd app get podinfo-dev | grep -E 'Sync Status|Health Status'
image: ghcr.io/stefanprodan/podinfo:6.17.0 Sync Status: Synced to main (…) Health Status: Healthy
Case 1: a GitHub outage
Problem: GitHub is partially unavailable and all applications show ComparisonError; the on-call engineer mistakenly thought the cluster had failed. Approach: First check the error text in conditions (failed to list refs … 503), confirm it is an external dependency; workloads are not affected, only delivery is paused. Limitation: For long outages, consider an internal Git mirror.
Case 2: a sync failure went unalerted; production stayed on the old version for 2 days
Problem: A change to an immutable field caused the sync to fail, and automatic sync does not retry the same SHA. Approach: Alert on operationState.phase=Failed ; add kubectl apply --dry-run=server (against a test cluster) to catch such problems.
Case 3: readiness review as a go-live gate
Approach: The platform team uses this module's 12-item checklist as the admission condition for new teams joining Argo CD; each item maps to a capability taught in a later course (SSO, AppProject, notifications, HA). Limitation: The checklist must be updated with versions (for example, the v3 RBAC log-permission changes).
Interactive troubleshooting tree
Start from the symptom you see, click through step by step, and get diagnostic commands and fix suggestions.
1. Without going through the Argo CD API Server, print all condition types and messages for podinfo-dev.
kubectl -n argocd get app podinfo-dev -o json | jq -r '.status.conditions[]? | .type + ": " + .message'
2. Before syncing, reproduce whether the API Server would reject the dev overlay.
kubectl apply --dry-run=server -k ~/gitops-lab/apps/podinfo/overlays/dev
A new colleague says: “podinfo-dev is OutOfSync; I clicked Sync and it showed success, but after a while it is OutOfSync again.” How would you investigate?
A typical “drifts again after sync”. ① argocd app diff check which field; ② determine who is changing it: HPA (replicas), mutating webhooks (injecting sidecars / defaults), another controller, or a person; ③ kubectl get … -o yaml the managedFields in managedFields shows who manages each field; ④ fix: delete that field from Git,ignoreDifferences or enable Server-Side Diff to handle defaults correctly (Hour 2); if a person changed it by hand, enable selfHeal and constrain permissions.
Verified instructional videos
No verified video was found that specifically covers beginner troubleshooting for Argo CD v3; use the official docs and storyboard below.
Official docs
Video storyboard (about 90 seconds)
Scene: a four-layer pyramid: application, resource, Kubernetes, component.
Narration: troubleshoot from the top down: first the application status and conditions, then the resource messages, then the Kubernetes events, and finally the Argo CD component logs.
Scene: in a ComparisonError message, “unknown field imagez” is highlighted.
Narration: an unknown state plus a comparison error means rendering failed. The error text usually tells you directly which line is wrong.
Scene: Synced + Progressing, and ImagePullBackOff in the Pod list.
Narration: synced but unhealthy means the problem is in the workload itself. Fix Git, not re-sync.
Scene: Operation Failed, field is immutable.
Narration: a sync failure means the API server rejected the change. Automatic sync will not retry the same commit, so remember to set up an alert.
Command cheat sheet
kind create cluster --config ~/gitops-lab/bootstrap/kind-lab.yaml kubectl config use-context kind-lab helm repo add argo https://argoproj.github.io/argo-helm && helm repo update helm upgrade --install argocd argo/argo-cd -n argocd --create-namespace \ --version 10.18.0 -f ~/gitops-lab/bootstrap/argocd-values.yaml --wait helm get values argocd -n argocd --all kubectl -n argocd get pods
kubectl -n argocd port-forward svc/argocd-server 8080:443 argocd admin initial-password -n argocd argocd login localhost:8080 --username admin --insecure argocd account update-password kubectl -n argocd delete secret argocd-initial-admin-secret argocd login --core # core mode (uses kubeconfig) argocd admin dashboard -n argocd
argocd app create podinfo-dev --project default \ --repo https://github.com/<you>/gitops-lab.git --revision main \ --path apps/podinfo/overlays/dev \ --dest-server https://kubernetes.default.svc --dest-namespace podinfo-dev \ --sync-option CreateNamespace=true kubectl apply -n argocd -f ~/gitops-lab/argocd/apps/podinfo-dev.yaml argocd app list argocd app get podinfo-dev [--refresh|--hard-refresh] argocd app resources podinfo-dev argocd app manifests podinfo-dev --source git|live argocd app history podinfo-dev
argocd app diff podinfo-dev # 0 no difference / 1 differences / 2 error argocd app diff podinfo-dev --local ~/gitops-lab/apps/podinfo/overlays/dev argocd app sync podinfo-dev [--dry-run] [--prune] argocd app wait podinfo-dev --sync --health --timeout 180 argocd app terminate-op podinfo-dev argocd app rollback podinfo-dev ID # manual sync mode only kubectl -n argocd annotate app podinfo-dev argocd.argoproj.io/refresh=hard --overwrite
argocd app set podinfo-dev --sync-policy automated argocd app set podinfo-dev --self-heal --auto-prune argocd app set podinfo-dev --self-heal=false --auto-prune=false argocd app set podinfo-dev --sync-policy none # pause during an incident argocd app set podinfo-dev --sync-option CreateNamespace=true argocd app unset podinfo-dev --kustomize-image ghcr.io/stefanprodan/podinfo
kubectl -n argocd get app podinfo-dev -o jsonpath='{.status.conditions}'
kubectl kustomize ~/gitops-lab/apps/podinfo/overlays/dev
kubectl apply --dry-run=server -k ~/gitops-lab/apps/podinfo/overlays/dev
kubectl -n podinfo-dev get events --sort-by=.lastTimestamp
kubectl -n argocd logs deploy/argocd-repo-server --tail=100
kubectl -n argocd logs argocd-application-controller-0 --tail=100
kubectl -n argocd logs deploy/argocd-server --tail=100
argocd admin export -n argocd > argocd-backup.yamlKey configuration at a glance
| Location | Key | Value in this course / default | Meaning |
|---|---|---|---|
argocd-cm | timeout.reconciliation / .jitter | 120s / 60s | periodic refresh interval and jitter (up to about 3 minutes) |
argocd-cm | timeout.hard.reconciliation | 0s (off) | periodic hard refresh |
argocd-cm | application.resourceTrackingMethod | annotation (v3 default) | resource tracking method |
argocd-cmd-params-cm | server.insecure | false | server terminates TLS itself |
argocd-cmd-params-cm | controller.resource.health.persist | not set (not persisted in v3) | resource health written into CR |
| Application | spec.syncPolicy.automated.{enabled,prune,selfHeal,allowEmpty} | dev: true/true/true/false | Automatic sync policy |
| Resource annotations | argocd.argoproj.io/sync-options | Prune=false,Delete=false | resource-level protection |
| resource annotation | argocd.argoproj.io/tracking-id | app:group/Kind:ns/name | written by Argo CD; do not edit by hand |
Status at a glance
| Sync | Synced · OutOfSync · Unknown |
|---|---|
| Health | Healthy · Progressing · Degraded · Suspended · Missing · Unknown (the application takes the worst) |
| Operation | Running · Succeeded · Failed · Error · Terminating |
Comprehensive lab: fully hand podinfo-dev over to GitOps
Scenario
The team requires: everything in the dev environment (including the Argo CD Application definition) comes from the gitops-lab repo; manual changes must be corrected within seconds; resources deleted from Git must disappear from the cluster. You need to deliver a declarative argocd/apps/podinfo-dev.yaml, and demonstrate drift and pruning.
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: podinfo-dev
namespace: argocd
labels:
app.kubernetes.io/part-of: podinfo
env: dev
finalizers:
# When this Application is deleted, cascade-delete the resources it manages (acceptable for the dev environment)
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: https://github.com/<you>/gitops-lab.git
targetRevision: main
path: apps/podinfo/overlays/dev
destination:
server: https://kubernetes.default.svc
namespace: podinfo-dev
syncPolicy:
automated:
enabled: true
prune: true
selfHeal: true
allowEmpty: false
syncOptions:
- CreateNamespace=true
- PruneLast=true
retry:
limit: 3
backoff:
duration: 10s
factor: 2
maxDuration: 2mcd ~/gitops-lab git add argocd/apps/podinfo-dev.yaml git commit -m "argocd: declarative podinfo-dev application" && git push kubectl apply -n argocd -f argocd/apps/podinfo-dev.yaml argocd app get podinfo-dev | grep -E 'Sync Policy|Sync Status|Health Status'
application.argoproj.io/podinfo-dev configured Sync Policy: Automated (Prune) Sync Status: Synced to main (…) Health Status: Healthy
If an application with the same name was created earlier with the CLI,kubectl apply it will take it over and update it (it may warn about a missing last-applied annotation, which can be ignored); parameter overrides applied earlier with argocd app set will be replaced by the definition in the YAML. From Hour 3, this file will be managed automatically by the root application argocd/root.yaml so there is no longer a need for kubectl apply.
kubectl -n podinfo-dev get deploy podinfo -o jsonpath='{.spec.template.spec.containers[0].image}{" replicas="}{.spec.replicas}{"\n"}'
kubectl -n podinfo-dev get deploy podinfo -o jsonpath='{.metadata.annotations.argocd\.argoproj\.io/tracking-id}{"\n"}'
ghcr.io/stefanprodan/podinfo:6.17.0 replicas=1 podinfo-dev:apps/Deployment:podinfo-dev/podinfo
A reader starting from scratch will see 6.16.0 (Module 6's upgrade not yet done); this is also normal, and you can commit the upgrade following step 1 of the Module 6 lab.
kubectl -n podinfo-dev set image deploy/podinfo podinfod=ghcr.io/stefanprodan/podinfo:6.16.0
kubectl -n podinfo-dev scale deploy podinfo --replicas=4
sleep 15
kubectl -n podinfo-dev get deploy podinfo -o jsonpath='{.spec.template.spec.containers[0].image}{" replicas="}{.spec.replicas}{"\n"}'
ghcr.io/stefanprodan/podinfo:6.17.0 replicas=1
kubectl -n podinfo-dev delete svc podinfo sleep 15; kubectl -n podinfo-dev get svc podinfo
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE podinfo ClusterIP 10.96.88.143 <none> 9898/TCP 8s
apps/podinfo/overlays/dev/demo-cm.yaml). After confirming the deletion, kubectl -n podinfo-dev get cm demo-cm it returns NotFound.argocd app history podinfo-dev git -C ~/gitops-lab log --oneline -8
Every REVISION in the sync history can be found as a commit in git log.
apps/podinfo/base/{kustomization,deployment,service}.yaml,apps/podinfo/overlays/{dev,staging,prod}/kustomization.yaml,argocd/apps/podinfo-dev.yaml,bootstrap/{kind-lab.yaml,argocd-values.yaml},argocd/appsets/.gitkeep,argocd/projects/.gitkeep,README.md. To release resources: kind delete cluster --name lab (everything in Git can be rebuilt within 15 minutes).Acceptance checklist
Open-ended self-test (6 questions)
1. Explain the four GitOps principles in your own words, and give one example that violates each.
Declarative (violation: a deployment script that calls kubectl scale / set image step by step); versioned and immutable (violation: latest a mutable tag, force push); pulled automatically (violation: CI holds the kubeconfig and pushes); continuously reconciled (violation: aligned only at deploy time, manual changes go unnoticed).
2. When argocd-server, repo-server or application-controller goes down, what symptom appears in each case?
server: UI / CLI / Webhook unavailable, reconciliation and self-heal continue; repo-server: ComparisonError, Sync Unknown, no new changes are deployed; controller: status does not update, no sync, no self-heal. None of the three affects running workloads.
3. Why does this course install Argo CD with the Helm chart and put the values file into Git?
All settings are centralized in one reviewable, versioned file; later courses only need to modify values and helm upgrade; the installation can be reproduced fully when the cluster is rebuilt; the chart handles details such as CRD retention.
4. What do Synced + Degraded and OutOfSync + Healthy each mean? How does the handling differ?
The former: the cluster matches Git, but the version in Git itself is faulty → fix Git (revert). The latter: the cluster differs from Git but runs normally → look at the diff, decide whether it is an unsynced new commit or drift, then sync or enable self-heal.
5. Which kinds of drift do selfHeal and prune each handle? Which drifts can neither of them handle?
selfHeal: declared fields that were changed and managed resources that were deleted. prune: resources removed from Git that are still tracked. Neither handles: resources without a tracking annotation (manually created), fields not declared in Git, and periods when Argo CD is paused or failing.
6. Your team is evaluating Argo CD and Flux. List three requirements that would push you toward Flux and three that would push you toward Argo CD.
Leaning Flux: relies on Helm-native release semantics and automatic rollback on failure; prefers a lightweight, UI-less solution with pure Kubernetes RBAC; uses the AKS / Arc managed GitOps extension. Leaning Argo CD: dev teams need a UI to view the resource tree and diff; centralized management of multiple clusters is needed; SSO + fine-grained RBAC + AppProject multi-tenancy is needed.
Final quiz (12 questions, covering all modules)
Sources and version notes
| Topic | Verified conclusion | Source (accessed 2026-11-17) |
|---|---|---|
| Argo CD version | Latest stable v3.6.1 (2026-11-04); v3.6.0 (2026-11-03); patch lines v3.5.7, v3.4.13, v3.3.19 (2026-11-02) | github.com/argoproj/argo-cd/releases |
| Helm chart | argo/argo-cd 10.18.0 (2026-11-11), appVersion v3.6.1, kubeVersion >=1.25.0-0; values keys: global.domain,crds.install/keep,configs.cm (default timeout.reconciliation: 120s,timeout.reconciliation.jitter: 60s,timeout.hard.reconciliation: 0s,application.instanceLabelKey: argocd.argoproj.io/instance),configs.params,dex.enabled (default true),redis-ha.enabled (default false),notifications.enabled (default true),commitServer.enabled (default false),redisSecretInit.enabled (default true) | argo-helm releases · charts/argo-cd (Chart.yaml, values.yaml @ argo-cd-10.18.0) |
| v2.14 → v3.0 changes | annotation tracking by default; log RBAC enforced (removed server.rbac.log.enforce.enable); fine-grained update/delete RBAC not inherited; default resource.exclusions (Endpoints, EndpointSlice, Lease, etc.); removed argocd-cm in repositories,repository.credentials,helm.repositories; Dex subject changed to federated_claims.user_id; health no longer persisted (controller.resource.health.persist); ignoreResourceStatusField default all; ignoreDifferences also applies to resource updates; metrics argocd_app_sync_status etc. removed | Upgrading 2.14 → 3.0 |
| v3.5 → v3.6 changes | Server-Side Diff is used automatically when ServerSideApply=true ; OTLP settings changed; app diff --local default includes *.tpl,Chart.lock | Upgrading 3.5 → 3.6 |
| automatic sync | automated.enabled/prune/selfHeal/allowEmpty; triggers only when OutOfSync; the same SHA is not auto-retried after failure; self-heal timeout defaults to 5 seconds; polling defaults to 120s + 60s jitter (up to about 3 minutes) | Automated Sync Policy |
| CLI | argocd app diff exit codes 0/1/2 and --refresh,--hard-refresh,--local; argocd app unset --kustomize-image; argocd app list no parameter to filter by health | CLI reference |
| GitOps principles | OpenGitOps v1.0.0 four principles: Declarative; Versioned and Immutable; Pulled Automatically; Continuously Reconciled (the original text uses “state store” and does not restrict it to Git) | opengitops.dev · open-gitops/documents PRINCIPLES.md |
| Flux | Latest v2.10.0 (2026-10-26); object model GitRepository / OCIRepository / HelmRepository, Kustomization, HelmRelease; helm-controller uses the Helm SDK | fluxcd/flux2 releases · fluxcd.io/flux/components |
| kind | v0.33.0 (2026-08-26), node image kindest/node:v1.37.0@sha256:a1ed56cf… (consistent with the Kubernetes course) | kind releases |
| podinfo | 6.17.0 (2026-10-26), 6.16.0 (2026-10-26); port 9898,/healthz,/readyz, environment variable PODINFO_UI_MESSAGE | stefanprodan/podinfo releases |
Video verification notes
The following videos were checked for title and channel via the YouTube oEmbed API (https://www.youtube.com/oembed?url=…&format=json, 2026-11-17): TechWorld with Nana “What is GitOps, How GitOps works and Why it's so useful” (f5EpcWp0THw), “ArgoCD Tutorial for Beginners | GitOps CD for Kubernetes” (MeU5_k9ssrs); DevOps & AI Toolkit “Argo CD - Applying GitOps Principles To Manage A Production Environment In Kubernetes” (vpWQeoaiRM4); That DevOps Guy “Introduction to Argo CD : Kubernetes DevOps CI/CD” (2WSJF7d8dUg); KodeKloud “ArgoCD Tutorial: Step-by-Step Installation and UI App Deployment | KodeKloud” (8AJlVQy6Cx0); Argo Proj “Argo CD Demo” (0WAm0y2vLIo). Most of these videos were recorded in the Argo CD v1/v2 era, so follow this course for installation methods and defaults. No dedicated, verified videos were found for Modules 5 and 8, so storyboards are provided instead.
Voice narration notes
The “Voice” page uses the browser's Web Speech API (speechSynthesis, en-US) to read the narration script aloud in real time, with English terms pronounced in en-US. The result depends on the voices installed on the operating system. This courseware's build environment cannot call a TTS service, so no MP3 is embedded; for offline audio, give the narration script to any TTS tool.
Known limitations
- Commands in this courseware have not been run on a real cluster; the “expected output” is an example written from the official docs and CLI behavior, and the commit SHAs, Pod name suffixes, IPs, times and log fields are example values; follow your own environment.
- The keys of the values file were checked against chart 10.18.0's
values.yamlverification;helm templaterendered output and the Pod list (such as whether the redis-secret-init Job is kept) depend on the actual version. - The exact error messages (ComparisonError, immutable field, rollback refusal, etc.) may differ slightly between versions; locate them by keyword.
- In a kind environment GitHub cannot reach localhost, so this course does not demonstrate a Git Webhook (Hour 7 demonstrates it with an in-cluster Gitea).
- For Argo CD v3.6's official “tested Kubernetes versions”, follow the release notes; this course is written for kind's default v1.37.0.
- The timings in the animations (polling jitter, the 5-second self-heal wait, component startup order) are illustrative, meant to explain the mechanism, and do not represent exact timing.
- The Flux section is an architecture comparison only; no Flux commands are run in this course. Hands-on Flux content is in the Helm course and Hour 5 of the AKS course.