Hour 6: Progressive Delivery and Automation

Making “merging a PR” safely become “going live in production”: the split of work between CI and CD, canary and blue-green releases, metric-based automatic rollback, automatic image updates, notifications, change freezes and environment promotion
Argo CD v3.6.1Argo Rollouts v1.10.2Image Updater v1.5.0Prometheus v3.16.0Verified · 2026-11-17
Overall Learning Goals
  • Explain, in tool-neutral GitOps terms, the division of responsibilities between CI and CD: CI builds, tests and pushes the image, then opens a PR that changes the desired state (apps/podinfo/overlays/* the image tag in it); Argo CD inside the cluster pulls and reconciles it. CI does not hold cluster credentials.
  • Replace podinfo's Deployment with an Argo Rollouts Rollout, using setWeight / pause for canary, and two Services, active / preview, for blue-green; understand the approximation that without traffic routing, “weight = replica ratio”.
  • Write AnalysisTemplate, and use Prometheus to query podinfo's http_requests_total calculate the canary success rate, and let the AnalysisRun decide automatically whether to continue or abort, and carry out the real rollback in Git.
  • Configure Argo CD Image Updater (the v1.x ImageUpdater CRD), and distinguish argocd and git write-back methods, and compare them with Flux's image automation.
  • Use Notifications triggers, templates and subscriptions to send sync-succeeded, sync-failed and degraded events to a local Webhook (zero cost) or Slack.
  • Use the AppProject's sync windows to enforce change freezes, define drift policy (self-heal vs alert-only) and break-glass emergency change process; use PRs between environment directories to promote, and learn about Kargo.

1-hour time allocation table

#TimeModuleCore contentAnimation / interactionLab (kind cluster lab)
0Pre-classPrep: Argo Rollouts and PrometheusMinimal starting point; install the Rollouts controller and a slim Prometheus with Argo CD, plus the kubectl pluginEnvironment self-check listplatform application Healthy
100–06From CI to GitOps: Who Changes GitPush vs pull model, CI opening a PR to change image tags, immutable tags and digests, credential boundariesPipeline flow: switching between push / pull modeSimulate CI: branch + kustomize edit set image + PR
206–13Argo Rollouts: Canary and Blue-GreenRollout CRD, canary steps, blue-green active/preview, traffic management, Argo CD health and resource actions, Flagger comparisonCanary weight to replica conversion + blue-green switchConvert podinfo to a Rollout and promote manually
313–21AnalysisTemplate: Automatic RollbackAnalysisTemplate / AnalysisRun, Prometheus provider, failureLimit, Inconclusive / Error, abort and Git rollbackCore animation: canary + AnalysisRun verdict promote / abortRelease a “bad version” and watch it abort automatically
421–28Argo CD Image UpdaterImageUpdater CRD, update strategies, argocd vs git write-back, write-back branch and PR, Flux comparisonTag selector: strategy + constraint → chosen versiondev automatically upgrades from 6.16.0 to 6.17.0
528–35Notifications: NotificationsTriggers (expr), templates, services, subscription annotations, oncePer, Rollouts notificationsEvent → trigger → template → serviceLocal Webhook receiver gets the notification
635–42Sync Windows and Change Freezesallow / deny, manualSync, timeZone, syncOverrun; drift policy; break-glass processSync window evaluatorFreeze prod, manual override, write emergency changes back to Git
742–50Environment Promotion: PR Flow and Promotion ToolsPR promotion from dev → staging → prod, promotion gates, Kargo (Warehouse / Freight / Stage)Promotion board: Freight moving across environmentsGenerate promotion PRs with a script
850–60Hours 1–6 Recap and End-to-End DrillLinking hours 1–6: the full path from commit to production, and common breakpointsEnd-to-end replay + troubleshooting treeEnd-to-end drill
—Post-classCheat sheet · Capstone labBuild a complete delivery chain for podinfo: “automatic update → canary analysis → notification → PR promotion”Final quiz (12 questions)Capstone lab

Knowledge Coverage Matrix

Target skillsM1M2M3M4M5M6M7M8Key commandsLab
Divide CI and CD responsibilities; change the desired state via PR✓··✓··✓✓kustomize edit set image,gh pr createSimulate CI PR
Canary and blue-green releases·✓✓····✓kubectl argo rollouts get/promoteRollout conversion
Metric-based automatic abort and rollback··✓····✓get analysisrun, PromQLBad version aborted
Automatic image updates and write-back✓··✓··✓·get imageupdatersdev auto-upgrade
Notifications and event subscriptions····✓✓·✓argocd admin notificationsLocal Webhook
Change freezes, drift policy and emergency changes·····✓✓✓argocd proj windowsFreeze prod
Multi-environment promotion✓··✓·✓✓✓git diff overlays/Promotion PR

Topics excluded from this lesson (and where to learn them)

TopicWhy not in this lessonWhere to learn
GitHub Actions / GitLab CI pipeline syntax detailsThis lesson only cares about one interface: “how CI changes Git”GitHub 8 hours · GitLab 8 hours
Prometheus alerting rules, Grafana dashboards, kube-prometheus-stack operationsThis lesson only uses Prometheus as the AnalysisTemplate data sourcePrometheus & Grafana 8 hours
Full configuration of Istio / Gateway API traffic splittingRequires a service mesh or gateway controller, beyond 1 hour; this lesson explains the principles and gives a minimal exampleRollouts Traffic Management
ApplicationSet RollingSync (syncing in batches by environment)Belongs to the ApplicationSet topicHour 3
Secrets management (encrypted storage of Git credentials and Slack tokens)Belongs to the security topicHour 5
Controller sharding, performance tuning, OutOfSync loop diagnosisBelongs to the scaling and troubleshooting topicHour 7

How to use this courseware

10 pages per module
Theory · Diagrams · Animation · Commands · Labs · Production cases · Troubleshooting · Quiz · Voice · Video. It is recommended to read “Theory” and “Animation” first, then do the “Labs”. The animation in Module 3 is the core of this lesson.
Learning progress
Progress counts once the quiz score is ≥ 70% or you click “Mark module complete”; it is saved in this browser (if local storage is blocked, it is cleared on refresh).
Chinese voice
The “Voice” tab uses the browser's built-in Web Speech API (en-US) to read the narration aloud; without a Chinese voice pack, the narration can still be read or passed to a TTS tool.
Version notes This lesson uses the versions verified on 2026-11-17 as its baseline: Argo CD v3.6.1 (Helm chart argo/argo-cd 10.18.0); Argo Rollouts v1.10.2 (chart argo/argo-rollouts 2.43.12; v1.11.0-rc1 is still a pre-release); Argo CD Image Updater v1.5.0 (chart argo/argocd-image-updater 1.5.0; 1.x changed to ImageUpdater CRD configuration; the latest 0.x maintenance branch is v0.19.0); Prometheus chart prometheus-community/prometheus 29.47.2 (Prometheus v3.16.0), optional kube-prometheus-stack 93.3.1; podinfo 6.17.0 / 6.16.0; Kargo v1.12.6; Flagger v1.45.0; Flux v2.10.0; kind v0.33.0. “Expected output” is marked as “example” if it was not actually run.

Module 0 · Prep: Argo Rollouts and Prometheus (complete before class)

On the environment from hours 1–5, use Argo CD itself to install the Rollouts controller and a slim Prometheus, and set up the kubectl plugin
Pre-class ≈ 12 minZero cloud cost
Prerequisites
  • kind cluster lab (context kind-lab), Argo CD installed as a Helm release argocd in namespace argocd (Hour 1), with the values file at ~/gitops-lab/bootstrap/argocd-values.yaml.
  • Your own GitHub repository gitops-lab (local clone at ~/gitops-lab), containing apps/podinfo/base/ and apps/podinfo/overlays/dev|staging|prod/, plus an Application podinfo-dev / podinfo-staging / podinfo-prod (from Hour 3, generated by ApplicationSet podinfo (argocd/appsets/podinfo.yaml) with auto-sync and self-heal; from Hour 4 it belongs to the project platform). This lesson only modifies overlays and ApplicationSet, and does not directly modify the generated Application.
  • AppProject platform (Hour 4) allows deploying cluster-level resources (CRDs, ClusterRoles). Without this project, this lesson's platform components can first be placed in default project.
  • Resources: kind nodes need about 1.5 GB of extra memory (Rollouts controller about 100 MB, Prometheus about 300–500 MB, podinfo 4 replicas + load generator).
If you do not have the results from the previous lesson Follow the “minimal starting point” below to get ready in 10 minutes. It only includes what this lesson needs: a kind cluster, Argo CD, the podinfo base and dev overlay in the gitops-lab repository, and the Application podinfo-dev.
Minimal starting point (expand)
kind create cluster --name lab
helm repo add argo https://argoproj.github.io/argo-helm && helm repo update
mkdir -p ~/gitops-lab/bootstrap && cd ~/gitops-lab
cat > bootstrap/argocd-values.yaml <<'EOF'
configs:
  params:
    server.insecure: true      # lab only: access via port-forward
EOF
helm upgrade --install argocd argo/argo-cd -n argocd --create-namespace \
  --version 10.18.0 -f bootstrap/argocd-values.yaml --wait
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d; echo
kubectl -n argocd port-forward svc/argocd-server 8080:443 &
argocd login localhost:8080 --username admin --insecure
# Repository layout (after creating an empty gitops-lab repository on GitHub)
mkdir -p apps/podinfo/base apps/podinfo/overlays/{dev,staging,prod} argocd/apps argocd/projects
cat > apps/podinfo/base/service.yaml <<'EOF'
apiVersion: v1
kind: Service
metadata:
  name: podinfo
spec:
  selector:
    app: podinfo
  ports:
  - name: http
    port: 9898
    targetPort: http
EOF
cat > apps/podinfo/base/kustomization.yaml <<'EOF'
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml      # Module 2 will replace it with rollout.yaml
- service.yaml
EOF
for env in dev staging prod; do
cat > apps/podinfo/overlays/$env/kustomization.yaml <<EOF
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: podinfo-$env
resources:
- ../../base
images:
- name: ghcr.io/stefanprodan/podinfo
  newTag: 6.16.0
EOF
done
apiVersion: apps/v1
kind: Deployment
metadata:
  name: podinfo
spec:
  replicas: 2
  selector:
    matchLabels:
      app: podinfo
  template:
    metadata:
      labels:
        app: podinfo
    spec:
      containers:
      - name: podinfod
        image: ghcr.io/stefanprodan/podinfo:6.16.0
        command: ["./podinfo", "--port=9898", "--port-metrics=9797"]
        ports:
        - { name: http, containerPort: 9898 }
        - { name: http-metrics, containerPort: 9797 }
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: podinfo-dev
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/<you>/gitops-lab
    targetRevision: main
    path: apps/podinfo/overlays/dev
  destination:
    server: https://kubernetes.default.svc
    namespace: podinfo-dev
  syncPolicy:
    automated: { prune: true, selfHeal: true }
    syncOptions: [CreateNamespace=true]
git add . && git commit -m "minimal starting point for hour 6" && git push -u origin main
kubectl apply -f argocd/apps/podinfo-dev.yaml
argocd app wait podinfo-dev --health --timeout 180

If the repository is private, you first need to argocd repo add add credentials (Hour 2). If you do not have platform project, all of the following project: platform change to project: default.

Step 1: Check the existing environment

kubectl config use-context kind-lab
argocd app list -o name
kubectl -n podinfo-dev get deploy,svc,pod -o wide
grep -n newTag ~/gitops-lab/apps/podinfo/overlays/*/kustomization.yaml
argocd/podinfo-dev
argocd/podinfo-staging
argocd/podinfo-prod
NAME                      READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/podinfo   2/2     2            2           3d
…
apps/podinfo/overlays/dev/kustomization.yaml:9:  newTag: 6.17.0
apps/podinfo/overlays/prod/kustomization.yaml:9:  newTag: 6.16.0
apps/podinfo/overlays/staging/kustomization.yaml:9:  newTag: 6.16.0
Set dev back to 6.16.0 At the end of Hour 1, dev is 6.17.0 and staging / prod are 6.16.0. This lesson repeatedly demonstrates the upgrade from 6.16.0 → 6.17.0, so first change dev's newTag back to 6.16.0 and push: cd ~/gitops-lab/apps/podinfo/overlays/dev && kustomize edit set image ghcr.io/stefanprodan/podinfo:6.16.0 && git commit -am "dev: 6.16.0 for hour 6" && git push. The container name in the base keeps the one from Hour 1 podinfod.

Step 2: Install the Argo Rollouts controller with Argo CD (platform components managed by GitOps)

Platform components also follow GitOps: in argocd/apps/ declare an Application that points to the official Helm chart. The Rollouts CRDs are large, so use ServerSideApply=true to avoid the annotation length limit of client-side apply.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: argo-rollouts
  namespace: argocd
spec:
  project: platform
  source:
    repoURL: https://argoproj.github.io/argo-helm
    chart: argo-rollouts
    targetRevision: 2.43.12          # appVersion v1.10.2
    helm:
      valuesObject:
        dashboard:
          enabled: true              # read-only UI, access via port-forward
  destination:
    server: https://kubernetes.default.svc
    namespace: argo-rollouts
  syncPolicy:
    automated: { prune: true, selfHeal: true }
    syncOptions: [CreateNamespace=true, ServerSideApply=true]

You can also directly kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/download/v1.10.2/install.yaml (the official manifest method). This lesson chooses Helm + Argo CD so that the platform components also have Git history.

Step 3: Install a slim Prometheus (the data source for AnalysisTemplate)

You only need one Prometheus server to scrape podinfo's metrics, so turn off Alertmanager, Pushgateway, node-exporter and kube-state-metrics. The chart's built-in kubernetes-pods scrape job will scrape pods with prometheus.io/scrape: "true" annotations, and map pod labels to metric labels (rollouts-pod-template-hash become rollouts_pod_template_hash) — Module 3 uses exactly this to tell canary from stable.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: prometheus
  namespace: argocd
spec:
  project: platform
  source:
    repoURL: https://prometheus-community.github.io/helm-charts
    chart: prometheus
    targetRevision: 29.47.2          # Prometheus v3.16.0
    helm:
      valuesObject:
        alertmanager: { enabled: false }
        prometheus-pushgateway: { enabled: false }
        prometheus-node-exporter: { enabled: false }
        kube-state-metrics: { enabled: false }
        server:
          persistentVolume: { enabled: false }
          retention: 6h
          global:
            scrape_interval: 15s     # default is 1m, too slow for canary analysis
  destination:
    server: https://kubernetes.default.svc
    namespace: monitoring
  syncPolicy:
    automated: { prune: true, selfHeal: true }
    syncOptions: [CreateNamespace=true, ServerSideApply=true]
cd ~/gitops-lab
git add argocd/apps/argo-rollouts.yaml argocd/apps/prometheus.yaml
git commit -m "platform: argo-rollouts 2.43.12 + minimal prometheus 29.47.2" && git push
# If you already have App of Apps (argocd/root.yaml, Hour 3), it is created automatically; otherwise apply manually:
kubectl apply -f argocd/apps/argo-rollouts.yaml -f argocd/apps/prometheus.yaml
argocd app wait argo-rollouts prometheus --health --timeout 300
kubectl get crd | grep argoproj.io | grep -E 'rollouts|analysis'
kubectl -n monitoring get svc prometheus-server
analysisruns.argoproj.io                 2026-11-17T02:10:11Z
analysistemplates.argoproj.io            2026-11-17T02:10:11Z
clusteranalysistemplates.argoproj.io     2026-11-17T02:10:11Z
rollouts.argoproj.io                     2026-11-17T02:10:12Z
NAME                TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
prometheus-server   ClusterIP   10.96.88.120   <none>        80/TCP    50s
Already installed kube-prometheus-stack? You can reuse it directly (chart 93.3.1). The difference is that by default it uses ServiceMonitor / PodMonitor to select scrape targets rather than Pod annotations: you need to create a PodMonitor for podinfo (selecting app: podinfo, port http-metrics), and change the Prometheus address to http://kube-prometheus-stack-prometheus.monitoring:9090 (use your own release name). See the Prometheus & Grafana lesson.

Step 4: Install the kubectl argo rollouts plugin

curl -LO https://github.com/argoproj/argo-rollouts/releases/download/v1.10.2/kubectl-argo-rollouts-linux-amd64
chmod +x kubectl-argo-rollouts-linux-amd64
sudo mv kubectl-argo-rollouts-linux-amd64 /usr/local/bin/kubectl-argo-rollouts
kubectl argo rollouts version
kubectl-argo-rollouts: v1.10.2+…
  BuildDate: 2026-11-04T…
  GoVersion: go1.…
  Platform: linux/amd64

On macOS, use brew install argoproj/tap/kubectl-argo-rollouts. The plugin is just a client; ideally its version matches the controller.

Warm-up: answer from memory (30 seconds)

Whose changes does Argo CD's selfHeal revert?

Any change to a managed resource's spec that does not come from Git (kubectl edit, scale, set image…). This shapes many of this lesson's designs: the Rollouts promote / abort writes status or fields the controller manages itself, which selfHeal does not wipe out; whereas kubectl argo rollouts set image changing the spec, which gets reverted.

Why is a Deployment's RollingUpdate not enough?

It only checks whether Pods are Ready; it cannot “send 5% of traffic first, check metrics, then decide”, nor automatically roll back when metrics get worse. This is the value of Rollouts.

Environment self-check list

Module 1 · From CI to GitOps: Who Changes Git

00:00 – 06:00 · CI produces “artifacts”, CD consumes the “desired state”; the only interface between them is a PR that changes Git
6 minTool-agnostic pattern★★★★★
Learning goals
  • Explain the push model (CI directly kubectl apply / helm upgrade) versus the pull model (an in-cluster agent pulls from Git), especially where the credentials live.
  • Design the flow “CI builds → pushes an immutable tag → opens a PR changing apps/podinfo/overlays/dev/kustomization.yaml → merge → Argo CD reconciles”, and explain why it is a PR rather than a direct push.
  • Distinguish the application code repository from the configuration (GitOps) repository, and know when they can be merged together.
Prerequisites: the four GitOps principles from Hour 1;GitHub or GitLab basic pipeline knowledge of Importance:★★★★★ (the foundation for all later automation)

What: what CI and CD each are responsible for

StageOwnerInputOutputRequired permissions
CI (continuous integration)GitHub Actions, GitLab CI, Jenkins…Application code commitTest report + immutable image ghcr.io/…/podinfo:6.17.0 (or digest) + a PR that changes the desired statePush to the image registry; open a branch / PR to the GitOps repository
CD (continuous delivery / deployment)In-cluster GitOps agent: Argo CD (or Flux)Desired state in GitActual cluster state matches Git (Sync / Health)Holds Kubernetes permissions only inside the cluster; read-only on Git

In GitOps, the act of “deploying” is redefined as changing Git. CI no longer “deploys”; it just proposes a change (PR); after a person or rule approves the merge, CD takes care of converging the cluster. This way every deployment naturally has an author, a review record, a revertable commit and an auditable diff.

Why: why not let CI run kubectl apply directly

  • credential boundary: the push model requires CI to hold cluster admin-level credentials (kubeconfig, cloud accounts). CI systems usually serve many repositories and contributors, making them high-value attack targets. In the pull model, cluster credentials never leave the cluster.
  • drift: the push model only takes effect at the moment the pipeline runs; afterwards, if someone kubectl edit changes it, nobody knows; the pull model continuously compares and can self-heal.
  • Rebuildability: if a cluster is deleted, the pull model only needs Argo CD reinstalled and pointed at the repository; the push model needs to “replay” all historical pipelines.
  • Network direction: the pull model only requires outbound access from the cluster to Git; private clusters do not need to expose the API Server to CI.

How: standard flow (tool-agnostic)

  1. Developers push to the application repository commit code; CI runs tests and scans.
  2. CI builds the image and pushes it an immutable tag (a semantic version or Git SHA, for example 6.17.0,sha-3f2a1c9); it is best to record the digest.
  3. CI, in the GitOps repository creates a branch and runs kustomize edit set image ghcr.io/stefanprodan/podinfo:6.17.0 (in the apps/podinfo/overlays/dev directory), commits and opens a PR.
  4. The dev environment can be configured for auto-merge (merge once checks pass); staging / prod are reviewed by people (Module 7).
  5. After merging, Argo CD discovers the new commit by polling (about 3 minutes by default) or via a Webhook, renders the overlay, detects OutOfSync and syncs automatically.
  6. The sync triggers the Rollout's canary (Modules 2, 3); results are reported via Notifications (Module 5).

When: how to split repositories

OptionSuited forNotes
Application repository + separate GitOps repository (this lesson)Multiple teams, multiple environments, need independent permissions and auditingCI needs write access to the GitOps repository (fine-grained PAT / GitHub App / Deploy Key)
Single repository (code and deploy/ the directory together)Small team, single serviceCommits where CI changes manifests trigger CI again; need path filters or [skip ci] to prevent loops
Image automation controller changes Git (Module 4)CI should not touch the GitOps repository at allwrite permission moves to an in-cluster controller; version selection rules must be strict

Compare with similar approaches

Push model (CI deploys)Pull model (GitOps: Argo CD / Flux)
Cluster credentialsIn CIOnly inside the cluster
Deployment recordPipeline logsGit commits + PR review
Drift detectionNoneContinuous comparison, can self-heal or alert (Module 6)
RollbackRe-run the old pipelinegit revert
Common misconceptions① “Using Argo CD means you are doing GitOps” — if CI still calls argocd app set --parameter image.tag=… to directly edit an Application, the desired state is no longer in Git; this is the push model in disguise. ② “Using latest tags to save effort” — changing tag content does not change Git, Argo CD sees no difference and cannot roll back; you must use immutable tags or digests. ③ “CI calls after the PR is merged argocd app sync to be faster” — this requires giving CI an Argo CD token; a better approach is to configure a Git Webhook (Hour 2).

Architecture diagram: the boundary between CI and CD is a PR

CI zone (no cluster credentials) Application repositorypodinfo source code CI pipelinetest · build · scan Image registrypodinfo:6.17.0 Open PR: kustomize edit set image GitOps repositoryoverlays/dev/kustomization.yamlReview → merge to main Cluster lab (credentials only here) Argo CDPull · render · compare · sync pull Rollout podinfoCanary + analysis Nodes pull images from the image registry Notifications → Webhook/Slack
Figure 1-1 CI only writes to the image registry and PRs to the GitOps repository; cluster credentials never leave the cluster

Sequence: what one upgrade leaves behind in Git

main@a1b26.16.0 Branch ci/podinfo-6.17.0 (CI bot) Merge commit c3d4: 6.17.0 PR #42: reviewers, check results git revert c3d4 → 6.16.0 A rollback is also a commit
Figure 1-2 Deployment = commit; rollback = reverse commit. Audit, review and rollback all reuse Git's capabilities

Interactive animation: the same upgrade, push vs pull model

Select a mode and click “Play”. Watch where the credentials are, whether Git records the change, and what happens when someone makes a manual kubectl edit change afterwards.

Core commands and parameters

CommandPurposeNotes
kustomize edit set image NAME=NEWNAME:TAGModify the kustomization.yaml's images:Run in the overlay directory; can also use NAME@sha256:… to pin a digest. kubectl The built-in kustomize has no edit subcommand; a standalone kustomize CLI is required
yq -i '.images[0].newTag = "6.17.0"' kustomization.yamlAlternative when there is no kustomize CLIThe same applies to Helm values scenarios: yq -i '.image.tag = …' values/myapp/dev.yaml
gh pr create --base main --head BRANCHOpen a PR on GitHub--title,--body,--label; gh pr merge --auto --squash Enable auto-merge
glab mr createOpen an MR on GitLabYou can also use git push -o merge_request.create push options
crane digest IMAGE:TAG / docker buildx imagetools inspectGet the image digestWrite the digest into Git to prevent “same tag, different content”
argocd app diff podinfo-dev --revision BRANCHPreview the cluster diff before mergingCan be added to PR checks and posted back to the PR as a comment
cd ~/gitops-lab/apps/podinfo/overlays/dev
kustomize edit set image ghcr.io/stefanprodan/podinfo:6.17.0
git diff
--- a/apps/podinfo/overlays/dev/kustomization.yaml
+++ b/apps/podinfo/overlays/dev/kustomization.yaml
@@
 images:
 - name: ghcr.io/stefanprodan/podinfo
-  newTag: 6.16.0
+  newTag: 6.17.0

GitHub Actions: open a PR after the build (snippet)

on:
  push:
    tags: ["v*"]
jobs:
  bump-gitops:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v5
      with:
        repository: <you>/gitops-lab
        token: ${{ secrets.GITOPS_PR_TOKEN }}   # only has contents/pull-requests write permission on gitops-lab
    - name: Bump dev image
      run: |
        TAG="${GITHUB_REF_NAME#v}"
        cd apps/podinfo/overlays/dev
        kustomize edit set image ghcr.io/stefanprodan/podinfo:${TAG}
        git switch -c ci/podinfo-${TAG}
        git commit -am "dev: podinfo ${TAG}" && git push -u origin HEAD
        gh pr create --fill --base main --label auto-merge
      env:
        GH_TOKEN: ${{ secrets.GITOPS_PR_TOKEN }}

Note:actions/checkout@v5 Same as the runner's built-in kustomize/gh Follow the official GitHub documentation; in production, it is recommended to use a GitHub App to generate short-lived tokens rather than a long-lived PAT. The GitLab equivalent is to use a Project Access Token to create an MR on the GitOps project; see GitLab lesson.

Lab 1: play the role of CI manually and submit an upgrade PR to dev (about 5 minutes)

This lab does not require actually writing CI — you run on your machine the commands that CI would run. For the real pipeline syntax, see the “Commands” page and the GitHub lesson.

Confirm “who holds which permissions”: Argo CD only needs read permission on the repository.
argocd repo list
kubectl -n argocd get secret -l argocd.argoproj.io/secret-type=repository -o name

A public repository may have no repository Secret at all — which shows Argo CD does not need write permission.

Create a branch and modify the desired state:
cd ~/gitops-lab && git switch main && git pull
git switch -c ci/podinfo-6.17.0
cd apps/podinfo/overlays/dev
kustomize edit set image ghcr.io/stefanprodan/podinfo:6.17.0 \
  || sed -i 's/newTag: 6.16.0/newTag: 6.17.0/' kustomization.yaml   # when there is no kustomize CLI
kubectl kustomize . | grep image:
git commit -am "dev: podinfo 6.17.0" && git push -u origin HEAD
        image: ghcr.io/stefanprodan/podinfo:6.17.0
[ci/podinfo-6.17.0 5e1f2a7] dev: podinfo 6.17.0
 1 file changed, 1 insertion(+), 1 deletion(-)
Preview the diff before merging (this step suits a PR check):
argocd app diff podinfo-dev --revision ci/podinfo-6.17.0
===== apps/Deployment podinfo-dev/podinfo ======
…
<         image: ghcr.io/stefanprodan/podinfo:6.16.0
---
>         image: ghcr.io/stefanprodan/podinfo:6.17.0

At this point the cluster is still 6.16.0: the branch is not the one the Application tracks main.

Open a PR and merge:
gh pr create --base main --title "dev: podinfo 6.17.0" --body "CI simulated bump"
gh pr merge --squash --delete-branch
argocd app get podinfo-dev --refresh | grep -E 'Sync Status|Health Status'
kubectl -n podinfo-dev get pod -o jsonpath='{range .items[*]}{.spec.containers[0].image}{"\n"}{end}'
Sync Status:        Synced to main (9a8b7c6)
Health Status:      Healthy
ghcr.io/stefanprodan/podinfo:6.17.0
ghcr.io/stefanprodan/podinfo:6.17.0
Rollback = reverse commit (restores the starting point for Module 2):
cd ~/gitops-lab && git switch main && git pull
git revert --no-edit HEAD && git push
argocd app wait podinfo-dev --sync --health --timeout 180

In production, rollbacks should also go through a PR; for emergencies, see the break-glass process in Module 6.

Case 1: CI leaks a kubeconfig

Problem: A team's Jenkins stored a production cluster-admin kubeconfig, and a poisoned build plugin exfiltrated it. Fix: Migrate to the pull model: CI keeps only image registry push permission and PR permission on the GitOps repository (GitHub App, limited to a single repo); the cluster API Server switches to a private endpoint. Result: The worst outcome of a compromised CI becomes “submitting a PR that needs review”. Limitation: The GitOps repository itself becomes a high-value target; it needs branch protection, CODEOWNERS and signed commits.

Case 2: single-repo CI infinite loop

Problem: Code and deploy/ in the same repository; CI changes the tag and pushes, which triggers CI again, producing dozens of commits in a loop. Fix: Add paths-ignore: ["deploy/**"] to the workflow so bot commits skip CI; eventually the deployment manifests are split into a separate GitOps repository.

Case 3: latest tag causes “rollback has no effect”

Problem: Production uses :latest, and after the problem git revert had no effect — the content in Git never changed. Fix: All environments switched to semantic version tags + pinned digests (newTag: 6.17.0@sha256:… or digest: field), and the image registry enables immutable tags.

Common errors and fixes

PR has been merged, but Argo CD still shows the old version, Synced to an old commit

Cause: Argo CD by default polls the repository about every 3 minutes (timeout.reconciliation, Hour 2), and no Webhook is configured.

argocd app get podinfo-dev --refresh
argocd app get podinfo-dev -o json | jq -r '.status.sync.revision'

Fix: Short term: use --refresh; long term, configure a Webhook on the GitOps repository pointing to /api/webhook.

remote: Permission to <you>/gitops-lab.git denied to github-actions[bot]. (403)

Cause: The workflow's default GITHUB_TOKEN only works for the current repository, and cannot write to another repository.

Fix: Use a fine-grained PAT or GitHub App token with contents: write and pull-requests: write for gitops-lab, stored as a Secret GITOPS_PR_TOKEN.

Error: unknown command "edit" for "kubectl kustomize"

Cause: The built-in kustomize in kubectl only supports build.

Fix: Install a standalone kustomize CLI, or use yq/sed to modify.

Argo CD sync succeeds, but the Pod stays in ImagePullBackOff: manifest unknown

Cause: CI opened the PR while the image push was still in progress, or the tag was misspelled.

kubectl -n podinfo-dev describe pod -l app=podinfo | grep -A3 Failed

Fix: Put “open PR” after the push step, and verify in a PR check that the image exists (crane digest).

Command-line tasks
1. In the dev overlay, pin podinfo to a digest (do not use a tag).
cd apps/podinfo/overlays/dev
kustomize edit set image ghcr.io/stefanprodan/podinfo@sha256:<digest>
2. Without merging the branch, preview the differences podinfo-dev would produce on branch ci/x .
argocd app diff podinfo-dev --revision ci/x
Scenario analysis
The security team requires that “if the CI system is compromised, it cannot directly change production”. The current flow is that CI runs argocd app sync podinfo-prod. How would you redesign it?

Remove the Argo CD token from CI; CI only opens PRs. The prod overlay is protected by branch protection (CODEOWNERS + required review + required checks). Sync is done automatically by Argo CD (or manual sync + sync window, Module 6). To speed up the effect, configure a Git Webhook. This way, even if CI is compromised, the worst case is a single PR awaiting review.

Verified teaching video

▶
What is GitOps, How GitOps works and Why it's so useful — TechWorld with Nana
English · Explains the push and pull models and the flow of CI changing the config repo; fully matches this module

Official documentation

Video storyboard (about 90 seconds)

This courseware cannot directly generate video/MP3; a storyboard and narration script are provided, which can be passed to a video tool.

Shot 1 · 0–20s
Visual: in the CI box there is a red key (kubeconfig), with an arrow pointing directly at the cluster.
Narration: in the push model, the pipeline holds the cluster's key. The more places that hold keys, the greater the risk.
Shot 2 · 20–50s
Visual: the key moves into Argo CD inside the cluster; CI only produces a PR, which shows newTag 6.16.0 → 6.17.0.
Narration: the pull model turns deployment into a commit. CI only proposes, review approves, and Argo CD executes in the cluster.
Shot 3 · 50–90s
Visual: a merge commit and a revert commit appear on the timeline, and the cluster state beside it changes accordingly.
Narration: deployment is a commit, rollback is a reverse commit. Audit, review and rollback all reuse Git.
Or score ≥ 70% on the quiz

Module 2 · Argo Rollouts: Canary and Blue-Green

06:00 – 13:00 · A Rollout is a “stand-in” for a Deployment: the Pod template is unchanged, with an orchestrable release strategy added
7 minArgo Rollouts v1.10.2v1.11.0-rc1 pre-release★★★★★
Learning goals
  • Rewrite podinfo's Deployment as a argoproj.io/v1alpha1 Rollout, and understand how the controller manages one ReplicaSet per template version (stable / canary).
  • Write a canary steps (setWeight,pause), and calculate how a weight converts into replica counts when there is no traffic routing; and use blueGreen's activeService / previewService.
  • Know how Argo CD displays Rollout health (paused → Suspended, aborted → Degraded), and resume / abort / promote-full etc. resource actions; understand which operations will be reverted by selfHeal.
Prerequisites: K8s lesson on Deployment, ReplicaSet, Service selectors; Module 1. Importance:★★★★★

What: the Rollout CRD

Argo Rollouts is a Kubernetes controller plus a set of CRDs (Rollout,AnalysisTemplate,ClusterAnalysisTemplate,AnalysisRun,Experiment). Rollout The spec.template,selector,replicas and Deployment are identical; the difference is in spec.strategy:

  • canary: gradually shift traffic to the new ReplicaSet, following steps steps, and can insert pause (timed or indefinite),analysis,setCanaryScale,experiment and other steps.
  • blueGreen: the new version starts fully but receives no traffic; previewService points to the new version for verification, and after promote, activeService switches at once, and the old version is scaled down after scaleDownDelaySeconds (default 30 seconds).

The controller adds rollouts-pod-template-hash label to tell versions apart — this is also what the PromQL in Module 3 relies on to tell the canary apart.

Why: what a Deployment lacks

NeedDeployment RollingUpdateRollout
Proportional rollout with a pause to observeNot supported (can only pause the entire Deployment)setWeight + pause
Automatic decision based on metricsOnly looks at readinessAnalysisRun (Module 3)
Immediately return to the old version if there is a problemrollout undo, requires a re-rollabort: traffic instantly returns to the stable version that is still running
Precise traffic ratios / routing by headerNot supportedtrafficRouting (Istio, NGINX, Gateway API plugins, etc.)

How: without traffic routing, the “weight” is the replica ratio

This lab does not install a mesh; the Service podinfo selects both stable and canary Pods at the same time. The official docs state that in this case the controller will “do its best” to approximate using the replica ratio setWeight: 10 replicas, weight setWeight: 10 → 1 canary, 9 stable; setWeight: 41 → pick the integer with the smallest difference: canary 4, stable 6. With few replicas the precision is very poor: 4 replicas can only express 0 / 25 / 50 / 75 / 100%.

Configure trafficRouting with a trafficRouting, the behavior differs: the controller modifies the mesh / Ingress resource to set exact weights,the stable ReplicaSet keeps full replicas (so it can switch back instantly on abort); canary replicas = weight × total replicas; you also need canaryService and stableService two Services. The core controller no longer accepts new traffic providers; new implementations are provided as plugins (Gateway API is a plugin).

When: canary or blueGreen

  • canary: stateless Web/API services, where you want to verify with a small part of real traffic.
  • blueGreen: use it when a full smoke test is needed before switching traffic, or when the app cannot receive traffic from old and new versions at the same time (e.g. an incompatible session protocol). The cost is that resources briefly double.
  • Neither fits: irreversible migrations with strong database schema dependencies — forward-compatible migrations must be done first.

Working with Argo CD

  • Argo CD has built-in health checks for Rollouts: paused (status.phase: Paused) shows as Suspended, in progress is Progressing, and after an abort is Degraded.
  • Built-in resource actions: resume,abort,retry,pause,promote-full,skip-current-step,restart, can be run in the UI or in argocd app actions run .
  • selfHeal only compares fields that appear in Git. promote / abort change the status or controller-managed state and are not reverted; but kubectl argo rollouts set image changing the spec gets reverted by Argo CD back to the value in Git —in GitOps, a version change can only be made in Git.

Comparison of similar tools: Argo Rollouts vs Flagger

Argo Rollouts (v1.10.2)Flagger (v1.45.0, Flux project)
How it worksUses Rollout CRD to replace Deployment (or use workloadRef to reference an existing Deployment)Keeps your Deployment; uses Canary CRD to wrap it, and automatically generates -primary / -canary replicas and Services
Step orchestrationExplicit steps (setWeight, pause, analysis…)Auto-advances according to stepWeight / maxWeight / interval its configured schedule
Metric analysisAnalysisTemplate (Prometheus, Datadog, Web, Job, etc.)Built-in request-success-rate / duration and MetricTemplate
Traffic routingOptional; without routing, by replica ratioRequires a mesh or Ingress (Istio, Linkerd, NGINX, Gateway API, etc.)
EcosystemArgo CD native health checks and UI extensionsWorks most closely with Flux, but can also be used standalone
Common misconceptions① “setWeight: 10 is 10% of traffic” — without traffic routing and with few replicas, the actual ratio is determined by the replica count and is also affected by connection reuse. ② “Once a Rollout is aborted, the rollback is complete” — abort only switches traffic back to stable; Git still has the new version and the Application is Degraded, so you must roll back in Git (Module 3). ③ “Changing a Deployment into a Rollout needs no downtime” — direct replacement deletes the Deployment first and then creates the Rollout; for production migration, use workloadRef + scaleDown: progressively.

Architecture diagram: objects managed by the Rollout controller

Rollout podinfostrategy.canary.stepsstatus.currentStepIndex ReplicaSet (stable)hash 6f8c9d · 6.16.0 · 3 replicas ReplicaSet (canary)hash 7b54f1 · 6.17.0 · 1 replica Service podinfoselector: app=podinfoSelects two sets of Pods (≈ 75 / 25) AnalysisRunModule 3Successful / Failed result decides continue / abort
Figure 2-1 one ReplicaSet per template version; without traffic routing, the Service naturally splits traffic by Pod count

Flowchart: the two Services in blue-green

podinfo-active (users) podinfo-preview (testing) Blue: 6.16.0hash 6f8c9d Green: 6.17.0hash 7b54f1 On promote,the controller changes active's selector to hash 7b54f1 (switches at once)the blue version is scaled down after scaleDownDelaySeconds (default 30s)
Figure 2-2 the controller switches traffic by rewriting the Service's rollouts-pod-template-hash selector

Interactive simulator: canary steps and replica conversion / blue-green switch

Choose the replica count and whether to enable traffic routing, then execute the steps one by one. Below each step, the controller's actions and the kubectl argo rollouts get approximate output.

Core commands and parameters (kubectl argo rollouts plugin)

CommandPurposeIs it safe under GitOps
get rollout NAME --watchTree view of revision, ReplicaSets, Pods, AnalysisRuns, current stepRead-only
status NAMEOutputs Healthy / Paused / Degraded; usable in scriptsRead-only
promote NAME / --fullSkip the current pause / skip all remaining stepsSafe (does not change Git fields)
abort NAMEAbort; traffic returns to stableSafe; but Git still has the new version, so Git needs to be rolled back
retry rollout NAMERetry after abortSafe
set image / undoModify spec.templateWill be reverted by selfHeal, do not use in GitOps
dashboardLocal UI (default port 3100)Mainly read-only viewing
argocd app actions run APP resume --kind RolloutExecute actions via Argo CD RBACRecommended: permissions and audit live in Argo CD
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: podinfo
spec:
  replicas: 4
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: podinfo
  template:
    metadata:
      labels:
        app: podinfo
      annotations:
        prometheus.io/scrape: "true"     # Module 3: the slim Prometheus scrapes via annotations
        prometheus.io/port: "9797"
    spec:
      containers:
      - name: podinfod
        image: ghcr.io/stefanprodan/podinfo:6.16.0
        command: ["./podinfo", "--port=9898", "--port-metrics=9797", "--level=info"]
        ports:
        - { name: http, containerPort: 9898 }
        - { name: http-metrics, containerPort: 9797 }
        readinessProbe:                  # probes the metrics port; Module 3's random errors do not affect it
          httpGet: { path: /healthz, port: 9797 }
          periodSeconds: 5
        livenessProbe:
          httpGet: { path: /healthz, port: 9797 }
        resources:
          requests: { cpu: 10m, memory: 32Mi }
          limits: { memory: 64Mi }
  strategy:
    canary:
      steps:
      - setWeight: 25
      - pause: {duration: 30s}
      - setWeight: 50
      - pause: {}                        # indefinite pause: wait for manual promote
      - setWeight: 75
      - pause: {duration: 30s}

How to verify:kubectl kustomize apps/podinfo/overlays/dev | grep -A2 "kind: Rollout". Note: overlay's images: transformations also apply to Rollout (verified locally with kustomize v5); but commonLabels and strategic merge patches do not understand Rollout's structure; follow the official docs for rollout-transform configuration or openapi field.

Blue-green snippet

  strategy:
    blueGreen:
      activeService: podinfo            # user traffic
      previewService: podinfo-preview   # a Service you need to create separately (selector is also app: podinfo)
      autoPromotionEnabled: false       # switch only after a manual promote
      scaleDownDelaySeconds: 30

Lab 2: convert podinfo to a Rollout and manually advance one canary (about 7 minutes)

In base, replace the Deployment with a Rollout: copy the rollout.yaml from the “Commands” page; save to apps/podinfo/base/, then:
cd ~/gitops-lab/apps/podinfo/base
git rm -q deployment.yaml
sed -i 's/- deployment.yaml.*/- rollout.yaml/' kustomization.yaml
cat kustomization.yaml
kubectl kustomize ../overlays/dev | grep -E '^kind:|image:'
resources:
- rollout.yaml
- service.yaml
kind: Service
kind: Rollout
        image: ghcr.io/stefanprodan/podinfo:6.16.0

If your base comes from earlier lessons and differs, use this lesson's rollout.yaml as the reference, and confirm that the Service's selector is app: podinfo, port name http. The container name, consistent with Hour 1, is podinfod. podinfo also provides /metrics on the main port 9898, but this lesson additionally enables a separate metrics port 9797 (--port-metrics) and lets Prometheus scrape it: Module 3 turns on podinfo's random-error middleware, which applies to all routes on the main port (including /metrics and /healthz), while the metrics server on 9797 is unaffected.

Push and observe Argo CD's replacement (staging / prod will also change to Rollout, with 6.16.0 unchanged):
cd ~/gitops-lab && git add -A && git commit -m "podinfo: Deployment -> Rollout (canary)" && git push
argocd app sync podinfo-dev
kubectl argo rollouts get rollout podinfo -n podinfo-dev
Name:            podinfo
Namespace:       podinfo-dev
Status:          ✔ Healthy
Strategy:        Canary
  Step:          6/6
  SetWeight:     100
  ActualWeight:  100
Images:          ghcr.io/stefanprodan/podinfo:6.16.0 (stable)
Replicas:
  Desired:       4
  Current:       4
  Updated:       4
  Ready:         4
  Available:     4

NAME                                 KIND        STATUS     AGE  INFO
⟳ podinfo                            Rollout     ✔ Healthy  40s
└──# revision:1
   └──⧉ podinfo-6f8c9d5b7c           ReplicaSet  ✔ Healthy  40s  stable
      ├──□ podinfo-6f8c9d5b7c-2xk8q  Pod         ✔ Running  40s  ready:1/1
      …

When the Rollout is created for the first time there is no “old version”; the controller creates everything at once without going through steps. With auto-sync prune enabled, the old Deployment will be deleted — at this moment podinfo has a brief Pod recreation; for production migration, use workloadRef.

Release 6.17.0 via Git (like the CI PR in Module 1; here, to save time, push directly to main):
cd ~/gitops-lab/apps/podinfo/overlays/dev
kustomize edit set image ghcr.io/stefanprodan/podinfo:6.17.0
git commit -am "dev: podinfo 6.17.0" && git push
argocd app get podinfo-dev --refresh >/dev/null
kubectl argo rollouts get rollout podinfo -n podinfo-dev --watch
Status:          ॥ Paused
Message:         CanaryPauseStep
Strategy:        Canary
  Step:          3/6
  SetWeight:     50
  ActualWeight:  50
Images:          ghcr.io/stefanprodan/podinfo:6.16.0 (stable)
                 ghcr.io/stefanprodan/podinfo:6.17.0 (canary)
View and promote in Argo CD:
argocd app get podinfo-dev | grep -E 'Health Status|Rollout'
argocd app actions list podinfo-dev --kind Rollout
argocd app actions run podinfo-dev resume --kind Rollout --resource-name podinfo
kubectl argo rollouts status podinfo -n podinfo-dev --timeout 3m
Health Status:      Suspended
argoproj.io  Rollout  podinfo-dev  podinfo  Suspended
ACTION             DISABLED
abort              false
pause              false
promote-full       false
restart            false
resume             false
retry              true
skip-current-step  false
Healthy

You can also use kubectl argo rollouts promote podinfo -n podinfo-dev, both have the same effect; they differ in who controls permissions (Argo CD RBAC can grant it separately for action/argoproj.io/Rollout/resume).

Experience the relationship between selfHeal and Rollout:
kubectl argo rollouts set image podinfo podinfod=ghcr.io/stefanprodan/podinfo:6.15.0 -n podinfo-dev
sleep 20; kubectl -n podinfo-dev get rollout podinfo -o jsonpath='{.spec.template.spec.containers[0].image}{"\n"}'
ghcr.io/stefanprodan/podinfo:6.17.0

Argo CD self-heal changed the image back to 6.17.0 in Git. Conclusion: the version can only be changed through Git.

Restore the starting point for Module 3: set dev back to 6.16.0 (this also runs a canary; you can use promote --full to speed it up):
cd ~/gitops-lab/apps/podinfo/overlays/dev
kustomize edit set image ghcr.io/stefanprodan/podinfo:6.16.0
git commit -am "dev: back to 6.16.0" && git push && argocd app get podinfo-dev --refresh >/dev/null
sleep 15; kubectl argo rollouts promote podinfo -n podinfo-dev --full

Case 1: migrate from Deployment to Rollout with no interruption

Problem: The production service has 30 replicas and cannot accept “delete the Deployment, then create a Rollout”. Fix: Following the official migration docs, first create a Rollout that references the existing Deployment (workloadRef: {apiVersion: apps/v1, kind: Deployment, name: podinfo, scaleDown: progressively}), once the Rollout's Pods are ready, gradually scale down the Deployment; after it is stable, move the template into the Rollout. Note: The Deployment stays in Git,replicas field must be removed from Git, or ignoreDifferences added; otherwise Argo CD will tug-of-war with the Rollouts controller.

Case 2: a “10% canary” with four replicas is actually 25%

Problem: The team configured setWeight: 10, but found that about 25% of requests went to the new version. Cause: Without traffic routing, with 4 replicas the minimum granularity is 1/4, so the controller rounds up to 1 canary Pod. Fix: Introduce trafficRouting for NGINX Ingress (or the Gateway API plugin) to split traffic precisely by weight, and at the same time use setCanaryScale to control the canary replica count.

Case 3: after a blue-green switch the old version disappears immediately, so a quick rollback is not possible

Problem:scaleDownDelaySeconds Set to 0; when a problem is found after switching, the blue version has already been scaled down. Fix: Keep the default 30 seconds or longer (for example 10 minutes), and pair it with postPromotionAnalysis: if analysis fails, traffic automatically switches back to the still-running old version.

Common errors and fixes

error: unable to recognize "…": no matches for kind "Rollout" in version "argoproj.io/v1alpha1"

Cause: The CRD is not installed yet, or the Application sync order is wrong.

kubectl get crd rollouts.argoproj.io
argocd app get argo-rollouts

Fix: First make argo-rollouts Healthy; when using App of Apps, give it an earlier argocd.argoproj.io/sync-wave (Hour 2, 3), or add SkipDryRunOnMissingResource=true to the podinfo application.

Rollout stays Paused, Argo CD shows Suspended, with no error at all

Cause: It hit a pause: {} (indefinite pause). This is by design.

kubectl argo rollouts get rollout podinfo -n podinfo-dev | grep -E 'Step|Message'

Fix:promote or an Argo CD action resume. If you do not want the Application to show Suspended for a long time, change the pause to have a duration.

Argo CD and Rollouts keep modifying replicas back and forth; the Application flaps between Synced / OutOfSync

Cause: During an HPA or workloadRef migration,spec.replicas there are two writers.

Fix: Remove replicas from Git, or in the Application, for the Rollout / Deployment's /spec/replicas set ignoreDifferences and pair with RespectIgnoreDifferences=true.

The Rollout "podinfo" is invalid: spec.selector: Invalid value … `selector` does not match template `labels`

Cause: The overlay uses commonLabels to add labels to the template, but kustomize does not know the path of the Rollout's selector.

Fix: use labels: (without includeSelectors), or in kustomization introduce the official rollout-transform configuration.

Command-line tasks
1. Abort the Rollout in podinfo-dev via Argo CD (rather than the kubectl plugin).
argocd app actions run podinfo-dev abort --kind Rollout --resource-name podinfo
2. List the rollouts-pod-template-hash and replica count of each ReplicaSet in namespace podinfo-dev.
kubectl -n podinfo-dev get rs -L rollouts-pod-template-hash -o wide
Scenario analysis
The team wants “the new version first accessed internally using a Header X-Canary: 1 for 1 hour, then released to 5% externally”. Can this be achieved with only this lesson's Service selector? What is needed?

No. Routing by Header and an exact 5% both require trafficRouting: for example Istio (managedRoutes + setHeaderRoute step) or a Gateway API plugin / NGINX Ingress. Configure in the Rollout canaryService and stableService, with steps as setHeaderRoute → pause: {duration: 1h} → setWeight: 5. Without routing you can only approximate with the replica ratio, and Header is not supported.

Verified teaching video

▶
Argo Rollouts in 15 minutes! — DevOps Journey
English · quick demo of canary steps and the kubectl plugin
▶
Tutorial: Progressive Delivery with Argo Rollouts — CNCF [Cloud Native Computing Foundation]
English · KubeCon tutorial covering blue-green, canary and analysis
▶
A blue-green deployment with Argo Rollouts and Kustomize — Geert Baeke
English · blue-green + Kustomize, close to this lesson's repo structure

Official documentation

Video storyboard (about 90 seconds)

Shot 1 · 0–25s
Visual: the Deployment icon “morphs” into a Rollout; the Pod template part stays still, and a row of steps grows below.
Narration: a Rollout's Pod template is the same as a Deployment's; the difference is the release strategy: you can release step by step, or stop and wait.
Shot 2 · 25–60s
Visual: 4 Pod cells, 1 turns yellow (canary), and a ratio bar shows 25%.
Narration: without traffic routing, the weight is the replica ratio. Four replicas can only express quarter-level granularity.
Shot 3 · 60–90s
Visual: two sets of Pods for blue-green; the active Service's arrow jumps from blue to green.
Narration: blue-green uses two Services: preview verifies first; on promote, active switches in one go, and the old version scales down after a thirty-second delay.
Or score ≥ 70% on the quiz

Module 3 · AnalysisTemplate: Metric-Based Automatic Rollback

13:00 – 21:00 · Let Prometheus, rather than the on-call engineer, decide “continue releasing or abort immediately”
8 minPrometheus providerCore animation of this lesson★★★★★
Learning goals
  • Distinguish AnalysisTemplate (template),ClusterAnalysisTemplate (cluster-level template) and AnalysisRun (single execution), and read interval,count,initialDelay,successCondition,failureLimit,consecutiveErrorLimit.
  • Use podinfo's http_requests_total{status} to write a success-rate PromQL that only targets canary Pods (using the rollouts_pod_template_hash label and podTemplateHashValue: Latest parameters).
  • Explain the four outcomes of an AnalysisRun (Successful / Failed / Error / Inconclusive) and whether each makes the Rollout continue, abort or pause; and know why you still need to roll back in Git after an abort.
Prerequisites: Module 2; PromQL's rate() and sum() (Prometheus lesson). Importance:★★★★★

What: three objects

ObjectScopeAnalogyNotes
AnalysisTemplateNamespaceJob templateDefines “what to measure, how often to measure, and how to decide it passes”; can be parameterized (args)
ClusterAnalysisTemplateClusterShared templateMaintained uniformly by the platform team; a Rollout uses clusterScope: true to reference it
AnalysisRunNamespaceJobCreated by the Rollout at the right time; records each measurement's value and result, and finally Successful / Failed / Error / Inconclusive

Why: automate “glancing at the monitor”

The bottleneck of manual canary is attention: releases at night, multiple services in parallel, and looking only at averages while ignoring the small canary Pod portion. AnalysisRun uses fixed queries, fixed thresholds and a fixed rhythm to judge; once it fails it aborts immediately — traffic returns to the still-running stable version within seconds.

How: the lifecycle of one background analysis

  1. Template change in Git → Rollout creates the canary ReplicaSet and executes setWeight: 25.
  2. When it reaches startingStep , the controller creates an AnalysisRun based on strategy.canary.analysis , and resolves args into the actual value (for example podTemplateHashValue: Latest → 7b54f1c9d8).
  3. After waiting initialDelay , every interval a Prometheus query is executed; the result is a vector, so use result[0] to take the value.
  4. Meeting successCondition → this measurement is Successful; meeting failureCondition or not meeting successCondition → Failed; query error → Error.
  5. The failure count exceeds failureLimit (default 0, meaning no failures are tolerated) → AnalysisRun Failed → Rollout abort: canary weight drops to zero; Rollout status is Degraded, and in Argo CD the Application Health becomes Degraded.
  6. Consecutive errors exceed consecutiveErrorLimit (default 4) → AnalysisRun Error, which also causes an abort.
  7. All steps executed without analysis failing → the controller terminates the background analysis and records it as Successful; the canary becomes the new stable.
AnalysisRun outcomeRollout's reactionCommon causes
SuccessfulContinue / completeMetrics meet target
Failedabort, traffic returns to stableFailure count > failureLimit
ErrorabortPrometheus unreachable, or an empty query result causing result[0] errors that consecutively exceed consecutiveErrorLimit
InconclusivePause, waiting for a manual promote or abortthe value meets neither the success nor the failure condition, or consecutiveSuccessLimit is enabled (v1.8+) but has not reached

When: background analysis, in-step analysis, pre/post blue-green analysis

  • Background analysis (strategy.canary.analysis): runs across the whole canary and keeps guarding — adopted in this lesson.
  • In-step analysis (steps: - analysis:): starts only when that step is reached and blocks, suitable for “must finish one round of a load-test Job before going to 50%”. Without interval it measures only once.
  • Blue-green: prePromotionAnalysis (measured on preview before switching) and postPromotionAnalysis (measured after switching; automatically switches back on failure).
  • Other providers: Web (HTTP JSON), Job (any script / smoke test), Datadog, New Relic, CloudWatch, Graphite, InfluxDB, Kayenta, etc., plus plugins.
Why only look at canary Pods If you query the whole service's success rate, 25% of bad traffic gets “diluted” by 75% good traffic: a canary error rate of 11% gives only about 2.8% overall, which may well be far above the threshold and still pass. You must use rollouts_pod_template_hash="{{args.canary-hash}}" to select only the new version's Pods; the more rigorous approach is to also compare against stable (podTemplateHashValue: Stable).
Common misconceptions① “abort means rollback is complete” — after abort Git still has the bad version; Argo CD shows Synced + Degraded; any next template change will try again. The correct wrap-up is git revert, and the Rollout finds the new template matches stable and switches back directly without running steps. ② “The success rate is 100% when there is no traffic” — when there are no requests, 0/0 is NaN or an empty vector, so the measurement becomes Error or Failed; you must ensure traffic exists (load generator / synthetic probe) or handle NaN in the condition (e.g. isNaN(result[0]) || result[0] >= 0.95, use with caution). ③ “failureLimit: 1 means aborting on the first failure” — it means one failure is allowed; the second failure triggers the abort.

Architecture diagram: AnalysisRun data path

canary Podhash=7b54f1 · :9797/metricshttp_requests_total{status} stable Pod ×3hash=6f8c9d Prometheuskubernetes-pods job (15s)labelmap → rollouts_pod_template_hash scrape AnalysisRunPromQL every 30sresult[0] >= 0.95 ? query RolloutContinue to next step abortcanary → 0Degraded Successful Failed/Error Afterwards: Argo CD shows Synced + Degraded → Notifications alert (Module 5) → revert in Git (the real rollback)
Figure 3-1 metrics go from canary Pods to Prometheus, then AnalysisRun queries and judges

State machine: how one measurement is counted

Execute query Meets successCondition → successful++ Does not meet / failureCondition → failed++ Query error → consecutiveError++ failed > failureLimit → Failed Consecutive errors > 4 (default) → Error Rollout abort
Figure 3-2 failureLimit is the “number of allowed failures”; only when exceeded is it judged Failed

Core animation: canary + AnalysisRun verdict to promote or abort

Set the new version's real 5xx ratio, threshold and failureLimit, then play. Each tick represents 30 seconds: the controller advances the steps, while the AnalysisRun, after initialDelay queries Prometheus every 30 seconds. Watch when the failure count exceeds failureLimit, how traffic instantly returns to stable, and why you still need git revert.

Rollout steps
AnalysisRun success-rate

Core commands and fields

Command / fieldPurposeNotes
kubectl -n NS get analysisrunList AnalysisRuns and resultsName looks like podinfo-7b54f1c9d8-3-1
kubectl -n NS get analysisrun NAME -o yamlView each measurement's value / phasestatus.metricResults[].measurements
kubectl argo rollouts get rollout NAMEThe tree shows AnalysisRuns and ✔/✖ countsThe Message field shows the abort reason
kubectl argo rollouts retry rollout NAMERestart the current version after an abortUse after fixing an environment problem (e.g. Prometheus is down)
interval / count / initialDelayMeasurement cadenceBackground analysis usually sets no count (runs until the release ends)
successCondition / failureConditionexpr expressionresult[0] >= 0.95; use a range query with all(result, # < 1000)
failureLimit / consecutiveErrorLimit / consecutiveSuccessLimitToleranceDefaults 0 / 4 / 0 (disabled)
dryRunRecord only, does not affect the resultObserve a new metric before it goes live
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
  name: success-rate
spec:
  args:
  - name: canary-hash
  - name: namespace
  metrics:
  - name: success-rate
    initialDelay: 30s          # wait for the canary Pod to be scraped a few times
    interval: 30s
    failureLimit: 1            # allow 1 failure; abort on the 2nd
    successCondition: result[0] >= 0.95
    provider:
      prometheus:
        address: http://prometheus-server.monitoring.svc.cluster.local
        timeout: 20
        query: |
          sum(rate(http_requests_total{namespace="{{args.namespace}}",app="podinfo",
              rollouts_pod_template_hash="{{args.canary-hash}}",status!~"5.."}[1m]))
          /
          sum(rate(http_requests_total{namespace="{{args.namespace}}",app="podinfo",
              rollouts_pod_template_hash="{{args.canary-hash}}"}[1m]))
  strategy:
    canary:
      analysis:                          # background analysis
        templates:
        - templateName: success-rate
        startingStep: 1                  # start from step 2 (the first pause)
        args:
        - name: canary-hash
          valueFrom:
            podTemplateHashValue: Latest
        - name: namespace
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
      steps:
      - setWeight: 25
      - pause: {duration: 2m}
      - setWeight: 50
      - pause: {duration: 2m}
      - setWeight: 75
      - pause: {duration: 1m}

How to verify PromQL: First run it in the Prometheus UI (kubectl -n monitoring port-forward svc/prometheus-server 9090:80, open http://localhost:9090), replace {{args.…}} with the actual value. Note: podinfo's http_requests_total has only status one business label, recorded by the HTTP middleware at the outermost layer, so it can see injected errors; the metrics port 9797 is a separate server and is not counted.

Lab 3: release a “bad version” and watch AnalysisRun abort it automatically (about 8 minutes)

Add AnalysisTemplate and update the strategy: write the two YAML segments from the “Commands” page into base (save AnalysisTemplate as a new file; replace the original strategy in rollout.yaml with the new strategy), then:
cd ~/gitops-lab/apps/podinfo/base
grep -q analysis-success-rate.yaml kustomization.yaml || sed -i '/- service.yaml/a - analysis-success-rate.yaml' kustomization.yaml
kubectl kustomize ../overlays/dev | grep -E '^kind:'
cd ~/gitops-lab && git add -A && git commit -m "podinfo: background analysis on canary success rate" && git push
argocd app get podinfo-dev --refresh >/dev/null; argocd app wait podinfo-dev --health --timeout 300

Changing only strategy will not trigger the canary (the Pod template is unchanged).

Start the load generator (a temporary Pod not in Git; Argo CD does not delete unmanaged resources). The AnalysisTemplate lives in base, and canaries in staging / prod are analyzed too — with no traffic the query is empty, the measurement becomes Error and causes an abort, so put one in all three environments:
for e in dev staging prod; do
  kubectl -n podinfo-$e run loadgen --image=curlimages/curl:8.23.0 --restart=Never -- \
    sh -c 'while true; do curl -s -o /dev/null http://podinfo:9898/; sleep 0.05; done'
done
kubectl -n monitoring port-forward svc/prometheus-server 9090:80 &
sleep 60
curl -s 'http://localhost:9090/api/v1/query' --data-urlencode \
  'query=sum by (rollouts_pod_template_hash,status) (rate(http_requests_total{namespace="podinfo-dev"}[1m]))' | jq -r '.data.result[] | "\(.metric.rollouts_pod_template_hash) \(.metric.status) \(.value[1])"'
6f8c9d5b7c 200 18.9
Release the bad version: 6.17.0 + environment variable PODINFO_RANDOM_ERROR=true (podinfo's built-in random-error middleware: about 1/3 of requests return 500/400/409, of which 5xx is about 1/9 ≈ 11%). Use a JSON patch, because it works equally well for CRDs such as Rollout:
cd ~/gitops-lab/apps/podinfo/overlays/dev
kustomize edit set image ghcr.io/stefanprodan/podinfo:6.17.0
cat >> kustomization.yaml <<'EOF'
patches:
- target: { kind: Rollout, name: podinfo }
  patch: |-
    - op: add
      path: /spec/template/spec/containers/0/env
      value: [{ name: PODINFO_RANDOM_ERROR, value: "true" }]
EOF
kubectl kustomize . | grep -A2 'env:'
git commit -am "dev: podinfo 6.17.0 (bad build simulation)" && git push
argocd app get podinfo-dev --refresh >/dev/null
kubectl argo rollouts get rollout podinfo -n podinfo-dev --watch
Watch the AnalysisRun verdict (about 1.5–2 minutes later):
kubectl -n podinfo-dev get analysisrun
AR=$(kubectl -n podinfo-dev get analysisrun -o name | tail -1)
kubectl -n podinfo-dev get $AR -o jsonpath='{range .status.metricResults[0].measurements[*]}{.phase}{"  "}{.value}{"\n"}{end}'
NAME                         STATUS   AGE
podinfo-7b54f1c9d8-2-1       Failed   2m10s
Successful  [0.9312…]   ← random fluctuation; may occasionally pass
Failed      [0.8843…]
Failed      [0.8917…]
Status:          ✖ Degraded
Message:         RolloutAborted: Rollout aborted update to revision 2: Metric "success-rate" assessed Failed due to failed (2) > failureLimit (1)
Strategy:        Canary
  Step:          0/6
  SetWeight:     0
  ActualWeight:  0
Images:          ghcr.io/stefanprodan/podinfo:6.16.0 (stable)
What Argo CD sees:
argocd app get podinfo-dev | grep -E 'Sync Status|Health Status'
Sync Status:        Synced to main (b7e1d0a)
Health Status:      Degraded

Synced (cluster objects match Git) but Degraded (Rollout aborted). This is the trigger condition for the on-health-degraded notifications in Module 5.

Real rollback: revert in Git:
cd ~/gitops-lab && git revert --no-edit HEAD && git push
argocd app get podinfo-dev --refresh >/dev/null
kubectl argo rollouts status podinfo -n podinfo-dev --timeout 2m
argocd app get podinfo-dev | grep 'Health Status'
Healthy
Health Status:      Healthy

After revert, the template matches the stable ReplicaSet; the controller recovers directly without going through canary steps.

Control group (optional): only raise the image to 6.17.0 (without the patch), observe AnalysisRun Successful and the Rollout finishes all 6 steps. After that, keep dev at 6.16.0 for Module 4. Keep the load generator until Module 8; at the end kubectl delete pod -A -l run=loadgen.

Case 1: a low-traffic service is wrongly judged as failed

Problem: Night-time traffic is extremely low; the canary Pod gets only a few requests within 1 minute, and one occasional 500 drops the success rate to 80%, causing frequent aborts. Fix: Extend the query window to 5m; add the condition “judge only when request volume is sufficient” (a second metric counts requests; when volume is low, Inconclusive hands the decision to a human); or do not release during traffic troughs (sync window, Module 6).

Case 2: a Prometheus upgrade aborts all releases

Problem: During a platform Prometheus upgrade, all AnalysisRuns errored continuously, and releases for dozens of services were aborted. Fix: Make Prometheus itself highly available (two replicas + query frontend); avoid platform changes during release windows; after recovery, use kubectl argo rollouts retry to retry. Lesson: Analysis dependencies are also production dependencies.

Case 3: compare with stable instead of an absolute threshold

Problem: A service's baseline error rate is already 3% (a third-party dependency), so a fixed threshold of 0.99 always fails. Fix: Use podTemplateHashValue: Stable to also query stable's success rate at the same time; write the condition as “canary is not lower than stable minus 1 percentage point” (computed with a PromQL difference), or use an Experiment to run baseline and canary side by side.

Common errors and fixes

Metric "success-rate" assessed Error due to consecutiveErrors (5) > consecutiveErrorLimit (4): "Error Message: reflect: slice index out of range"

Cause: The query returns an empty vector (wrong labels, Prometheus has not scraped the canary Pod yet, or there is no traffic), causing result[0] a value to go out of range.

kubectl -n podinfo-dev get analysisrun -o yaml | grep -A3 'message'
# Run the same query in the Prometheus UI to confirm the rollouts_pod_template_hash label exists

Fix: Check the Pod annotations prometheus.io/scrape/port; increase initialDelay; confirm there is traffic.

dial tcp: lookup prometheus-server.monitoring.svc.cluster.local: no such host

Cause: Wrong address or Prometheus is not deployed. Note that the request is sent by the Rollouts controller (in namespace argo-rollouts), so the NetworkPolicy must allow it to access monitoring.

kubectl -n monitoring get svc
kubectl -n argo-rollouts logs deploy/argo-rollouts | grep -i analysis | tail
AnalysisRun stays Running, but the Rollout is complete and has no result

Cause: After the Rollout completes, the controller terminates the background analysis and records its status as Successful (unless failureLimit has already been violated). If the Rollout is stuck in an indefinite pause, the background analysis keeps running.

Fix: Confirm there is no pause: {} in steps, or promote manually.

args.canary-hash: value is required / failed to resolve {{args.namespace}}

Cause: The parameter declared in AnalysisTemplate has no default value, and the Rollout does not pass it (name mismatch).

Fix: Keep the parameter name exactly the same in the template and the Rollout; use kubectl kustomize to check the rendered result.

Command-line tasks
1. Output the value and result of each measurement in the latest AnalysisRun.
AR=$(kubectl -n podinfo-dev get analysisrun --sort-by=.metadata.creationTimestamp -o name | tail -1)
kubectl -n podinfo-dev get $AR -o jsonpath='{range .status.metricResults[*].measurements[*]}{.phase} {.value}{"\n"}{end}'
2. After Prometheus recovers, retry the aborted release.
kubectl argo rollouts retry rollout podinfo -n podinfo-dev
# or: argocd app actions run podinfo-dev retry --kind Rollout --resource-name podinfo
Scenario analysis
Canary at 25%, the canary Pod's 5xx is 12%, but AnalysisRun stays Successful. The query is sum(rate(http_requests_total{app="podinfo",status!~"5.."}[1m])) / sum(rate(http_requests_total{app="podinfo"}[1m])). What is the problem?

The query covers Pods of all versions, so bad traffic is diluted by stable: overall 5xx ≈ 25% × 12% = 3%, success rate about 0.97, above 0.95. You should add rollouts_pod_template_hash="{{args.canary-hash}}" (the parameter comes from podTemplateHashValue: Latest), and also restrict namespace to avoid mixing with Pods of the same hash from other environments.

Verified teaching video

▶
Stop Deploying Blind! Using Observability and Argo Rollouts to Light the Way - Kostis Kapelonis — CNCF [Cloud Native Computing Foundation]
English · driving Rollouts analysis with metrics, matching this module's topic
▶
Tutorial: Progressive Delivery with Argo Rollouts — CNCF [Cloud Native Computing Foundation]
English · includes an AnalysisTemplate demo

Official documentation

Video storyboard (about 100 seconds)

Shot 1 · 0–25s
Visual: one yellow canary Pod and three green stable Pods; metrics flow from the canary Pod to Prometheus; the rollouts_pod_template_hash label is highlighted.
Narration: first make sure only the canary is measured. The pod template hash label is the key that tells the old and new versions apart.
Shot 2 · 25–65s
Visual: a line chart with a point every 30 seconds and a threshold line at 0.95; the first point is above the line, the next two are below it, and the failed counter goes 1 → 2.
Narration: failureLimit is the number of allowed failures. Beyond it, AnalysisRun judges the run as failed.
Shot 3 · 65–100s
Visual: the ratio bar instantly returns to 100% green; the Argo CD card shows Synced plus Degraded; finally a git revert commit appears and the card turns Healthy.
Narration: aborting sends traffic back to stable immediately, but Git still has the bad version. The real rollback is a revert commit.
Or score ≥ 70% on the quiz

Module 4 · Argo CD Image Updater

21:00 – 28:00 · Move “discover new image → change Git” from CI into the cluster: a controller that selects versions by rule and then writes back to Git
7 minv1.5.0 · ImageUpdater CRDargoproj-labs project★★★★
Learning goals
  • Explain Image Updater's working loop: read ImageUpdater CR → match Application → query image registry tags → select version by strategy → write back.
  • Understand the configuration change since v1.0: from Application annotations to argocd-image-updater.argoproj.io/v1alpha1 ImageUpdater CRD (the annotation approach remains usable via useAnnotations: true compatibility).
  • Compare argocd and git the two write-back methods, and use writeBackTarget: kustomization with a write-back branch template to work with PR review; can be compared with Flux's image automation.
Prerequisites: Module 1 (who changes Git); semver constraints. Importance:★★★★

What: a controller that “changes Git on CI's behalf”

Argo CD Image Updater runs in the cluster where Argo CD is (it must be in the same cluster as the Application), periodically checks the image registry, and when it finds new tags matching the rules, updates the image the application uses. It is a project under argoproj-labs (not part of the Argo CD core distribution); as of 2026-11 the latest is v1.5.0; the 0.x line still has maintenance releases (v0.19.0), and new deployments should use 1.x.

v1.x configuration: ImageUpdater CRD

apiVersion: argocd-image-updater.argoproj.io/v1alpha1
kind: ImageUpdater
metadata:
  name: podinfo-dev
  namespace: argocd                 # must be the same namespace as the managed Application
spec:
  commonUpdateSettings:             # global defaults (can be overridden at applicationRefs / images level)
    updateStrategy: semver
  writeBackConfig:
    method: "git:secret:gitops-lab-writer"
    gitConfig:
      branch: main
      writeBackTarget: kustomization
  applicationRefs:
  - namePattern: podinfo-dev        # supports wildcards and labelSelectors
    images:
    - alias: podinfo
      imageName: ghcr.io/stefanprodan/podinfo:6.x   # the part after the colon is the version constraint

Update strategy

StrategyWhich tag is chosenSuited for
semver (default)The highest semantic version that satisfies the constraint (e.g. 6.x,6.16.x)Official release versions
newest-build (formerly latest)The most recently built tag (requires reading image metadata; used together with allowTags filtering)The dev environment that uses a Git SHA as the tag
digestThe latest digest of a mutable tag (such as stable)Only usable for upstream images with mutable tags
alphabetical (formerly name)The lexicographically largest tagDate-style tags
calverThe latest in calendar-version format (such as vYYYY-0M-0D)Calendar-version releases

Write-back method: argocd vs git

argocd (default)git
Where to changeDirectly modify the Application's source parameters in the cluster (similar to argocd app set --kustomize-image)Commit to Git: the default write is .argocd-source-<appName>.yaml; writeBackTarget: kustomization when changing kustomization.yaml (equivalent to kustomize edit set image); Helm can use helmvalues:<path>
PersistencePseudo-persistent: when the Application is managed by Git (App of Apps), it will be overwritten at the next syncPersistent, has commit history, can be reverted
CredentialsOnly needs Kubernetes permissionsNeeds Git write permission: by default reuses Argo CD's repository credentials (git:repocreds), or git:secret:<name> specify a Secret (must be in the same namespace as the CR)
GitOps purityDesired state is not in GitConforms to GitOps

Write-back branch: gitConfig.branch can be written as main:image-updater-{{.SHA256}} style “base branch:write branch”; the controller pushes commits to a new branch instead of writing directly to main — then CI or GitHub automatically opens a PR for that branch, which lets you combine automatic discovery with human review (Image Updater itself does not create PRs).

When: Image Updater, CI opening a PR, or Flux

CI opens a PR (Module 1)Argo CD Image UpdaterFlux image automation
TriggerImmediately after the build completespolling (--interval) or image registry WebhookImageRepository periodic scan
Configuration objectsPipeline scriptImageUpdater CR (v1alpha1)ImageRepository / ImagePolicy (image-reflector-controller) + ImageUpdateAutomation (image-automation-controller), API image.toolkit.fluxcd.io/v1, controller v1.3.0 (Flux v2.10.0)
How it changes GitArbitrary (script)kustomization / Helm values / .argocd-source-*setter marker comments in YAML # {"$imagepolicy": "ns:name"}
Suited forversions map one-to-one to builds, and change notes need to be attachedupstream third-party images; dev environment auto-followsFlux ecosystem
Common misconceptions① “Image Updater supports all Applications” — it only supports Kustomize, Helm and Plugin types; plain directories (plain YAML) are not supported. ② “Once installed, it scans all applications” — v1.x requires creating ImageUpdater CRs; moreover, when multiple CRs match the same application they overwrite each other (warned in the official docs), so an application can only be managed by one CR. ③ “argocd write-back is also GitOps” — it changes objects in the cluster, which are not visible in Git, and it will be overwritten by App of Apps or ApplicationSet (this lesson's podinfo-* are exactly those generated by ApplicationSet).

Architecture diagram: one loop of Image Updater (git write-back)

ImageUpdater CRpodinfo:6.x · semver image-updater controllernamespace argocd ghcr.iotags: …6.16.0, 6.17.0 watch ① List tags Application podinfo-devCurrently 6.16.0 (status.summary.images) ② Read current version GitOps repositoryoverlays/dev/kustomization.yamlnewTag: 6.17.0 ③ commit + push Argo CD syncs → Rollout canary
Figure 4-1 git write-back keeps version changes in Git; the subsequent flow is exactly the same as merging the PR in Module 1

Comparison: write back to main or to a branch

branch: main (recommended for dev)Direct commit → live within minutesBacked by Rollouts analysis branch: "main:image-updater-{{.SHA256}}"Write to a new branch → CI/bot opens PR → human reviewRecommended for staging / prod
Figure 4-2 automatic discovery and human review can coexist

Interactive simulator: given a tag list, which one will Image Updater choose?

The tags in the image registry are examples (including pre-release, mutable and SHA tags). Choose a strategy and constraint, observe the filtering and selection process, and the diff the write-back would produce.

Core commands and configuration

Command / fieldPurposeNotes
kubectl -n argocd get imageupdatersList CRsThe status records the most recent check and update
kubectl -n argocd logs deploy/argocd-image-updater-controllerView the selection processDeployment name follows the chart (kubectl -n argocd get deploy | grep image-updater)
argocd-image-updater test IMAGE --semver-constraint 6.xTest locally which tag would be selectedChanges nothing; can also be run inside the controller container
allowTags / ignoreTagsFilter tagsregexp:^\d+\.\d+\.\d+$; ["latest","sha-*"]
writeBackConfig.methodargocd / git / git:secret:NAME / git:repocredscan be set at global or applicationRefs level
gitConfig.writeBackTargetkustomization[:path] / helmvalues[:path]Default write .argocd-source-<app>.yaml
useAnnotations: trueKeep the 0.x Application annotationsFor use during migration; the configuration in the CR other than the selector is ignored at this time
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: argocd-image-updater
  namespace: argocd
spec:
  project: platform
  source:
    repoURL: https://argoproj.github.io/argo-helm
    chart: argocd-image-updater
    targetRevision: 1.5.0            # appVersion v1.5.0, includes CRDs (crds.install: true)
  destination:
    server: https://kubernetes.default.svc
    namespace: argocd                # official recommendation: same namespace as Argo CD
  syncPolicy:
    automated: { prune: true, selfHeal: true }
    syncOptions: [ServerSideApply=true]
apiVersion: argocd-image-updater.argoproj.io/v1alpha1
kind: ImageUpdater
metadata:
  name: podinfo-dev
  namespace: argocd
spec:
  writeBackConfig:
    method: "git:secret:gitops-lab-writer"
    gitConfig:
      branch: main
      writeBackTarget: kustomization     # modify overlays/dev/kustomization.yaml
  applicationRefs:
  - namePattern: podinfo-dev
    images:
    - alias: podinfo
      imageName: ghcr.io/stefanprodan/podinfo:6.x
      commonUpdateSettings:
        updateStrategy: semver
        ignoreTags: ["latest"]

Note: Kustomize write-back uses the Application's spec.source.path (apps/podinfo/overlays/dev) to locate kustomization.yaml; imageName Must match the images[].name in kustomization. ghcr.io and Docker Hub are built-in recognized registries, so public images usually need no extra configuration; when you hit 401 or rate limits, add credentials in registries configuration.

Lab 4: have dev automatically upgrade from 6.16.0 to 6.17.0 (about 7 minutes)

Prepare Git write credentials: on GitHub, create a fine-grained PAT only for gitops-lab with Contents read/write permission.
kubectl -n argocd create secret generic gitops-lab-writer \
  --from-literal=username=<you> --from-literal=password=<fine-grained-PAT>

In the lab, create it with kubectl; in production, store it encrypted as described in Hour 5 (Sealed Secrets / ESO).

Install the controller and create the CR (see the “Commands” page for the files):
cd ~/gitops-lab && mkdir -p argocd/image-updaters
# save argocd/apps/image-updater.yaml and argocd/image-updaters/podinfo-dev.yaml
git add argocd && git commit -m "platform: argocd-image-updater 1.5.0 + podinfo-dev updater" && git push
kubectl apply -f argocd/apps/image-updater.yaml
argocd app wait argocd-image-updater --health --timeout 180
kubectl apply -f argocd/image-updaters/podinfo-dev.yaml    # you can also create another Application to manage this directory
kubectl -n argocd get imageupdaters
NAME          AGE
podinfo-dev   10s
Observe the logs and Git (wait for one check cycle):
kubectl -n argocd logs deploy/argocd-image-updater-controller --since=5m | grep -iE 'podinfo|updat|commit'
cd ~/gitops-lab && git pull && git log -1 --stat
grep newTag apps/podinfo/overlays/dev/kustomization.yaml
… msg="Setting new image to ghcr.io/stefanprodan/podinfo:6.17.0" alias=podinfo application=podinfo-dev
… msg="Successfully updated image 'ghcr.io/stefanprodan/podinfo:6.16.0' to 'ghcr.io/stefanprodan/podinfo:6.17.0'"
… msg="Committing 1 parameter update(s) for application podinfo-dev"
commit 4c2e…  build: automatic update of podinfo-dev
 apps/podinfo/overlays/dev/kustomization.yaml | 2 +-
  newTag: 6.17.0
The following chain happens automatically: Argo CD sync → Rollout canary → AnalysisRun verdict (Module 3).
kubectl argo rollouts get rollout podinfo -n podinfo-dev --watch
Change to “write branch + PR” (optional; the recommended practice for staging): change branch to "main:image-updater-{{.SHA256}}", a branch is created when a new version appears, and you open a PR from that branch on GitHub. Since podinfo is already the latest 6.x, you can set dev back to 6.16.0 to observe.
Cleanup / keep: keep the controller for later modules. If you don't want dev to keep upgrading automatically: kubectl -n argocd delete imageupdater podinfo-dev.

Case 1: argocd write-back is wiped out by App of Apps

Problem: The team used the default argocd write-back: Image Updater changed the Application, but the root application (App of Apps) self-healed and changed the Application back to the version in Git, and the two tugged back and forth every few minutes. Fix: switch to git write-back; wherever the Application itself is managed by Git, do not use argocd write-back.

Case 2: a pre-release tag went to production

Problem: The constraint was written as *, and upstream pushed 7.0.0-rc.1. Fix: Production uses only an exact minor-version constraint (6.16.x), and excludes pre-releases via allowTags: regexp:^\d+\.\d+\.\d+$ ; production goes through write-branch + PR.

Case 3: no longer updating after migrating to 1.x

Problem: After upgrading the chart to 1.x, all applications stopped updating. Cause: Starting from 1.0, configuration moved to ImageUpdater CRs; the original annotations no longer take effect automatically. Fix: Following the migration guide, create CRs for each group of applications; during the transition period, use useAnnotations: true + labelSelectors to read the legacy annotations.

Common errors and fixes

could not get tags from registry: … 401 Unauthorized / 429 Too Many Requests

Cause: Private images need credentials, or anonymous access is rate-limited.

Fix: In the chart values' config.registries section, configure credentials for this prefix via credentials: pullsecret:argocd/regcred etc., or in the CR's commonUpdateSettings.pullSecret field, specify it.

could not update application spec: … authentication required / Permission denied (publickey)

Cause: git write-back lacks write permission. By default it reuses Argo CD's repository credentials, and public repositories often have no credentials configured at all.

kubectl -n argocd get secret gitops-lab-writer -o jsonpath='{.data}' | jq 'keys'

Fix: The Secret must contain username/password (HTTPS) or sshPrivateKey (SSH), and be in the same namespace as the CR; method: "git:secret:gitops-lab-writer".

skipping app 'podinfo-dev' of type 'Directory' because it's not of supported source type

Cause: The Application's source is identified as a plain directory.

Fix: Confirm the path contains kustomization.yaml (Kustomize) or is a Helm chart.

The Application switches back and forth between two versions

Cause: The namePattern of two ImageUpdater CRs both match this application (the official docs explicitly state they will overwrite each other), or CI is also changing the same tag.

Fix: Ensure each application is matched by only one CR; make it explicit that “each field has only one writer”.

Command-line tasks
1. Without changing anything, test 6.16.x which tag the constraint would select for podinfo.
kubectl -n argocd exec deploy/argocd-image-updater-controller -- \
  argocd-image-updater test ghcr.io/stefanprodan/podinfo --semver-constraint 6.16.x
2. Change podinfo-dev's write-back to image-updater- prefixed new branch.
kubectl -n argocd patch imageupdater podinfo-dev --type merge -p \
  '{"spec":{"writeBackConfig":{"gitConfig":{"branch":"main:image-updater-{{.SHA256}}"}}}}'
Scenario analysis
The platform team maintains 30 third-party components at once (ingress-nginx, cert-manager images, etc.); they want patch versions to enter dev automatically while minor versions require review. How would you design it?

dev: one ImageUpdater CR, uses labelSelectors to select dev applications, with the constraint X.Y.x (following only patch versions), git write-back directly to main. Minor versions: another CR only does discovery (constraint X.x), writing to main:image-updater-{{.SHA256}} branches, with a bot opening PRs for human review. All CRs are placed in Git and managed by Argo CD; ensure each application is matched by only one CR (distinguish them with different labels).

Verified teaching video

▶
GitOps Without Pipelines With ArgoCD Image Updater — DevOps & AI Toolkit
English · explains the approach and write-back method; recorded before 1.x and uses annotation configuration; for configuration syntax, follow this lesson's CRD

Official documentation

Video storyboard (about 80 seconds)

Shot 1 · 0–25s
Visual: a new tag card 6.17.0 appears in the image registry, and the controller's “radar” picks it up.
Narration: Image Updater periodically checks the image registry and only cares about tags that match the rules.
Shot 2 · 25–55s
Visual: the tag list is filtered: latest, sha tags and pre-releases are struck out, and 6.17.0 is selected.
Narration: the strategy decides the choice: semver takes the highest version within the constraint, newest-build takes the latest build, and digest tracks the digest of a mutable tag.
Shot 3 · 55–80s
Visual: two paths: argocd write-back only changes the Application in the cluster (dashed line, overwritten by App of Apps); git write-back produces a commit (solid line).
Narration: to conform to GitOps, write the version back to Git.
Or score ≥ 70% on the quiz

Module 5 · Notifications: Notification Triggers and Templates

28:00 – 35:00 · When Git drives everything, people need to be told “what happened”: triggers decide when to send, templates decide what to send, and services decide where to send
7 minBuilt into Argo CDLocal Webhook · zero cost★★★★
Learning goals
  • Explain the four concepts of notifications-controller: trigger (expr conditions),template (Go templates),service (Slack, Webhook, Email, Teams, GitHub…),subscription (annotation or global subscription).
  • Use Helm values (notifications.notifiers / templates / triggers) to configure a local Webhook service, and use oncePer to avoid duplicate notifications.
  • Be able to use argocd admin notifications to test triggers and templates offline, and know that Argo Rollouts has its own notifications (e.g. abort events).
Prerequisites: Module 3 (Degraded status). Importance:★★★★

What: Argo CD Notifications

Notifications was originally a standalone project and is now merged into Argo CD, as argocd-notifications-controller installed by default with the official Helm chart (notifications.enabled: true). It watches Application (and AppProject) objects, and all its configuration is placed in a ConfigMap argocd-notifications-cm and a Secret argocd-notifications-secret .

ConceptConfig keyExample
Service (where to send)service.<type>[.<name>]service.webhook.local,service.slack
Template (what to send)template.<name>Common message + service-specific fields (slack.attachments,webhook.<name>.body)
Trigger (when to send)trigger.<name>when: app.status.health.status == 'Degraded',send: [template]
Subscription (who subscribes)Annotation notifications.argoproj.io/subscribe.<trigger>.<service>: <recipient>, or in cm subscriptionsmultiple recipients separated by semicolons; added on an AppProject it applies to the whole project

Official catalog provides commonly used triggers: on-created,on-deleted,on-deployed (sync succeeded and healthy, once per commit),on-health-degraded,on-sync-failed,on-sync-running,on-sync-status-unknown,on-sync-succeeded. Note: the Helm chart's templates / triggers defaults to empty; you need to define it yourself or apply the directory manifest separately.

Why: GitOps's “feedback loop”

In the push model, pipeline logs are the feedback; in the pull model, the person who merges the PR cannot see what happened in the cluster. Notifications send results back to people (Slack channel) and to systems (GitHub commit status, event bus, ticketing system). Module 3's “Synced but Degraded” especially needs notification, otherwise a bad version may sit in Git for a long time.

How: the processing flow of one notification

  1. The controller detects an Application change (e.g. health changes from Progressing to Degraded).
  2. For each trigger subscribed by the application, evaluate when condition (expr language; optional chaining ?. prevents operationState errors when empty).
  3. If the condition is true and it has not been sent (deduplicated by the value of the oncePer field or by a change in condition status) → render send templates (Go template; can use .app,.context.argocdUrl,.serviceType etc.).
  4. Hand it to the corresponding service to send; if the Webhook fails (network error or 5xx), it is retried retryMax times (default 3).
  5. The sending state is recorded in the Application annotation notified.notifications.argoproj.io , used for deduplication.

When: where subscriptions go

  • Team's own applications: Application annotations (in Git alongside the Application).
  • Whole team / project: AppProject annotations.
  • Platform-level fallback (sync failed for all apps goes to #platform-alerts): in cm, subscriptions, can be filtered by selector labels.
  • Rollout-level events (abort, pause, analysis failure): Argo Rollouts' built-in notification engine; ConfigMap argo-rollouts-notification-configmap, triggers such as on-rollout-aborted, subscription annotations are added on the Rollout.
Common misconceptions① “Installing Argo CD means you have notifications” — the controller runs, but with no trigger, template, service or subscription, nothing gets sent. ② “on-sync-succeeded means the release succeeded” — sync success only means the objects were applied; the Rollout may be aborted afterward. For the release outcome, look at on-deployed (sync succeeded + Healthy) and on-health-degraded. ③ “A Slack token can be written in a ConfigMap” — secrets belong in argocd-notifications-secret, and in cm use $key to reference them.

Architecture diagram: notifications-controller

Applicationhealth: Degradedsubscribe.on-health-degraded.local notifications-controller ① trigger: expr evaluation ② oncePer / state deduplication ③ template: Go template rendering watch argocd-notifications-cmservice / template / trigger argocd-notifications-secret Webhook (local echo) Slack / Teams GitHub commit status ④ send result written back to the Application annotation notified.notifications.argoproj.io (basis for deduplication)
Figure 5-1 trigger → dedup → template → service; configuration in cm, secrets in Secret

Interactive simulator: which notifications does one event trigger?

Click “Application state change” below in turn, and observe each trigger's evaluation result,oncePer deduplication, and the Webhook request body sent. Note that during “health flapping”, on-deployed will not send repeatedly.

Application state
Trigger evaluation

Core commands

CommandPurpose
argocd admin notifications trigger getList configured triggers
argocd admin notifications template getList configured templates
argocd admin notifications trigger run TRIGGER APPEvaluate triggers for an application (without sending)
argocd admin notifications template notify TEMPLATE APP --recipient SERVICE:RECIPIENTRender and send once immediately, for debugging templates
kubectl -n argocd logs deploy/argocd-notifications-controllerView send records and errors

argocd admin The subcommand reads the cm/Secret in the cluster directly (using the current kubeconfig, adding -n argocd), without going through the API Server.

notifications:
  argocdUrl: https://localhost:8080
  notifiers:
    service.webhook.local: |
      url: http://webhook-sink.webhook-sink.svc.cluster.local:8080/argocd
      headers:
      - name: Content-Type
        value: application/json
    # service.slack: |
    #   token: $slack-token          # value comes from argocd-notifications-secret
  templates:
    template.app-event: |
      message: "{{.app.metadata.name}} sync={{.app.status.sync.status}} health={{.app.status.health.status}}"
      webhook:
        local:
          method: POST
          body: |
            {"app":"{{.app.metadata.name}}","sync":"{{.app.status.sync.status}}",
             "health":"{{.app.status.health.status}}","revision":"{{.app.status.sync.revision}}",
             "url":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}"}
  triggers:
    trigger.on-deployed: |
      - when: app.status?.operationState?.phase in ['Succeeded'] and app.status.health.status == 'Healthy'
        oncePer: app.status.sync.revision
        send: [app-event]
    trigger.on-health-degraded: |
      - when: app.status.health.status == 'Degraded'
        send: [app-event]
    trigger.on-sync-failed: |
      - when: app.status?.operationState?.phase in ['Error', 'Failed']
        send: [app-event]
    metadata:
      name: 'podinfo-{{.env}}'          # existing form from Hour 3, keep unchanged
      annotations:
        notifications.argoproj.io/subscribe.on-deployed.local: ""
        notifications.argoproj.io/subscribe.on-health-degraded.local: ""
        notifications.argoproj.io/subscribe.on-sync-failed.local: ""

podinfo-dev / staging / prod are generated by the Hour 3 ApplicationSet; podinfo subscription annotations must be written in the ApplicationSet template— directly editing the generated Application will be reverted by the ApplicationSet controller. name The line should follow your Hour 3 template (parameter names may differ). When using the minimal starting point (a hand-written argocd/apps/podinfo-dev.yaml), add the annotation to that Application's metadata. The Webhook service has no concept of a “recipient”, so leave the subscription value as an empty string. The Slack form is subscribe.on-health-degraded.slack: my-channel.

Lab 5: send deployment events to a local Webhook receiver (about 7 minutes)

Start an echo service as the receiver (mendhak/http-https-echo will print received requests to the log; for lab use only):
kubectl create namespace webhook-sink
kubectl -n webhook-sink create deployment webhook-sink --image=mendhak/http-https-echo:43 --port=8080
kubectl -n webhook-sink expose deployment webhook-sink --port=8080
kubectl -n webhook-sink rollout status deploy/webhook-sink
Add the notification configuration to Argo CD's Helm values and upgrade (content on the “Commands” page):
cd ~/gitops-lab
helm upgrade argocd argo/argo-cd -n argocd --version 10.18.0 -f bootstrap/argocd-values.yaml --wait
argocd admin notifications trigger get -n argocd
argocd admin notifications template get -n argocd
NAME                 TEMPLATE   CONDITION
on-deployed          app-event  app.status?.operationState?.phase in ['Succeeded'] and app.status.health.status == 'Healthy'
on-health-degraded   app-event  app.status.health.status == 'Degraded'
on-sync-failed       app-event  app.status?.operationState?.phase in ['Error', 'Failed']
NAME       PREVIEW
app-event  {{.app.metadata.name}} sync={{.app.status.sync.status}} health=…

If Argo CD itself is managed by Argo CD (self-managed, Hour 3), commit the values to Git instead.

Subscribe and test offline: add the annotation to the ApplicationSet template and commit it (for the minimal starting point, add it to argocd/apps/podinfo-dev.yaml):
git add argocd/appsets/podinfo.yaml && git commit -m "podinfo: subscribe local webhook" && git push
kubectl apply -f argocd/appsets/podinfo.yaml       # or wait for the root application to sync
kubectl -n argocd get app podinfo-dev -o jsonpath='{.metadata.annotations}' | jq 'with_entries(select(.key|startswith("notifications")))'
argocd admin notifications trigger run on-deployed podinfo-dev -n argocd
argocd admin notifications template notify app-event podinfo-dev --recipient local: -n argocd
kubectl -n webhook-sink logs deploy/webhook-sink --tail=30 | grep -E '"path"|"body"'
CONDITION                                                       RESULT
app.status?.operationState?.phase in ['Succeeded'] and …       true
  "path": "/argocd",
  "body": "{\"app\":\"podinfo-dev\",\"sync\":\"Synced\",\"health\":\"Healthy\",\"revision\":\"4c2e…\",…}",
Real event: repeat Module 3's “bad version” commit and wait for the abort:
kubectl -n webhook-sink logs deploy/webhook-sink -f | grep --line-buffered '"body"'
"body": "{\"app\":\"podinfo-dev\",\"sync\":\"Synced\",\"health\":\"Degraded\",…}"

After revert, you will receive one more on-deployed (new revision).

(Optional) Rollout-level notifications: Argo Rollouts' notification config lives in the argo-rollouts namespace's argo-rollouts-notification-configmap, trigger names such as on-rollout-aborted, and subscription annotations are added to the Rollout: notifications.argoproj.io/subscribe.on-rollout-aborted.local: "". The field format is the same as Argo CD's (same notifications-engine).

Case 1: the channel is flooded with notifications

Problem: Using when: app.status.health.status == 'Healthy' as “deployment succeeded”, every time a Pod restarts the health goes Progressing → Healthy and it sends again. Fix: Add oncePer: app.status.sync.revision; for a single repository with multiple applications, the official recommendation is to use oncePer: app.status?.operationState.syncResult.revision.

Case 2: write deployment results back to GitHub

Problem: Developers cannot see on the application repository's commit page whether it has been deployed to dev. Fix: Use service.github (GitHub App credentials) and the github.status in the template to write a commit status on the commit; or use a Webhook to trigger GitHub repository_dispatch to continue the subsequent pipeline (e.g. run E2E on dev, then automatically open the staging promotion PR, Module 7).

Case 3: self-service notifications

Problem: Each team wants to use a different notification channel, but should not modify the configuration in the argocd namespace. Fix: Enable apps-in-any-namespace, and turn on notificationscontroller.selfservice.enabled: "true", teams put argocd-notifications-cm / Secret in their own namespace.

Common errors and fixes

failed to execute when condition: cannot fetch phase from <nil> (1:28)

Cause:status.operationState does not exist before the sync starts.

Fix: Use optional chaining app.status?.operationState?.phase.

notification service 'local' is not supported / config referenced xxx, but key does not exist in secret

Cause: The service name in the subscription annotation does not match service.webhook.<name> ; or $key does not exist in the Secret.

kubectl -n argocd get cm argocd-notifications-cm -o yaml | grep -n 'service\.'
kubectl -n argocd logs deploy/argocd-notifications-controller | tail -20
Configuration is correct but no notification is ever received

Cause: There is no subscription (annotation misspelled, or added to the wrong object); or the condition was already true before the subscription and has already been recorded as notified.

kubectl -n argocd get app podinfo-dev -o jsonpath='{.metadata.annotations}' | jq
argocd admin notifications trigger run on-deployed podinfo-dev -n argocd
Post "http://webhook-sink…": context deadline exceeded

Cause: A NetworkPolicy blocks outbound traffic from the argocd namespace, or the receiver is not ready.

Fix: Test with curl from the namespace where notifications-controller runs; allow the outbound traffic.

Command-line tasks
1. For team-a all applications under the AppProject, subscribe a Slack notification for sync failures (channel team-a-alerts).
kubectl -n argocd annotate appproject team-a \
  notifications.argoproj.io/subscribe.on-sync-failed.slack=team-a-alerts
2. Without waiting for a real event, immediately send the app-event template to the local Webhook.
argocd admin notifications template notify app-event podinfo-dev --recipient local: -n argocd
Scenario analysis
The on-call team requires: alert only if any prod application is Degraded for more than 5 minutes, but alert on dev immediately. Can this be done with Notifications alone?

The trigger condition only looks at the current state; there is no native “lasts N minutes” semantics (you could compare time fields in expr, but it is not recommended). A better split: dev uses Notifications to send immediately to the team channel; for prod, use Argo CD's metrics argocd_app_info{health_status="Degraded"} write for: 5m alert rules in Prometheus/Alertmanager (see the Prometheus lesson), and let Alertmanager handle grouping, silencing and escalation.

Verified teaching video

▶
ArgoCD Notifications (Successful/Failed Deployments) — Anton Putra
English · demo of triggers, templates and Slack configuration

Official documentation

Video storyboard (about 80 seconds)

Shot 1 · 0–25s
Visual: the health status on the Application card changes from green to red Degraded, and a “bell” lights up.
Narration: a trigger is an expression; when the state satisfies the condition, the bell rings.
Shot 2 · 25–55s
Visual: the template fills the application name, version and link into a block of JSON.
Narration: the template decides the message content; the same template can produce different formats for Slack and Webhook.
Shot 3 · 55–80s
Visual: the Application's annotation works like a subscription switch pointing to the Webhook receiver; the request body appears in the log.
Narration: the subscription is written in an annotation and goes into Git along with the Application.
Or score ≥ 70% on the quiz

Module 6 · Sync Windows and Change Freezes

35:00 – 42:00 · The stronger the automation, the more you need “brakes”: when changes are allowed, whether to self-heal or alert on drift, and how to change the cluster first and then return to Git in an emergency
7 minAppProject.spec.syncWindowsbreak-glass★★★★
Learning goals
  • Use the AppProject's sync windows (kind: allow|deny, cron schedule,duration,applications/namespaces/clusters,manualSync,timeZone,syncOverrun) to implement release windows and holiday freezes, and infer whether syncing is allowed at a given moment.
  • Choose a different drift policy for different environments: self-heal (selfHeal), alert only (automatic sync without self-heal / manual sync + notification), and use ignoreDifferences to exclude legitimate “other writers”.
  • Define an break-glass emergency change process: restore service first, then within a time limit write the change back to Git, and finally re-enable automatic sync and confirm zero diff.
Prerequisites: Hour 1 selfHeal / prune; Hour 4 AppProject. Importance:★★★★

What: sync windows

Sync windows are defined in the AppProject's spec.syncWindows , and are rules that “allow or deny syncing for a given time period”. Each window consists of kind (allow / deny), a cron-format schedule (window start time),duration (how long it lasts), and selectors (applications,namespaces,clusters, supporting wildcards; multiple selectors are ORed by default, and in the UI you can check “Use AND operator” to make them ANDed).

Decision rules (official documentation)

  • No window matches the application → all syncs are allowed.
  • There is a matching allow window → only when some allow window is active is syncing allowed.
  • There is a matching and active deny window → all syncs are forbidden.
  • When an allow and a deny are active at the same time → deny takes precedence.
  • Windows apply to both automatic sync and manual sync (self-heal is also a form of automatic sync); manualSync: true allow manual sync when blocked by this window (for emergency fixes).
  • timeZone Specify the time zone for cron (default UTC); syncOverrun (newer versions) allows a sync that has already started to cross the window boundary and complete.
  • Window panel colors in the UI: red = sync forbidden, orange = manual only, green = allowed.

Why: change freezes and release windows

Typical needs: production is only released on weekday daytime (with staff on duty); all changes are frozen during major promotions, holidays and financial settlement periods; database-related applications are only allowed to sync in the nightly maintenance window. Without windows, Argo CD syncs as soon as a PR is merged — which is unacceptable during a freeze. The benefit of windows is that you do not need to change the process: PRs can still be merged, the Application shows OutOfSync, and it catches up automatically when the window opens.

Drift policy: self-heal or alert only

PolicyConfigBehavior on driftSuited for
Self-healautomated: {selfHeal: true}Manual changes are quickly reverted (selfHeal has backoff)dev, staging, most stateless services; also a forced way to “prevent manual changes to production”
Automatic sync but only alert on driftautomated: {} (selfHeal false) + notificationSyncs when there is a new commit in Git; manual changes are kept and shown as OutOfSync, alerted via notifications / metricsMigration period, or teams worried about automatic reversion
Manual sync + alertNone automatedGit changes and drift both only show as OutOfSync, waiting for a person to syncRegulated environments, production that needs a human to press a button
Declare “not managed by me”ignoreDifferences (+ RespectIgnoreDifferences=true)Specified fields do not take part in comparisonreplicas managed by HPA, fields injected by controllers, certificates generated by webhooks

Implementation of alert-only: define in Notifications when: app.status.sync.status == 'OutOfSync' triggers (together with oncePer: app.status.sync.revision), or in Prometheus write argocd_app_info{sync_status="OutOfSync"} for for: alerts with

break-glass: emergency change process (recommended template)

  1. The first choice is still Git: emergency PR + emergency approval group (branch protection allows designated people to bypass, with audit records) + manual sync (window set to manualSync: true).
  2. When Git / CI is unavailable or too slow: declare an incident and record a ticket; turn off automatic sync for the related Application — note who manages this Application: when managed by App of Apps, turn off automatic sync of the root application first; when it is generated by ApplicationSet (podinfo-* in this lesson), the ApplicationSet controller will revert the manually changed syncPolicy to the template value, so you need to declare beforehand in the ApplicationSet ignoreApplicationDifferences (jsonPointers /spec/syncPolicy), or first turn off the root application that manages the ApplicationSet, then temporarily modify the ApplicationSet's template; then use kubectl to repair directly.
  3. Timed write-back: within the agreed time (e.g. 24 hours), write the fix in the cluster into a PR and merge it into Git; use argocd app diff to confirm Git and the cluster have zero diff.
  4. Restore reconciliation: re-sync the root application, which restores the child Application's syncPolicy to the definition in Git; confirm Synced / Healthy, close the incident and do a retrospective.
Common misconceptions① “A deny window only blocks automatic sync” — by default it also blocks manual sync; you need manualSync: true to bypass it manually. ② “Adding the window with the CLI is enough” — if the AppProject itself is in Git and self-healed by the root application, a window added via the CLI will quickly be reverted; freeze windows must also go through Git. ③ “break-glass means turning off Argo CD” — it turns off automatic sync for a single application, and must be accompanied by the wrap-up steps “write back to Git, restore reconciliation”, otherwise long-term drift is left behind.

Timeline: windows over a week

MonTueWedThuFriSatSun allow *-prod: Mon–Thu, 8 hours starting 09:00 (green) deny *: 62-hour freeze starting Fri 18:00, manualSync: true (red, manual allowed in emergencies) Other times: prod matches an allow window but is outside its active period → forbidden; dev does not match an allow window → only constrained by deny Rules: no match → allowed; has allow → allowed only within an active allow; active deny → forbidden; deny takes precedence over allow
Figure 6-1 windows start per cron and last per duration; deny overrides allow

Flowchart: break-glass

IncidentRecord ticket Turn off automatic syncNote AppSet / root application Fix with kubectlOutOfSync (expected) Write back to Git (PR)app diff = 0 Sync the root applicationPolicy restored · retrospective
Figure 6-2 restore service first, then return to “Git is the single source of truth”

Interactive judge: can it sync right now?

The project has two windows (see below). Click any hour in the weekly grid, choose an application and sync method, and view the judgment process. The decision logic is a simplified implementation of the official documentation's rules.

AllowedManual onlyForbidden
Click an hour in the grid.

Core commands

CommandPurpose
argocd proj windows list PROJList windows and current status (Active / Inactive)
argocd proj windows add PROJ --kind deny --schedule "0 18 * * 5" --duration 62h --applications "*" --time-zone "Asia/Shanghai"Add a window (if the project is managed by Git, change Git instead)
argocd proj windows enable-manual-sync PROJ IDAllow manual sync when this window blocks
argocd proj windows update PROJ ID --applications …Modify a window (list fields must be written in full)
argocd app get APPDisplay SyncWindow: Sync Denied and matching windows
argocd app set APP --sync-policy none / automated --self-healTurn off / restore automatic sync during break-glass
  syncWindows:
  - kind: allow                    # production release window: Mon–Thu 09:00–17:00
    schedule: "0 9 * * 1-4"
    duration: 8h
    timeZone: "Asia/Shanghai"
    applications: ["*-prod"]
    manualSync: true
  - kind: deny                     # weekend freeze: 62 hours starting Fri 18:00
    schedule: "0 18 * * 5"
    duration: 62h
    timeZone: "Asia/Shanghai"
    applications: ["*"]
    manualSync: true               # emergency fixes can still be synced manually
    trigger.on-out-of-sync: |
      - when: app.status.sync.status == 'OutOfSync'
        oncePer: app.status.sync.revision
        send: [app-event]

Lab 6: freeze prod, manual override, rehearse break-glass (about 8 minutes)

Below, use the variable PROJ to denote the project in which the podinfo application lives (from Hour 4 it is platform, consistent with the Hour 4 window semantics; the minimal starting point is default).

Add a “takes effect now” deny window via Git (cron * * * * * opens a 1-hour window every minute, effectively always in effect; the official documentation's list example also uses this form):
PROJ=platform
cd ~/gitops-lab
yq -i '.spec.syncWindows = [{"kind":"deny","schedule":"* * * * *","duration":"1h","applications":["podinfo-prod"],"manualSync":false}]' argocd/projects/$PROJ.yaml
git commit -am "freeze podinfo-prod (lab)" && git push
kubectl apply -f argocd/projects/$PROJ.yaml     # same content as Git; if a root application exists, you can also wait for it to sync
argocd proj windows list $PROJ
ID  STATUS  KIND  SCHEDULE   DURATION  APPLICATIONS  NAMESPACES  CLUSTERS  MANUALSYNC  SYNCOVERRUN  TIMEZONE  USEANDOPERATOR
0   Active  deny  * * * * *  1h        podinfo-prod  -           -         Disabled    Disabled     UTC       Disabled

If the AppProject is not managed by Git, you can directly argocd proj windows add.

Submit a change to prod during the freeze:
cd ~/gitops-lab/apps/podinfo/overlays/prod
kustomize edit set image ghcr.io/stefanprodan/podinfo:6.17.0
git commit -am "prod: podinfo 6.17.0 (during freeze)" && git push
argocd app get podinfo-prod --refresh | grep -E 'SyncWindow|Sync Status'
argocd app sync podinfo-prod
SyncWindow:         Sync Denied
Sync Status:        OutOfSync from main (e9f0…)
FATA[0001] rpc error: code = PermissionDenied desc = cannot sync: blocked by sync window
Emergency manual override: change the window to manualSync: true (also via Git), then manually sync:
cd ~/gitops-lab
yq -i '.spec.syncWindows[0].manualSync = true' argocd/projects/$PROJ.yaml
git commit -am "freeze: allow manual sync" && git push; sleep 30
argocd app sync podinfo-prod && kubectl argo rollouts promote podinfo -n podinfo-prod --full

The window still blocks automatic sync and self-heal; only people with sync permission can manually sync — this is the “emergency channel” during a change freeze.

Break-glass drill (run on staging, assuming Git is unavailable, and temporarily raise the replica count to 6):
  ignoreApplicationDifferences:       # allow manual changes to the generated Application's syncPolicy (prerequisite for break-glass)
  - jsonPointers:
    - /spec/syncPolicy
# 0) Prerequisite: the ignoreApplicationDifferences above is already in Git and synced
#    (otherwise the ApplicationSet controller will immediately revert syncPolicy to the template value; for a hand-written Application in the minimal starting point, you must first turn off automatic sync on the root application)
# 1) Turn off automatic sync
argocd app set podinfo-staging --sync-policy none
# 2) Fix directly
kubectl -n podinfo-staging patch rollout podinfo --type merge -p '{"spec":{"replicas":6}}'
argocd app get podinfo-staging | grep 'Sync Status'      # OutOfSync: expected drift
# 3) Write back to Git
cd ~/gitops-lab/apps/podinfo/overlays/staging
cat >> kustomization.yaml <<'EOF'
patches:
- target: { kind: Rollout, name: podinfo }
  patch: |-
    - op: replace
      path: /spec/replicas
      value: 6
EOF
kubectl kustomize . | grep 'replicas:'
git commit -am "staging: replicas 6 (backport of break-glass INC-123)" && git push
argocd app diff podinfo-staging --refresh && echo "zero diff"
# 4) Restore reconciliation: ApplicationSet ignores syncPolicy differences, so restore it manually (to match the template)
argocd app set podinfo-staging --sync-policy automated --self-heal --auto-prune
argocd app get podinfo-staging | grep -E 'Sync Policy|Sync Status'
Sync Status:        OutOfSync from main (e9f0…)
zero diff
Sync Policy:        Automated (Prune)
Sync Status:        Synced to main (1a2b…)

argocd app diff Exit code is 0 when there is no difference, and 1 when there is one. Note: kustomize's replicas: field only recognizes Deployment / StatefulSet / ReplicaSet / ReplicationController (verified locally with kustomize v5; it errors on Rollout), so a JSON patch is used here.

Cleanup: remove the lab window from the project (yq -i 'del(.spec.syncWindows)' … and push). prod stays at 6.17.0 or is reverted to 6.16.0; decide according to your Module 7 starting point (Module 7 assumes prod is 6.16.0).

Case 1: year-end freeze

Problem: A retail company freezes all production changes from late November to early December, but security patches must still be able to go out. Fix: Add deny windows to all projects (schedule: "0 0 20 11 *",duration: 360h),manualSync: true; manual sync permission is granted only to the SRE on-call group via Argo CD RBAC; all freeze-period change PRs need an extra change-approval label. The window definitions are placed in Git and automatically become invalid after the freeze ends.

Case 2: self-heal conflicts with emergency scale-out

Problem: Traffic surged; the on-call engineer kubectl scale scaled out, but after 30 seconds selfHeal reverted it, and the incident grew. Fix: Hand replicas over to HPA and, in the Application, ignoreDifferences; write a break-glass runbook that clearly says “turn off automatic sync on the root application first, then on child applications”; rehearsed once in the Argo CD UI.

Case 3: an alert-only migration period

Problem: An old system has just been onboarded to GitOps; everyone worries that self-heal will overwrite unknown manual configuration. Fix: For the first two weeks, automated: {} keep selfHeal off and subscribe to the on-out-of-sync notifications, gradually fold manual configuration into Git, and enable selfHeal only after drift alerts are cleared.

Common errors and fixes

cannot sync: blocked by sync window

Cause: A matching deny window is active, or an allow window exists but is not currently in its active period.

argocd app get podinfo-prod | grep -E 'SyncWindow|Assigned Windows'
argocd proj windows list platform

Fix: Wait for the window, or use the manualSync: true emergency channel, or fix the window selector (e.g. *-prod wrongly matched dev).

The window time is “off by 8 hours”

Cause: Not set timeZone, so cron is interpreted in UTC.

Fix: Add timeZone: "Asia/Shanghai"; use argocd proj windows list to check the TIMEZONE column.

A window added via the CLI disappears after a few minutes

Cause: The AppProject is managed by Git, and the root application's self-heal changes it back to the Git version.

Fix: Modify the AppProject in Git.

After break-glass, the automatic sync that was turned off “restored itself” and the manual fix was overwritten

Cause: The Application is generated by an ApplicationSet (or managed by the root application), and the controller restores syncPolicy to the template / value in Git.

Fix: Pre-declare ignoreApplicationDifferences: [{jsonPointers: [/spec/syncPolicy]}] in the ApplicationSet; for App of Apps, turn off automatic sync on the root application first. Write this into the runbook and rehearse it.

Command-line tasks
1. Add an allow window to project platform that starts every day at 02:00 (Shanghai time) for 2 hours, applying only to *-prod applications.
argocd proj windows add platform --kind allow --schedule "0 2 * * *" --duration 2h \
  --applications "*-prod" --time-zone "Asia/Shanghai"
2. Check whether podinfo-prod is currently blocked by a window.
argocd app get podinfo-prod | grep -E 'SyncWindow|Assigned Windows'
Scenario analysis
Friday 20:00, prod is frozen (deny, manualSync: true). A serious vulnerability requires an immediate image upgrade. Write out your steps.

① Open a PR in the normal way to change the image tag in the prod overlay, going through emergency approval (branch protection allows the emergency group); ② after merging, the Application shows OutOfSync and automatic sync is blocked by the window; ③ the on-call SRE (RBAC allows sync) manually argocd app sync podinfo-prod; ④ the Rollout runs the canary and analysis as usual (do not skip the safety net); ⑤ notifications are sent automatically, and afterwards an explanation is added to the change record. Throughout, Git remains the source of truth, and kubectl is not needed.

Verified teaching video

▶
Argo CD Self-Heal, Sync Windows and Diffing — mkdev
English · covers self-heal, sync windows and diff customization together, highly aligned with this module

Official documentation

Video storyboard (about 80 seconds)

Shot 1 · 0–25s
Visual: a weekly calendar, weekday daytime in green and weekends in red; a PR is merged on Saturday, and the Application card stays at OutOfSync.
Narration: a sync window does not block merging, only syncing. When the window opens, the cluster automatically catches up with Git.
Shot 2 · 25–55s
Visual: three drift policies side by side: self-heal (snaps back immediately), alert only (bell rings), manual (waiting for a button).
Narration: the drift policy is the character of an environment. Development self-heals, the migration period only alerts, and regulated production syncs manually.
Shot 3 · 55–80s
Visual: the five-step break-glass process; finally the diff count returns to zero.
Narration: in an emergency you may change the cluster first, but you must return to Git: write back, confirm zero diff, restore reconciliation.
Or score ≥ 70% on the quiz

Module 7 · Environment Promotion: PR Flow and Promotion Tools

42:00 – 50:00 · Promotion = writing the “same artifact version already verified in the previous environment” via PR into the next environment's directory
8 minTool-agnostic patternKargo v1.12.6★★★★★
Learning goals
  • Express environments with directories (apps/podinfo/overlays/dev|staging|prod), implement promotion as a PR that copies the verified version number / digest into the next overlay, and explain why not to use “one branch per environment”.
  • Design promotion gates: previous environment healthy, soak time, automated tests, manual approval, sync windows; write a script that generates the promotion PR.
  • Understand the Kargo model (Warehouse → Freight → Stage → Promotion) and its applicable scenarios, and know its relationship with Argo CD.
Prerequisites: Modules 1, 4, 6. Importance:★★★★★

What: promotion

The same application runs in dev, staging and prod; the differences should only be environment configuration (replica count, resources, domain names, canary cadence) and versions. Promotion means pushing the version along the environment chain: a version verified in dev podinfo:6.17.0 can only enter staging, and staging must pass before it can enter prod. In GitOps this action is a PR that modifies the next environment's directory:

--- a/apps/podinfo/overlays/staging/kustomization.yaml
+++ b/apps/podinfo/overlays/staging/kustomization.yaml
 images:
 - name: ghcr.io/stefanprodan/podinfo
-  newTag: 6.16.0
+  newTag: 6.17.0

Why: directories instead of branches

Environment = directory (recommended)Environment = branch
See each environment's differencesdiff overlays/staging overlays/prod Visible at a glanceRequires comparing branches, mixing in many unrelated commits
Promotion actionA small PR changing one fieldMerge / cherry-pick between branches; easily carries changes that should not be promoted along
Shared changes (base)Changing base once affects all environments (watch the blast radius)Need to merge repeatedly into each branch
Argo CD configurationAll Applications track main, with different pathstargetRevision differs for each

Note that changes to base affect all environments at the same time — this is the cost of the directory model. For higher-risk base changes, you can first validate them in a patch in the dev overlay and then move them up to base; or version the base as well (remote base with ?ref=).

How: promotion gates

GateHow it's checkedWhere implemented
Previous environment synced and healthyargocd app get podinfo-dev -o json in its status: sync=Synced, health=Healthy, and the revision includes this versionPromotion script / CI check
Rollout completed and analysis successfulkubectl argo rollouts status; AnalysisRun SuccessfulSame as above
Soak timeRunning in dev for ≥ N hours with no alertsCI scheduled job
Automated testsRun E2E against dev/stagingCI, triggered by a notification Webhook (Module 5)
Manual approvalCODEOWNERS: apps/podinfo/overlays/prod/ @org/sre + required reviewGit platform branch protection
TimeSync windowArgo CD (Module 6)

“What is promoted is the artifact, not a rebuild”

What prod runs must be the same image verified in staging. Do not rebuild during promotion; it is best to promote the digest (6.17.0@sha256:…), and enable immutable tags in the image registry. Configuration differences stay in each environment's overlay and do not move with promotion.

When: when a dedicated promotion tool (Kargo) is needed

Kargo (Akuity open source, Apache-2.0, latest v1.12.6 as of 2026-11; not part of the Argo project itself, but developed by Argo's founding team and uses Argo CD to deploy) models promotion as a set of CRDs:

  • Warehouse: subscribes to artifact sources (image registry, Git repository, Helm chart) and discovers new versions.
  • Freight: a group of artifact versions promoted together (e.g. “podinfo:6.17.0 + config commit a1b2”), the unit of promotion.
  • Stage: an environment (dev / staging / prod) that declares from which Warehouse or upstream Stage it receives Freight, and how it is verified (can use Argo Rollouts' AnalysisTemplate).
  • Promotion: a request to “put a certain Freight into a certain Stage”, executed per promotion steps steps, such as git-clone → kustomize-set-image → git-commit → git-push (or git-open-pr / git-wait-for-pr) → argocd-update.
PR promotion (this lesson's lab)Kargo
Extra componentsNone (script / CI)Kargo controller, API, UI (official install depends on cert-manager)
VisualizationGit history + PR listPipeline view of Freight flowing between Stages
Promoting multiple artifacts togetherMust ensure consistency yourselfFreight naturally binds multiple artifacts together
Suited forFew services, short environment chainMany services, multiple environments / multiple regions, and a need for a unified promotion strategy

Other related options: Argo CD ApplicationSet's RollingSync (Progressive Syncs, Beta since v3.3, off by default, must be enabled applicationsetcontroller.enable.progressive.syncs; once enabled, generated applications no longer sync automatically) to sync in batches by environment label (Hour 3); in the Flux ecosystem, PRs or Flagger plus a custom pipeline are commonly used. Promotion is a pattern; the tools are replaceable.

Common misconceptions① “dev was updated automatically, so staging/prod should also follow automatically with Image Updater” — automation in upstream environments and promotion to downstream environments are two different things; automatically following the latest version would make prod run a version that was never verified in staging. ② “Promotion means copying the whole dev directory to prod” — environment configuration should not be promoted, only the version. ③ “With Kargo you no longer need Argo CD” — Kargo decides and writes “which version goes to which environment”; syncing is still done by Argo CD.

Architecture diagram: PR-driven environment chain

overlays/devCI PR / Image Updater automatic6.17.0 · auto-merge overlays/stagingPromotion PR · 1 reviewerGate: dev healthy + E2E overlays/prodPromotion PR · CODEOWNERS SREGate: soak + window promote PR promote PR Application podinfo-devRollout + analysis Application podinfo-stagingRollout + analysis Application podinfo-prodRollout + analysis + sync window All Applications track main; environment differences = directory differences; promotion = only changing newTag (or digest)
Figure 7-1 versions move between directories; configuration stays in each directory

Kargo's object model

WarehouseSubscribes to ghcr.io/podinfo Freightpodinfo:6.17.0 Stage devVerification passed Stage stagingPromotion Stage prodManual promotion Promotion steps: git-clone → kustomize-set-image → git-commit → git-push / git-open-pr → argocd-update
Figure 7-2 Kargo makes “which version is in which environment” a first-class object; execution still lands in Git and Argo CD

Interactive board: versions moving through the environment chain

Click “New version arrives” to put a new Freight in, then try to promote. Each environment's gate can be toggled manually; when blocked, the reason is shown; on success, the generated PR diff is shown.

Core commands

CommandPurpose
yq '.images[0].newTag' apps/podinfo/overlays/dev/kustomization.yamlRead the previous environment's version
diff -u overlays/staging overlays/prod / git diff --no-indexCompare environment differences
argocd app get podinfo-dev -o json | jq '.status.health.status, .status.sync.status'Gate: previous environment status
argocd app wait podinfo-staging --health --timeout 600Wait for completion after promotion
gh pr create --label promotion --reviewer org/sreOpen a promotion PR
kargo promote --project P --freight F --stage SStart promotion with the Kargo CLI (parameters per the Kargo docs)
#!/usr/bin/env bash
# Usage: scripts/promote.sh dev staging
set -euo pipefail
FROM=$1; TO=$2; APP=podinfo
SRC=apps/$APP/overlays/$FROM/kustomization.yaml
DST=apps/$APP/overlays/$TO/kustomization.yaml
TAG=$(yq '.images[] | select(.name == "ghcr.io/stefanprodan/podinfo") | .newTag' "$SRC")
CUR=$(yq '.images[] | select(.name == "ghcr.io/stefanprodan/podinfo") | .newTag' "$DST")
[ "$TAG" = "$CUR" ] && { echo "$TO is already $TAG"; exit 0; }

# Gate: previous environment synced and healthy, Rollout completed
read -r SYNC HEALTH <<<"$(argocd app get $APP-$FROM -o json | jq -r '"\(.status.sync.status) \(.status.health.status)"')"
[ "$SYNC/$HEALTH" = "Synced/Healthy" ] || { echo "Gate failed: $APP-$FROM is $SYNC/$HEALTH"; exit 1; }
kubectl argo rollouts status $APP -n $APP-$FROM --timeout 10s >/dev/null

git switch -c promote/$APP-$TO-$TAG
yq -i '(.images[] | select(.name == "ghcr.io/stefanprodan/podinfo") | .newTag) = "'"$TAG"'"' "$DST"
git commit -am "promote: $APP $TAG $FROM -> $TO"
git push -u origin HEAD
gh pr create --base main --label promotion \
  --title "promote $APP $TAG to $TO" \
  --body "From $FROM ($SYNC/$HEALTH). Diff: newTag $CUR -> $TAG"

How to verify:bash -n scripts/promote.sh Check the syntax; run it on dev → staging first. In production this script is usually placed in CI and triggered by dev's on-deployed notification (Webhook → repository_dispatch).

Lab 7: use PRs to promote 6.17.0 from dev to staging, then to prod (about 8 minutes)

Confirm starting point: dev is 6.17.0 (Module 4 Image Updater has upgraded it), staging / prod are 6.16.0.
cd ~/gitops-lab && git switch main && git pull
grep -H newTag apps/podinfo/overlays/*/kustomization.yaml
apps/podinfo/overlays/dev/kustomization.yaml:  newTag: 6.17.0
apps/podinfo/overlays/prod/kustomization.yaml:  newTag: 6.16.0
apps/podinfo/overlays/staging/kustomization.yaml:  newTag: 6.16.0

If dev is still 6.16.0, first manually change dev to 6.17.0 and wait for the Rollout to complete.

Save the promotion script (“Commands” page) and run dev → staging:
mkdir -p scripts && chmod +x scripts/promote.sh && bash -n scripts/promote.sh
git add scripts && git commit -m "add promote script" && git push
./scripts/promote.sh dev staging
Switched to a new branch 'promote/podinfo-staging-6.17.0'
[promote/podinfo-staging-6.17.0 77ab1c2] promote: podinfo 6.17.0 dev -> staging
https://github.com/<you>/gitops-lab/pull/57
Review and merge, and watch staging's canary:
gh pr diff 57
gh pr merge 57 --squash --delete-branch && git switch main && git pull
argocd app get podinfo-staging --refresh >/dev/null
kubectl argo rollouts get rollout podinfo -n podinfo-staging --watch
Verify that the gate blocks: run staging → prod immediately while staging has not finished:
./scripts/promote.sh staging prod
Gate failed: podinfo-staging is Synced/Suspended

When the Rollout is paused, Argo CD health is Suspended and the script refuses to promote. Wait until staging is Healthy, then run it to generate the prod PR.

Extra protection for prod (recommended in GitHub settings): .github/CODEOWNERS Write in apps/podinfo/overlays/prod/ @<you>, and require Code Owner review in main's branch protection. After merging, prod sync is constrained by the Module 6 window.
(Optional) Read the Kargo quick start:docs.kargo.io/quickstart Install Kargo and Argo CD with kind/k3d, and use Warehouse / Stage to manage the same kind of promotion. It requires an extra cert-manager and more memory, so this lesson does not install it in the lab cluster.

Case 1: the “merge hell” of branch-per-environment

Problem: The team used three branches dev/staging/prod; each merge from staging to prod carried along untested configuration changes, and after several incidents no one dared to merge. Fix: Migrated to a single branch with multiple directories; version promotion only changes newTag, and environment configuration changes go through a separate PR validated first in the dev overlay. During migration, each Application's targetRevision is uniformly changed to main.

Case 2: promotion rebuilds cause inconsistent behavior

Problem: The prod pipeline rebuilds docker build, and the base image it depends on was updated between the two builds, so prod and staging were not the same binary. Fix: Build only once; promote the digest; enable immutable tags in the image registry.

Case 3: unified promotion for 40 microservices

Problem: Each service has its own promotion script; approvals are scattered and there is no global view. Fix: Evaluate Kargo: one Warehouse per service, Stage chains templated uniformly, prod Stage set to manual promotion; the pipeline view lets the release manager see at a glance which version is stuck in which environment. The execution layer is still Git commits + Argo CD sync, and the existing Rollouts analysis continues as verification for each Stage.

Common errors and fixes

After the promotion PR is merged, staging has configuration that only dev had

Cause: The promotion copied the whole directory or used a branch merge.

Fix: Promotion should only modify images; use git diff --stat to confirm the PR only changed one line in one file.

yq: Error: … bad file / newTag becomes null after promotion

Cause: Used the Python version of yq (different syntax), or images[].name does not match the selection condition.

yq --version     # requires mikefarah/yq v4
prod PR is merged, but prod stays OutOfSync

Cause: Blocked by a sync window (Module 6), or the prod Application is set to manual sync.

argocd app get podinfo-prod | grep -E 'SyncWindow|Sync Policy'
The gate check says Healthy, but the Rollout is actually Degraded after an abort

Cause: The check was done on the wrong application, or done after the revert; after an abort the Application health is Degraded, never Healthy.

Fix: The gate should also check status.sync.revision is the commit containing that version, and that the Rollout's stable image is the version to be promoted.

Command-line tasks
1. One command to list the current podinfo version in the three environments.
for e in dev staging prod; do printf "%-8s " $e; yq '.images[0].newTag' apps/podinfo/overlays/$e/kustomization.yaml; done
2. Compare the full rendered diff between staging and prod.
diff -u <(kubectl kustomize apps/podinfo/overlays/staging) <(kubectl kustomize apps/podinfo/overlays/prod)
Scenario analysis
A version passed in staging, but the prod canary analysis failed and was aborted. What should you do next? Should staging roll back?

prod: revert the promotion PR in Git (prod goes back to the old version, and the Rollout restores stable directly). staging: no need to roll back automatically, but mark the version as “not promotable” (a PR comment / in Kargo, that Freight no longer promotes to prod), and investigate why staging did not catch the problem (different traffic patterns? different analysis thresholds? data differences?), and strengthen staging's verification. After the fix, release a new version and go through dev → staging → prod again.

Verified teaching video

▶
Kargo - Multi-Stage Deployment Pipelines using GitOps - Jesse Suen / Kent Rancourt — Platform Engineering
English · a talk referenced in the Kargo README, explaining the multi-environment promotion model
▶
Introducing Kargo with Jesse Suen and Kelsey Hightower — Akuity
English · Kargo release introduction (early version, concepts still apply)
▶
Multi Environment Promotions Made Simple | Akuity Webinar — Akuity
English · general patterns of multi-environment promotion and a Kargo demo

Official documentation

Video storyboard (about 80 seconds)

Shot 1 · 0–25s
Visual: three folders dev, staging, prod; a card reading 6.17.0 is stuck in dev.
Narration: environments are directories, versions are cards. Promotion means moving the card to the next directory.
Shot 2 · 25–55s
Visual: the card wants to enter staging; gates light up: dev healthy, tests passed, review passed; entering prod also requires the sync window to turn green.
Narration: each gate is a check; a PR is generated only when all of them pass.
Shot 3 · 55–80s
Visual: Kargo's pipeline view, with a Warehouse producing Freight that flows along the Stages.
Narration: as the number of services grows, promotion itself becomes an object to manage. Execution is still Git commits and Argo CD sync.
Or score ≥ 70% on the quiz

Module 8 · Hours 1–6 Recap and End-to-End Drill

50:00 – 60:00 · Chain hours 1–6 into one path: new image appears → Git change → reconciliation → canary + analysis → notification → promotion
10 minEnd-to-endInteractive troubleshooting tree★★★★★
Learning goals
  • Use one diagram to explain the position and responsibility of every component from hours 1–6 in a release (Repo Server, Application Controller, ApplicationSet, AppProject, secrets, Rollouts, Image Updater, Notifications).
  • Complete an end-to-end drill: Image Updater automatically updates dev → canary analysis passes → notification → PR promotes to staging → prod is constrained by the window.
  • Use the troubleshooting tree to locate where a release gets stuck when it does not proceed as expected.
Prerequisites: Modules 1–7 of this lesson; Hours 1–5. Importance:★★★★★

What: knowledge map of the first six hours

HourTopicRole in a release
1GitOps core, architecture, installationRepo Server renders overlays, Controller compares and syncs, Sync / Health status
2Application in depth, sync controlsync options (ServerSideApply, CreateNamespace), waves / hooks, Webhook for faster discovery
3App of Apps, ApplicationSetPlatform components (Rollouts, Prometheus, Image Updater) and batch management of multi-environment Applications
4Multi-cluster, multi-tenantAppProject limits sources and destinations; RBAC controls who can sync / execute Rollout actions; where sync windows live
5Security and secretsImage Updater's Git write credentials, encrypted storage of the Slack token
6Progressive delivery and automationWho changes Git, how to ramp traffic, when to abort, who is notified, when syncing is allowed, how to promote

Why: each step can fail independently

The longer the chain, the more reasons for “not shipped”: image not pushed, PR not merged, Argo CD did not notice, window blocked, render failed, Rollout paused, analysis errored, notification not subscribed… The key to troubleshooting is in data-flow order confirm each stage in turn, rather than guessing backwards from the final symptom.

How: troubleshooting checkpoints following the data flow

  1. Artifact: does the image tag exist? (crane digest)
  2. Git: is the version in the overlay correct? Was the PR merged? (git log -1 -- apps/podinfo/overlays/dev)
  3. Discovery: the Application's status.sync.revision is the latest commit? (--refresh, Webhook)
  4. Allow: is a sync window blocking? (SyncWindow field)
  5. Render / apply: ComparisonError, SyncError? (argocd app get Conditions)
  6. Release: at which step is the Rollout? Paused / aborted? (kubectl argo rollouts get)
  7. Analysis: AnalysisRun result and measurement value?
  8. Feedback: are notifications subscribed and is the trigger true? (argocd admin notifications trigger run)

When: production readiness review checklist (Hour 6 portion)

  • CI holds no cluster credentials; all version changes are written to Git via PR / controller; image tags are immutable.
  • User-facing services use Rollout + analysis only for the canary; Prometheus is highly available; there is a revert process after an abort.
  • Image Updater is used only for dev or third-party components; git write-back; each application is matched by only one CR.
  • At minimum subscribe on-health-degraded and on-sync-failed; secrets are kept in a Secret.
  • prod has release windows and a freeze policy (in Git); there is a rehearsed break-glass runbook.
  • Promotion only moves verified versions; prod promotion requires Code Owner approval.
Tool-agnostic takeaways To swap this lesson to Flux: Image Updater ↔ image-reflector / image-automation-controller; Rollouts ↔ Flagger; Notifications ↔ notification-controller (Alert / Provider); sync windows ↔ suspending the Kustomization (suspend: true) or external change management. The pattern is the same: Git is the single source of truth, controllers handle convergence, and people make decisions via PRs.

Panorama: components a release passes through

Image registry6.17.0 Image Updater / CIModules 1, 4 GitOps repositoryoverlays/* Repo Serverkustomize build App Controllerdiff · window · sync Rolloutcanary steps AnalysisRunPrometheus success rate Prometheusscrapes podinfo Notificationson-deployed / degraded Promotion PR: dev → staging → prodGates · CODEOWNERS · sync windows (Modules 6, 7) AppProject · RBAC · secretsHours 4, 5: boundaries spanning all stages
Figure 8-1 the version starts from the image registry, returns to the cluster via Git, and results go back to Git via notifications and promotion PRs

End-to-end replay: choose a fault injection point

Choose “no fault” or a fault point, then play, observe at which stage the chain stops, and which command's output you would see it in.

End-to-end check commands (in data-flow order)

# 1 Artifact
crane digest ghcr.io/stefanprodan/podinfo:6.17.0
# 2 Git
git -C ~/gitops-lab log -3 --oneline -- apps/podinfo/overlays
# 3 Discovery
argocd app get podinfo-dev --refresh -o json | jq -r '.status.sync.revision, .status.sync.status, .status.health.status'
# 4 Allow
argocd app get podinfo-prod | grep -E 'SyncWindow|Assigned Windows'
# 5 Render / apply
argocd app get podinfo-dev -o json | jq '.status.conditions'
# 6 Release
kubectl argo rollouts get rollout podinfo -n podinfo-dev
# 7 Analysis
kubectl -n podinfo-dev get analysisrun --sort-by=.metadata.creationTimestamp | tail -3
# 8 Feedback
argocd admin notifications trigger run on-deployed podinfo-dev -n argocd
StageSymptomWhere to look
ArtifactImagePullBackOff / Image Updater cannot find the new tagPod events, updater logs
Discoveryrevision stuck on an old commitstatus.sync.revision, Webhook delivery records
AllowOutOfSync not movingSyncWindow: Sync Denied
ReleaseSuspended for a long timeRollout current step,pause: {}
AnalysisDegradedAnalysisRun measurements
FeedbackNobody knowsSubscription annotations, controller logs

Lab 8: end-to-end drill (about 10 minutes)

Reset starting point: all three environments return to 6.16.0 (one commit); confirm Image Updater, notifications and the load generator are all present:
cd ~/gitops-lab && git switch main && git pull
for e in dev staging prod; do (cd apps/podinfo/overlays/$e && kustomize edit set image ghcr.io/stefanprodan/podinfo:6.16.0); done
git commit -am "e2e: reset all envs to 6.16.0" && git push
kubectl -n argocd get imageupdaters; kubectl get pod -A -l run=loadgen
kubectl -n webhook-sink logs deploy/webhook-sink -f | grep --line-buffered '"body"' &

Note: Image Updater may bump dev back up to 6.17.0 soon after your reset — this is exactly the first step of the drill. The staging / prod canaries can use promote --full to speed up.

Automatic update of dev: wait for the Image Updater commit, and observe dev's canary and background analysis:
watch -n 10 "git -C ~/gitops-lab pull -q; grep newTag ~/gitops-lab/apps/podinfo/overlays/dev/kustomization.yaml"
kubectl argo rollouts get rollout podinfo -n podinfo-dev --watch
Receive notification: after dev is Healthy, the Webhook receiver log shows on-deployed request body (the revision is Image Updater's commit).
Promote to staging: ./scripts/promote.sh dev staging → review and merge → watch the canary and analysis.
Promote to prod (with freeze): add a deny window to the project (manualSync: true, Module 6), run ./scripts/promote.sh staging prod and merge, and confirm prod OutOfSync and Sync Denied; the release is completed by a manual sync by the “on-call SRE”.
Acceptance:
for e in dev staging prod; do printf "%-8s" $e; kubectl -n podinfo-$e get rollout podinfo -o jsonpath='{.status.stableRS} {.spec.template.spec.containers[0].image}{"\n"}'; done
argocd app list -o wide | grep podinfo
dev     7b54f1c9d8 ghcr.io/stefanprodan/podinfo:6.17.0
staging 7b54f1c9d8 ghcr.io/stefanprodan/podinfo:6.17.0
prod    7b54f1c9d8 ghcr.io/stefanprodan/podinfo:6.17.0

The pod-template-hash of the three environments is the same, showing that the templates are consistent (same artifact + same template); if your overlay has environment-specific template patches, the hashes will differ, which is normal.

Cleanup: delete the lab window; kubectl delete pod -A -l run=loadgen; keep Rollouts, Prometheus and notifications for use in Hour 7. When no longer needed: kubectl delete ns webhook-sink.

Case 1: the 40 minutes of “merged but not live”

Problem: On Friday afternoon a prod promotion PR was merged; 40 minutes later customers still saw the old version. The team checked the image first, then the Rollout, and only then found the freeze window that had started before Friday 18:00 (the time zone was written wrong, so it took effect 8 hours early). Lesson: Troubleshoot in data-flow order (the “Allow” step at step 4 reveals it); the window must be written timeZone; in notifications include SyncWindow status.

Case 2: analysis passes but users get errors

Problem: AnalysisRun stays Successful, but a certain API path returns 500 all the time. Cause: That path accounts for less than 1% of traffic, so the overall success rate is still above 99%. Fix: Add independent metrics for critical paths (podinfo's http_request_duration_seconds_count with path labels can be computed per path), and pair them with a synthetic probe Job as a second metric.

Case 3: the “last mile” after automating everything

Problem: dev and staging are fully automated, but prod promotion PRs often go unhandled and pile up. Fix: dev's on-deployed notification triggers CI to automatically generate the staging PR; after staging passes, it automatically generates the prod PR and @-mentions the on-call SRE; the PR template attaches links to the dev/staging analysis results. People only need to make a well-informed decision.

Interactive troubleshooting tree: a release did not proceed as expected

Select level by level starting from the symptom to get diagnostic commands and fix suggestions.

Command-line tasks
1. In one go, view the commit podinfo-dev currently tracks, its sync status and its health status.
argocd app get podinfo-dev --refresh -o json | jq -r '.status.sync.revision, .status.sync.status, .status.health.status'
2. View the stable ReplicaSet hash of the Rollout in the three environments.
for e in dev staging prod; do kubectl -n podinfo-$e get rollout podinfo -o jsonpath='{.metadata.namespace} {.status.stableRS}{"\n"}'; done
Scenario analysis
A new colleague asks: “Since AnalysisRun rolls back automatically, why do we still need staging? Can't we just go dev → prod?” How do you answer?

Canary analysis can only catch “problems visible in a small part of real traffic, using defined metrics”, and it has a blast radius (that subset of users is already affected). Staging provides: a complete environment close to production without real users; destructive / long-running tests (migration, load test, E2E); and verification of configuration differences. The two are complementary layers of defense: staging tries to catch problems before users do, and the canary limits the problems that slip through to a small scope and automatically stops the damage.

Verified teaching video

▶
Tutorial: Progressive Delivery with Argo Rollouts — CNCF [Cloud Native Computing Foundation]
English · reviews the full progressive delivery flow
▶
How To Do Canary Deployments In Kubernetes Using Flagger And Linkerd? — DevOps & AI Toolkit
English · Flagger's approach, which can be compared with this lesson's Rollouts to understand “same pattern, different tools”

Official documentation

Video storyboard (about 90 seconds)

Shot 1 · 0–30s
Visual: components in the panorama light up in turn: image registry, Image Updater, Git, Argo CD, Rollout, Prometheus, notifications, promotion PR.
Narration: a release passes through eight stages, and each stage has its own status.
Shot 2 · 30–60s
Visual: a red light comes on at the “Allow” stage, with SyncWindow: Sync Denied beside it.
Narration: when troubleshooting, move forward along the data flow; the first abnormal stage is the answer.
Shot 3 · 60–90s
Visual: the hashes of the three environments are identical, with green checkmarks.
Narration: the same artifact, verified layer by layer, reaches production. This is progressive delivery.
Or score ≥ 70% on the quiz

Command cheat sheet

Commands, fields and defaults used in Hour 6
Printable
CI → Git (Modules 1, 7)
kustomize edit set image ghcr.io/stefanprodan/podinfo:6.17.0
yq -i '.images[0].newTag = "6.17.0"' kustomization.yaml
argocd app diff podinfo-dev --revision BRANCH
gh pr create --base main --label promotion
gh pr merge --squash --auto
./scripts/promote.sh dev staging
Argo Rollouts (Modules 2, 3)
kubectl argo rollouts get rollout podinfo -n NS --watch
kubectl argo rollouts status podinfo -n NS --timeout 3m
kubectl argo rollouts promote podinfo -n NS [--full]
kubectl argo rollouts abort podinfo -n NS
kubectl argo rollouts retry rollout podinfo -n NS
kubectl argo rollouts dashboard          # :3100
kubectl -n NS get analysisrun
argocd app actions run APP resume --kind Rollout --resource-name podinfo
Image Updater (Module 4)
kubectl -n argocd get imageupdaters
kubectl -n argocd logs deploy/argocd-image-updater-controller
argocd-image-updater test IMAGE --semver-constraint 6.x
# method: argocd | git | git:secret:NAME | git:repocreds
# writeBackTarget: kustomization[:path] | helmvalues[:path]
# branch: "main:image-updater-{{.SHA256}}"
Notifications (Module 5)
argocd admin notifications trigger get -n argocd
argocd admin notifications template get -n argocd
argocd admin notifications trigger run on-deployed APP -n argocd
argocd admin notifications template notify TPL APP --recipient SVC:RCPT -n argocd
# subscription annotation: notifications.argoproj.io/subscribe.TRIGGER.SERVICE: RECIPIENT
Sync windows and break-glass (Module 6)
argocd proj windows list PROJ
argocd proj windows add PROJ --kind deny --schedule "0 18 * * 5" \
  --duration 62h --applications "*" --time-zone "Asia/Shanghai"
argocd proj windows enable-manual-sync PROJ ID
argocd app get APP | grep SyncWindow
# break-glass prerequisite: ignoreApplicationDifferences: /spec/syncPolicy in the ApplicationSet
argocd app set APP --sync-policy none
argocd app diff APP --refresh               # after write-back, confirm zero diff
Key defaults
FieldDefault
failureLimit0 (no failures tolerated)
consecutiveErrorLimit4
consecutiveSuccessLimit0 (disabled, v1.8+)
Blue-green scaleDownDelaySeconds30
abortScaleDownDelaySeconds30
Image Updater strategy / write-backsemver / argocd
Webhook notifications retryMax3
Sync window time zoneUTC

Quick reference for verdict rules

ObjectRule
AnalysisRunSuccessful → continue; Failed / Error → abort; Inconclusive → pause and wait for a human
Rollout health (Argo CD)Paused → Suspended; aborted → Degraded; complete → Healthy
Sync windowNo match → allow; has allow → allow only during the active allow period; active deny → forbid; deny takes precedence; manualSync allows manual bypass
Canary without traffic routingweight ≈ canary replicas / total replicas
PromotionOnly move verified versions (preferably by digest); do not move environment configuration

Capstone lab + final quiz

Build a complete delivery chain for podinfo: automatic discovery of new versions → canary + metric analysis → notification → PR promotion → production window
Post-class ≈ 40 minIntegrate all modules
Scenario The platform team needs podinfo to deliver the following capabilities: dev automatically follows upstream 6.x patch and minor versions; new versions in any environment are released as canaries and automatically judged by the Prometheus success rate; both successful deployments and degradations are sent to the team's Webhook; staging / prod can only be entered via promotion PRs; prod is frozen on weekends, and in emergencies only the on-call SRE can sync manually. Complete this in the kind cluster lab and gitops-lab repositories; all configuration must be in Git.
Platform components in Git (prep, Module 4): argocd/apps/ contains three Applications — argo-rollouts (2.43.12), prometheus (29.47.2), argocd-image-updater (1.5.0) — all Synced / Healthy.
argocd app list -o wide | grep -E 'argo-rollouts|prometheus|image-updater'
Rollout + analysis (Modules 2, 3): the Rollout in base includes background analysis success-rate, the query targets only the canary hash and the current namespace; all three environments have a traffic source (load generator or real traffic). Verify in dev with a “bad version” that it gets aborted, then revert.
Environment differentiation (Modules 2, 7): in the prod overlay, use a JSON patch to change the first pause to 5m (op: replace,path: /spec/strategy/canary/steps/1/pause/duration), keep dev at 2m. Use diff -u <(kubectl kustomize …/staging) <(kubectl kustomize …/prod) to confirm there are only the expected differences.
Image automation (Module 4): ImageUpdater CR podinfo-dev placed in Git (for example argocd/image-updaters/, managed by one Application), git write-back to dev's kustomization; confirm that staging / prod are not matched by any CR.
Notifications (Module 5): on-deployed (oncePer revision),on-health-degraded,on-sync-failed three triggers written in bootstrap/argocd-values.yaml; the three podinfo Applications all subscribe to the local Webhook via annotations. Verify with argocd admin notifications trigger run .
Freeze and permissions (Module 6): add to the project platform a window of “62-hour deny starting Friday 18:00, manualSync: true, timeZone Asia/Shanghai”; (optional, requires Hour 4 RBAC) only role:sre holding applications, sync, platform/podinfo-prod permission.
Promotion (Module 7): scripts/promote.sh in Git; on GitHub configure CODEOWNERS for apps/podinfo/overlays/prod/ . Run a full dev → staging → prod pass.
break-glass drill (Module 6): on staging, run once the flow “turn off automatic sync → kubectl fix → write back to Git → zero diff → restore”, and record the incident number in the PR description.
Acceptance checklist

Open self-test (answer first yourself, then expand the reference answers)

1. Why is the interface between CI and CD in GitOps “one PR that changes Git”?

CI produces immutable artifacts and proposes changes to the desired state; review, audit and rollback all rely on Git; CD (the in-cluster controller) only reads Git and converges the cluster. This way cluster credentials never leave the cluster, the deployment history is the commit history, and rollback is a revert.

2. Without traffic routing, what does a canary setWeight: 20 look like with 4 replicas? How do you get an exact ratio?

The controller approximates by replica ratio, choosing the integer with the smallest difference: 20% × 4 = 0.8, about 1 canary Pod, an actual share of about 25%. For an exact ratio, configure trafficRouting (NGINX, Istio, Gateway API plugins, etc.) and set canaryService / stableService; then stable keeps full replicas.

3. What effect does AnalysisRun's Failed, Error and Inconclusive each have on the Rollout?

Failed (failure count exceeds failureLimit) and Error (consecutive errors exceed consecutiveErrorLimit, default 4) both cause an abort: traffic returns to stable and the Rollout is Degraded; Inconclusive pauses the Rollout, waiting for a manual promote or abort.

4. How do you choose between Image Updater's argocd write-back and git write-back?

argocd write-back directly modifies the Application in the cluster; it is pseudo-persistent and gets overwritten when the Application is managed by Git, which does not conform to GitOps; git write-back commits to the repository (kustomization / Helm values / .argocd-source files), is auditable and revertable, and is the recommended approach; it needs Git write credentials.

5. Which scenarios suit self-heal versus alert-only drift policies? What are the wrap-up steps of break-glass?

Self-heal suits most environments and enforces Git as the single source of truth; alert-only suits migration periods or systems with concerns about automatic reversion, discovering drift via OutOfSync notifications / metrics. Break-glass wrap-up: write the cluster fix as a PR and merge it,argocd app diff zero diff, restore (the root application's) automatic sync, and do a retrospective.

6. What should promotion move and what should it not move? What problem does Kargo solve?

Only move verified artifact versions (preferably the digest), do not move environment configuration, and do not rebuild. Kargo models promotion as Warehouse / Freight / Stage / Promotion, providing multi-artifact binding, unified promotion steps and a pipeline view, suited to many services and long environment chains; execution is still Git commits and Argo CD sync.

Final quiz (12 questions, covering all modules)

Sources and Version Notes

Basis for verifying the technical facts in this lesson (verification date: 2026-11-17)
TopicVerified conclusionSource (accessed 2026-11-17)
Argo CDLatest stable v3.6.1 (2026-11-04); Helm chart argo/argo-cd 10.18.0 (appVersion v3.6.1); notifications enabled by default; the chart's templates / triggers are empty by defaultargo-cd releases · argo-helm index · argo-cd values.yaml
Argo Rolloutsv1.10.2 (2026-11-04) is the latest stable; v1.11.0-rc1 is a pre-release; chart argo/argo-rollouts 2.43.12; failureLimit default 0, consecutiveErrorLimit default 4, scaleDownDelaySeconds / abortScaleDownDelaySeconds default 30; consecutiveSuccessLimit since v1.8; without traffic routing the weight is approximated by replica ratio; the core no longer accepts new traffic providers (pluginized)releases · Analysis · Canary · Traffic Management · v1.10.2 source code utils/defaults/defaults.go
Argo CD support for RolloutsHealth check: Paused → Suspended; resource actions restart / resume / abort / retry / pause / promote-full / skip-current-stepargo-cd v3.6.1 resource_customizations/argoproj.io/Rollout/ (health.lua, actions/discovery.lua)
Argo CD Image Updaterv1.5.0 (2026-11-12); 0.x maintenance release v0.19.0; since 1.0.0 (2025-11) changed to ImageUpdater CRD (argocd-image-updater.argoproj.io/v1alpha1); strategies semver / newest-build / digest / alphabetical / calver; write-back argocd (default) / git; writeBackTarget; write-back branch template; supports only Helm / Kustomize / Plugin; chart argo/argocd-image-updater 1.5.0; recommended to install in the Argo CD namespacereleases · Documentation(applications, update-methods, update-strategies, installation)
Notificationstrigger / template / service / subscription structure; list of catalog triggers; Webhook service parameters and retry defaults (retryMax 3); oncePer; self-service notificationsNotifications · Webhook · Catalog
Sync Windowsallow / deny decision rules, deny precedence, manualSync, timeZone, syncOverrun, AND option; CLI argocd proj windowsSync Windows(v3.6.1 documentation source)
Prometheuschart prometheus-community/prometheus 29.47.2 (Prometheus v3.16.0); default scrape_interval 1m; kubernetes-pods job scrapes by annotation and labelmaps Pod labels; kube-prometheus-stack 93.3.1prometheus-community/helm-charts(values.yaml, index.yaml)
podinfo6.17.0 (2026-10-26), 6.16.0; metrics http_requests_total{status} and http_request_duration_seconds{method,path,status}; --port-metrics independent metrics server (including /healthz); --random-error (about 1/3 of requests return 500/400/409, applied to all routes on the main port); environment variable prefix PODINFO_podinfo 6.17.0 source code (pkg/api/http/metrics.go, http.go, server.go; cmd/podinfo/main.go)
Kargov1.12.6 (2026-11-16), Akuity open source; Warehouse / Freight / Stage / Promotion; promotion steps include git-clone, kustomize-set-image, git-commit, git-push, git-open-pr, git-wait-for-pr, argocd-update, etc.kargo releases · Promotion Steps
Flux / FlaggerFlux v2.10.0; image-reflector-controller and image-automation-controller v1.3.0 (API image.toolkit.fluxcd.io/v1); Flagger v1.45.0 (2026-09-01)flux2 · image-automation-controller · flagger
Kustomize behaviorimages: transformations apply to Rollout; replicas: field only supports Deployment / StatefulSet / ReplicaSet / ReplicationController (verified with local kustomize v5.0.1)Local kubectl kustomize Verified · Rollouts Kustomize Integration
helper imagecurlimages/curl:8.23.0,mendhak/http-https-echo:43 tag existsDocker Hub tag list

Video verification note

The following videos had their titles and channels verified via the YouTube oEmbed API on 2026-11-17: TechWorld with Nana, “What is GitOps, How GitOps works and Why it's so useful” (f5EpcWp0THw); DevOps Journey, “Argo Rollouts in 15 minutes!” (w3xdopP4aEk); CNCF, “Tutorial: Progressive Delivery with Argo Rollouts” (tnB0TwEqNFA); Geert Baeke, “A blue-green deployment with Argo Rollouts and Kustomize” (ArCu7Wi0AJY); CNCF, “Stop Deploying Blind! Using Observability and Argo Rollouts to Light the Way - Kostis Kapelonis” (oeHdkvVKAZE); DevOps & AI Toolkit, “GitOps Without Pipelines With ArgoCD Image Updater” (avPUQin9kzU) and “How To Do Canary Deployments In Kubernetes Using Flagger And Linkerd?” (NrytqS43dgw); Anton Putra, “ArgoCD Notifications (Successful/Failed Deployments)” (OP6IRsNiB4w); mkdev, “Argo CD Self-Heal, Sync Windows and Diffing” (I77xIKNaNRg); Platform Engineering, “Kargo - Multi-Stage Deployment Pipelines using GitOps - Jesse Suen / Kent Rancourt” (0B_JODxyK0w); Akuity, “Introducing Kargo with Jesse Suen and Kelsey Hightower” (yaZc0DdeLKk) and “Multi Environment Promotions Made Simple | Akuity Webinar” (bFXxvvM-jcQ). oEmbed does not return duration or publish date, so no duration is shown on the cards. All videos are in English, and most were recorded before this lesson's version baseline (especially the Image Updater video, which uses the pre-1.0 annotation configuration); configuration details follow this lesson and the official docs.

Voice narration note

The “Voice” tab uses the browser's Web Speech API (speechSynthesis, en-US) to read the narration aloud in real time, with English terms pronounced in en-US; the result depends on the voices installed on the operating system. This courseware does not embed an MP3; when offline audio is needed, the narration script can be given to a TTS service to generate it.

Known limitations

  • The commands in this lesson have not been run one by one on a real kind cluster; all “expected outputs” are compiled from the official docs and source code as examples, and name suffixes, hashes, commit IDs, times and values depend on your environment. The only items that can be verified by running locally are the kustomize renders (the Rollout images transformation and the replicas restriction were verified).
  • The Image Updater controller's Deployment name, log text and the Helm chart's default watch scope change across versions (the official docs now state that the default is to watch only its own namespace); refer to kubectl -n argocd get deploy and the chart README. The check interval is controlled by --interval , and this lesson does not assert a specific default value.
  • argocd admin notifications template notify of --recipient uses the format “service:recipient”; where the Webhook has no recipient, this lesson writes local:, and if the CLI reports a format error, refer to --help.
  • Rollouts' fieldRef: metadata.namespace parameter syntax follows the general use of fieldRef in the documentation (the documentation examples use the labels and status fields); if it is unavailable, pass the namespace value directly with a patch in each overlay.
  • Without traffic routing, the canary ratio is affected by replica count and connection reuse; the podinfo random errors use a random number seeded by the second, so results may appear in clusters over a short time, and the success rate can fluctuate significantly.
  • Kargo is not installed in the lab cluster for demonstration; only the model and step names are introduced. The action versions in the GitHub Actions snippets follow the official GitHub documentation.
  • The times, ratios and measurement values in the animations are illustrative, used to explain the mechanism, and are not the controller's exact behavior.