Argo CD Hour 7: Scaling, High Availability, and Deep Troubleshooting

From “it works” to “it holds up”: HA installation, controller sharding, repo-server caching and timeouts, metrics and alerts. Then we inject, diagnose, and fix the most common production failures one by one: OutOfSync loops, sync failures, ComparisonError, stuck deletion, Webhooks that don't fire, and upgrade pitfalls.
Argo CD v3.6.1chart argo-cd 10.18.0kind v0.33.0 · K8s v1.37.0Parameters and error messages verified against v3.6.1 source codeThis lesson deliberately breaks the lab environment
Overall learning objectives
  • Using the official Helm chart's HA values (redis-ha, server / repo-server / ApplicationSet replicas, PDB, HPA) to deploy Argo CD, and explain whether each component can,how scale horizontally — especially why the application controller uses per-cluster sharding instead of multi-replica leader election.
  • Configure controller sharding: ARGOCD_CONTROLLER_REPLICAS,controller.sharding.algorithm (legacy / round-robin / consistent-hashing), the cluster Secret's shard shard field, dynamic cluster distribution (alpha), and verify with argocd admin cluster stats .
  • Tune processing capacity: controller.status.processors (default 20),controller.operation.processors (default 10),controller.kubectl.parallelism.limit (default 20),timeout.reconciliation (120s + 60s jitter),controller.repo.server.timeout.seconds (default 60).
  • Understand repo-server's manifest cache (keyed by commit SHA, default 24h),ARGOCD_EXEC_TIMEOUT (default 90s),--parallelismlimit,argocd.argoproj.io/manifest-generate-paths, the single-repo (monorepo) lock, and Manifest generation error (cached).
  • Monitor Argo CD with Prometheus: three /metrics endpoints (8082 / 8083 / 8084),argocd_app_info,argocd_app_reconcile,argocd_git_request_total,workqueue_depth,argocd_kubectl_exec_pending, and write 5 useful alerts.
  • System troubleshooting: OutOfSync loops (fields with defaults, mutating webhooks, HPA replica counts, CRD defaults, SSA field ownership), sync failures,ComparisonError, stuck deletion, and resources-finalizer.argocd.argoproj.io, orphaned resources, Webhooks that don't fire, and repo-server timeouts.
  • Complete the v2 → v3 upgrade assessment, the chart upgrade, and disaster recovery: argocd admin export/import and “declarative rebuild from Git.”

1-hour time allocation table

#TimeModuleCore contentAnimation / interactionLab (kind cluster lab, namespaces argocd / faults)
0Before classPreparation: fault-injection environmentfault-lab app,fault-box.sh inject / reset scripts, metrics endpointsEnvironment self-check listDeploy baseline fault-lab (Synced / Healthy)
100–06HA deployment and component scalingchart HA values, redis-ha + HAProxy, per-component replica policies, PDB, anti-affinityHA topology “unplug” simulator“Teaching-version HA” on a single-node kind; delete Pods and observe
206–13Controller sharding and performance tuningSharding algorithm, shard field, processors, kubectl concurrency, reconciliation period and jitterCore animation: how controller sharding splits clusters2-replica sharding + admin cluster stats
313–21Repo Server: caching, timeouts, and manifest generationCache key, 24h expiry, exec timeout, concurrency limits, monorepo lock, manifest-generate-pathsManifest generation pipeline simulatorInject a 1ms timeout → read the error → reset
421–28Monitoring Argo CDMetrics endpoints, key metrics, ServiceMonitor, dashboards, alert rules, log fieldsAlert firing simulatorcurl the three endpoints + write a PrometheusRule
528–35OutOfSync loops and sync failuresDrift sources, diff normalization, ignoreDifferences, RespectIgnoreDifferences, SSA / Server-Side Diff, ComparisonErrorCore animation: diagnosing the causes of OutOfSync loopsHPA fights over replica count → diagnose → two fixes
635–42Stuck deletion, finalizers, and orphaned resourcesCascading delete, foreground / background, non-cascading, child-resource finalizers, orphaned-resource alertsDeletion state machine simulatorChild-resource finalizer blocks deletion, then release it
742–50Upgrades and disaster recoveryv2 → v3 breaking changes, read the upgrade notes for each minor version, chart upgrade, export / import, rebuild from Gitv3 upgrade impact scannerExport → delete → import to restore
850–60Mixed fault mystery box8 random faults injected, located by symptom, fixed, and reviewedIn-browser mystery box + interactive troubleshooting treefault-box.sh random
—After classCheat sheet · Capstone lab“Production readiness review”: HA + sharding + alerts + disaster-recovery drillFinal quiz (12 questions)Capstone lab

Knowledge Coverage Matrix

Target skillM1M2M3M4M5M6M7M8Key commands / configurationLab
HA deployment and component scaling✓✓✓···✓·redis-ha.enabled,*.replicas, PDBM1 delete Pod
controller sharding and tuning✓✓·✓···✓controller.sharding.algorithm,admin cluster statsM2 two replicas
repo-server caching and timeouts··✓✓✓··✓ARGOCD_EXEC_TIMEOUT,--hard-refreshM3 timeout injection
Metrics, alerts, and logs·✓✓✓✓·✓✓:8082/metrics, PrometheusRuleM4 alert rules
OutOfSync loop diagnosis···✓✓·✓✓argocd app diff, managedFields,ignoreDifferencesM5 HPA fights over fields
Sync failures and ComparisonError··✓✓✓··✓argocd app get --show-operationM5 / M8
Deletion, finalizers, orphaned resources·····✓✓✓--cascade,--propagation-policy,orphanedResourcesM6 stuck deletion
Webhook triggering··✓✓···✓/api/webhook,webhook.github.secretM3 / M8 simulated push via curl
Upgrades and disaster recovery✓·····✓·argocd admin export/import,helm upgradeM7 restore drill

Topics not covered in this lesson (and where to learn them)

TopicWhy it's not in this lessonWhere to learn it
Basic usage of Application, sync policies, Sync Waves, and hooksThis lesson only covers what to do when they failLesson 1,Lesson 2
Multi-cluster registration, AppProject, RBAC, SSOUsed directly in this lesson lab2 and team-a outputsLesson 4
Prometheus / Grafana itself (installation, PromQL, Alertmanager routing)This lesson only provides the Argo CD-side metrics and rulesPrometheus & Grafana: 8 + 1 hour
Pod-level troubleshooting (CrashLoopBackOff, scheduling, probes)Belongs to Kubernetes itselfKubernetes: 8 + 1 hour
Helm's SSA, stuck releases, etc.That is Helm's own state machineHelm: 8 hours Lesson 7
50 production cases, 50 interview questionsLesson 8 (optional)Lesson 8

How to use this courseware

10 pages per module
Theory · diagrams · animations · commands · labs · production cases · troubleshooting · quizzes · audio · video. The labs in this lesson follow “inject → observe → diagnose → fix → reset” five steps, with the faults all concentrated in fault-lab the app and faults namespaces, and they do not touch the podinfo app from earlier lessons.
Learning progress
A quiz score of 70% or more, or clicking “Mark this module complete,” counts toward progress. Progress is saved in this browser (cleared on refresh if local storage is disabled).
Chinese audio
The “Audio” page uses the browser's Web Speech API (en-US) to read the narration aloud; English terms are pronounced with en-US. Without a Chinese voice pack, the narration is still readable.
Version notes This lesson is based on Argo CD v3.6.1 (released 2026-11-04) and the official chart argo-cd 10.18.0 (appVersion v3.6.1) as the baseline; parameter defaults are checked against v3.6.1's argocd-cmd-params-cm.yaml, command reference, and source code (controller/sharding,controller/state.go,gitops-engine/pkg/sync,util/webhook,util/exec), verified on 2026-11-17. The maintained patch lines also include 3.5.x, 3.4.x, and 3.3.x. Times, hashes, Pod suffixes, and durations in sample output are example values. Error messages that can be found directly in the source are quoted verbatim; parts that include runtime details (such as the API Server response) are marked “verify against your actual output.”

Module 0 · Preparation: fault-injection environment

Create a new app, fault-lab, in the lab kind cluster, dedicated to being “broken,” and prepare an injectable / resettable script, fault-box.sh. The podinfo app from earlier lessons is not affected.
Before class ≈ 15 minutesArgo CD v3.6.1 · chart 10.18.0Local lab, zero cost
Prerequisites
  • Tools: kind v0.33.0 (node image kindest/node:v1.37.0), kubectl, Helm 4, argocd CLI v3.6.x, git, jq, openssl, curl.
  • Continuity from the previous lesson: in Lesson 1 you installed the chart argo/argo-cd as the release argocd (namespace argocd, values in ~/gitops-lab/bootstrap/argocd-values.yaml); in Lesson 4 you registered a second cluster lab2 (used only in Module 2 and fault F8; you can complete this lesson without it); in Lesson 3, podinfo-dev / staging / prod were generated by ApplicationSet podinfo (project platform, which can only be changed at the template layer); in Lesson 6 you replaced podinfo's base with an Argo Rollout (canary + AnalysisTemplate) and installed Argo Rollouts v1.10.2 and the slim prometheus chart (Module 4 uses it to scrape Argo CD metrics), Notifications, and the project platform sync windows and Image Updater. All of these are kept; this lesson's faults are injected only into the separate fault-lab, so they will not interfere with them (podinfo showing Suspended while a Rollout is paused is normal).
  • If you don't have the previous lesson's results: follow the “minimum starting point” below to set up a working environment in 5 minutes.

Minimum starting point (if you have no results from earlier lessons)

kind create cluster --name lab --image kindest/node:v1.37.0
helm repo add argo https://argoproj.github.io/argo-helm && helm repo update
mkdir -p ~/gitops-lab/bootstrap && touch ~/gitops-lab/bootstrap/argocd-values.yaml
helm upgrade --install argocd argo/argo-cd -n argocd --create-namespace \
  --version 10.18.0 -f ~/gitops-lab/bootstrap/argocd-values.yaml --wait
# Open another terminal and keep the port-forward running
kubectl -n argocd port-forward svc/argocd-server 8080:443
argocd login localhost:8080 --insecure --username admin \
  --password "$(kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d)"

~/gitops-lab Must be your own GitHub repository gitops-lab local clone (default branch main, and able to git push); if the repository is private, first follow Lesson 1 argocd repo add to register credentials.

Step 1: Check tools, cluster, and Argo CD versions

kind get clusters
kubectl config use-context kind-lab
argocd version --short
helm -n argocd list
kubectl -n argocd get deploy,sts
lab
lab2
Switched to context "kind-lab".
argocd: v3.6.1+<commit>
argocd-server: v3.6.1+<commit>
NAME     NAMESPACE  REVISION  STATUS    CHART            APP VERSION
argocd   argocd     7         deployed  argo-cd-10.18.0  v3.6.1
NAME                                               READY   UP-TO-DATE   AVAILABLE
deployment.apps/argocd-applicationset-controller   1/1     1            1
deployment.apps/argocd-dex-server                  1/1     1            1
deployment.apps/argocd-notifications-controller    1/1     1            1
deployment.apps/argocd-redis                       1/1     1            1
deployment.apps/argocd-repo-server                 1/1     1            1
deployment.apps/argocd-server                      1/1     1            1
NAME                                             READY
statefulset.apps/argocd-application-controller   1/1

Note: the controller is a StatefulSet (Pod names end with -0,-1 ending with the shard number), and all other components are Deployments.

Step 2: Enable the metrics service for this lesson and set the Webhook secret

Add the content below by appending to ~/gitops-lab/bootstrap/argocd-values.yaml (if the same key already exists, merge instead of duplicating):

# ===== Lesson 7 =====
controller:
  metrics:
    enabled: true          # Service argocd-application-controller-metrics:8082
server:
  metrics:
    enabled: true          # Service argocd-server-metrics:8083
repoServer:
  metrics:
    enabled: true          # Service argocd-repo-server-metrics:8084
configs:
  secret:
    githubSecret: lab-secret   # written to webhook.github.secret in argocd-secret
  params:
    controller.status.processors: 20      # explicitly set the default; compare against it when tuning later
    controller.operation.processors: 10
    controller.kubectl.parallelism.limit: 20
helm upgrade argocd argo/argo-cd -n argocd --version 10.18.0 \
  -f ~/gitops-lab/bootstrap/argocd-values.yaml --wait
kubectl -n argocd get svc | grep metrics
argocd-application-controller-metrics   ClusterIP   10.96.120.11   <none>   8082/TCP   15s
argocd-repo-server-metrics              ClusterIP   10.96.33.207   <none>   8084/TCP   15s
argocd-server-metrics                   ClusterIP   10.96.81.5     <none>   8083/TCP   15s

Step 3: Save the fault-injection script fault-box.sh

The script only operates on apps/faults/,argocd/apps/fault-lab.yaml, the namespace faults, and argocd a few resettable settings in that namespace (repo-server environment variables, the controller replica-count environment variable, the Webhook secret, and lab2's shard field). Each fault can be undone with reset the reset command.

#!/usr/bin/env bash
# fault-box.sh —— Argo CD Lesson 7 fault-injection toolbox (affects only the fault-lab app and the faults namespace)
# Usage: fault-box.sh init | list | inject F1..F8 | random | reveal | reset
set -euo pipefail
REPO_DIR="${REPO_DIR:-$HOME/gitops-lab}"
REPO_URL="${REPO_URL:?Please export REPO_URL first, e.g. https://github.com/<you>/gitops-lab}"
STATE="$HOME/.fault-box"; mkdir -p "$STATE"
APP=fault-lab; NS=faults; AD=argocd
log(){ printf '\033[36m[fault-box]\033[0m %s\n' "$*"; }

push(){
  (cd "$REPO_DIR" && git add -A apps/faults argocd/apps/fault-lab.yaml \
     && { git commit -qm "$1" || true; } && git push -q origin main)
}

baseline(){
  mkdir -p "$REPO_DIR/apps/faults" "$REPO_DIR/argocd/apps"
  cat > "$REPO_DIR/apps/faults/kustomization.yaml" <<'EOF'
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: faults
resources:
  - deployment.yaml
  - service.yaml
  - configmap.yaml
EOF
  cat > "$REPO_DIR/apps/faults/deployment.yaml" <<'EOF'
apiVersion: apps/v1
kind: Deployment
metadata:
  name: faulty
  labels: {app: faulty}
spec:
  replicas: 2
  selector:
    matchLabels: {app: faulty}
  template:
    metadata:
      labels: {app: faulty}
    spec:
      containers:
        - name: podinfo
          image: ghcr.io/stefanprodan/podinfo:6.17.0
          ports:
            - containerPort: 9898
          env:
            - name: PODINFO_UI_MESSAGE
              value: "hello from git"
          resources:
            requests: {cpu: 20m, memory: 32Mi}
            limits: {memory: 128Mi}
EOF
  cat > "$REPO_DIR/apps/faults/service.yaml" <<'EOF'
apiVersion: v1
kind: Service
metadata:
  name: faulty
spec:
  selector: {app: faulty}
  ports:
    - port: 9898
      targetPort: 9898
EOF
  cat > "$REPO_DIR/apps/faults/configmap.yaml" <<'EOF'
apiVersion: v1
kind: ConfigMap
metadata:
  name: faulty-config
data:
  mode: baseline
EOF
  cat > "$REPO_DIR/argocd/apps/fault-lab.yaml" <<EOF
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: fault-lab
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: default
  source:
    repoURL: ${REPO_URL}
    targetRevision: main
    path: apps/faults
  destination:
    server: https://kubernetes.default.svc
    namespace: faults
  syncPolicy:
    automated: {prune: true, selfHeal: true}
    syncOptions: [CreateNamespace=true]
EOF
}

lab2_secret(){
  kubectl -n $AD get secret -l argocd.argoproj.io/secret-type=cluster \
    -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.data.name}{"\n"}{end}' |
  while read -r n d; do
    if [ "$(printf '%s' "$d" | base64 -d)" = "lab2" ]; then echo "$n"; fi
  done
}

simulate_push(){   # Sign a push event with the old key “lab-secret”, which GitHub still uses
  local body sig
  body=$(printf '{"ref":"refs/heads/main","after":"%s","repository":{"html_url":"%s","default_branch":"main"},"commits":[]}' \
    "$(cd "$REPO_DIR" && git rev-parse HEAD)" "$REPO_URL")
  sig=$(printf '%s' "$body" | openssl dgst -sha256 -hmac "lab-secret" | awk '{print $NF}')
  curl -sk -o /dev/null -w 'webhook -> HTTP %{http_code}\n' https://localhost:8080/api/webhook \
    -H 'Content-Type: application/json' -H 'X-GitHub-Event: push' \
    -H "X-Hub-Signature-256: sha256=$sig" -d "$body"
}

inject(){
  echo "$1" > "$STATE/current"
  case "$1" in
    F1) kubectl -n $NS apply -f - <<'EOF'
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata: {name: faulty}
spec:
  scaleTargetRef: {apiVersion: apps/v1, kind: Deployment, name: faulty}
  minReplicas: 3
  maxReplicas: 5
  metrics:
    - type: Resource
      resource: {name: cpu, target: {type: Utilization, averageUtilization: 80}}
EOF
        ;;
    F2) nohup bash -c "while true; do kubectl -n $NS set env deploy/faulty PODINFO_UI_MESSAGE='mutated by robot' >/dev/null 2>&1; sleep 20; done" >/dev/null 2>&1 &
        echo $! > "$STATE/mutator.pid" ;;
    F3) printf '  - missing.yaml\n' >> "$REPO_DIR/apps/faults/kustomization.yaml"; push "fault: change" ;;
    F4) cat > "$REPO_DIR/apps/faults/extra-service.yaml" <<'EOF'
apiVersion: v1
kind: Service
metadata: {name: faulty-extra}
spec:
  type: Invalid
  selector: {app: faulty}
  ports: [{port: 80, targetPort: 9898}]
EOF
        printf '  - extra-service.yaml\n' >> "$REPO_DIR/apps/faults/kustomization.yaml"; push "fault: change" ;;
    F5) kubectl -n $AD set env deploy/argocd-repo-server ARGOCD_EXEC_TIMEOUT=1ms
        kubectl -n $AD rollout status deploy/argocd-repo-server --timeout=120s
        argocd app get $APP --hard-refresh >/dev/null 2>&1 || true ;;
    F6) kubectl -n $NS patch configmap faulty-config --type merge \
          -p '{"metadata":{"finalizers":["faults.example.com/hold"]}}'
        argocd app delete $APP --cascade --yes ;;
    F7) kubectl -n $AD patch secret argocd-secret --type merge \
          -p '{"stringData":{"webhook.github.secret":"rotated-but-not-in-github"}}'
        simulate_push ;;
    F8) S=$(lab2_secret); [ -n "$S" ] || { log "lab2 cluster not found: F8 requires lab2 from Lesson 4"; exit 1; }
        kubectl -n $AD patch secret "$S" --type merge -p '{"stringData":{"shard":"1"}}'
        kubectl -n $AD set env statefulset/argocd-application-controller ARGOCD_CONTROLLER_REPLICAS=2
        kubectl -n $AD rollout status statefulset/argocd-application-controller --timeout=180s ;;
    *) log "Unknown fault $1"; exit 1 ;;
  esac
  log "Injected. Start diagnosing (to see the answer: fault-box.sh reveal)"
}

reset(){
  log "Resetting..."
  if [ -f "$STATE/mutator.pid" ]; then kill "$(cat "$STATE/mutator.pid")" 2>/dev/null || true; rm -f "$STATE/mutator.pid"; fi
  kubectl -n $NS delete hpa faulty --ignore-not-found
  kubectl -n $AD set env deploy/argocd-repo-server ARGOCD_EXEC_TIMEOUT- >/dev/null || true
  R=$(kubectl -n $AD get sts argocd-application-controller -o jsonpath='{.spec.replicas}')
  kubectl -n $AD set env statefulset/argocd-application-controller ARGOCD_CONTROLLER_REPLICAS="$R" >/dev/null
  S=$(lab2_secret)
  if [ -n "$S" ]; then kubectl -n $AD patch secret "$S" --type json -p '[{"op":"remove","path":"/data/shard"}]' 2>/dev/null || true; fi
  kubectl -n $AD patch secret argocd-secret --type merge -p '{"stringData":{"webhook.github.secret":"lab-secret"}}' >/dev/null
  kubectl -n $NS patch configmap faulty-config --type merge -p '{"metadata":{"finalizers":null}}' 2>/dev/null || true
  if kubectl -n $AD get application $APP -o jsonpath='{.metadata.deletionTimestamp}' 2>/dev/null | grep -q .; then
    kubectl -n $AD wait --for=delete application/$APP --timeout=120s || true
  fi
  rm -f "$REPO_DIR/apps/faults/extra-service.yaml"; baseline; push "fault-box: reset"
  kubectl apply -f "$REPO_DIR/argocd/apps/fault-lab.yaml"
  argocd app get $APP --hard-refresh >/dev/null 2>&1 || true
  argocd app wait $APP --sync --health --timeout 240
  rm -f "$STATE/current"; log "Reset complete: fault-lab Synced / Healthy"
}

case "${1:-}" in
  init)   baseline; push "fault-lab: baseline"
          kubectl apply -f "$REPO_DIR/argocd/apps/fault-lab.yaml"
          argocd app wait $APP --sync --health --timeout 240 ;;
  list)   cat <<'EOF'
F1 HPA vs. Git fight over replica count          F5 repo-server exec timeout
F2 External program rewrites a field in Git      F6 Deletion stuck on a child-resource finalizer
F3 Kustomize references a missing file           F7 Webhook secret mismatch
F4 Invalid field value causes sync failure       F8 Shard misconfiguration (requires lab2)
EOF
          ;;
  inject) inject "${2:?Usage: inject F1..F8}" ;;
  random) L=(F1 F2 F3 F4 F5 F6 F7); [ -n "$(lab2_secret)" ] && L+=(F8)
          inject "${L[RANDOM % ${#L[@]}]}" ;;
  reveal) cat "$STATE/current" 2>/dev/null || echo "No fault is currently injected" ;;
  reset)  reset ;;
  *)      echo "Usage: $0 init|list|inject F1..F8|random|reveal|reset"; exit 1 ;;
esac
chmod +x ~/gitops-lab/scripts/fault-box.sh
export REPO_URL=https://github.com/<you>/gitops-lab     # replace with your repository
alias fb=~/gitops-lab/scripts/fault-box.sh
fb init
argocd app get fault-lab | head -12
[fault-box] ...
Name:               argocd/fault-lab
Project:            default
Server:             https://kubernetes.default.svc
Namespace:          faults
URL:                https://localhost:8080/applications/fault-lab
Source:
- Repo:             https://github.com/<you>/gitops-lab
  Target:           main
  Path:             apps/faults
SyncWindow:         Sync Allowed
Sync Policy:        Automated (Prune)
Sync Status:        Synced to main (3f2a9c1)
Health Status:      Healthy
Why does the script run git push? GitOps faults are partly in Git (rendering failures, invalid fields), partly in the cluster (HPA, external rewrites, finalizers), and partly in Argo CD's own configuration (timeouts, sharding, Webhook secrets). fault-box covers all three categories, and each injection writes the “current fault number” into ~/.fault-box/current, but do not look at it before the Module 8 mystery box.

(Optional) a real three-node HA lab cluster

redis-ha uses hard anti-affinity by default to place the 3 Redis Pods on 3 different nodes. Module 1 uses a “teaching-version HA” on the single-node lab (hard anti-affinity disabled). To see real scheduling, create a separate three-worker-node cluster and delete it when you are done:

cat > /tmp/kind-ha.yaml <<'EOF'
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
  - role: control-plane
  - role: worker
  - role: worker
  - role: worker
EOF
kind create cluster --name lab-ha --image kindest/node:v1.37.0 --config /tmp/kind-ha.yaml
# Lab finished: kind delete cluster --name lab-ha

Self-check checklist

☐ argocd version the server is v3.6.x,helm list shows the chart argo-cd-10.18.0
☐ three *-metrics Services exist
☐ kubectl -n argocd get secret argocd-secret -o jsonpath='{.data.webhook\.github\.secret}' | base64 -d output lab-secret
☐ fault-lab is Synced / Healthy,kubectl -n faults get deploy faulty is 2/2
☐ fb list can list F1–F8; fb reveal output “no fault is currently injected”
☐ (optional) argocd cluster list contains lab2
Resources and risks All operations in this lesson are done in the local kind cluster, at zero cloud cost. Risk: fault-box will push several commits to your gitops-lab repository (all on apps/faults/); F5 / F8 briefly restart repo-server or the controller, and refreshes of other apps may be delayed in the meantime. Cleanup:fb reset; full deletion: argocd app delete fault-lab --cascade --yes and remove the apps/faults/ and argocd/apps/fault-lab.yaml.

Module 1 · HA deployment and component scaling

00:00 – 06:00 · Argo CD is almost stateless: state lives in etcd, and Redis is just a disposable cache. The key to HA is knowing how each component “scales” and “what happens when it goes down”
6 minredis-ha · replicas · PDB★★★★★
Learning objectives
  • Describe how each of the 7 components scales: server / repo-server are stateless with multiple replicas (HPA-capable), the ApplicationSet controller runs multiple replicas with leader election, and the application controller shards by cluster (not leader election); Redis uses redis-ha (Sentinel + HAProxy); Dex and notifications typically run 1 replica.
  • Write out the chart's official HA values (redis-ha.enabled: true,server.replicas: 2,repoServer.replicas: 2,applicationSet.replicas: 2,controller.replicas: 1), and know that redis-ha requires at least 3 nodes by default.
  • Predict what users notice when “a Pod is deleted”: whether the UI is interrupted, whether syncing pauses, and whether the cache is lost.
Prerequisites: Lesson 1 architecture (API Server, Repo Server, Application Controller, Redis). Importance:★★★★★

What: where Argo CD's “state” lives

The first sentence of the official HA documentation: Argo CD is largely stateless. Application, AppProject, repository and cluster credentials (Secrets), and configuration (argocd-cm,argocd-rbac-cm,argocd-cmd-params-cm) are all Kubernetes objects stored in etcd; Redis is just a disposable cache (manifest cache, application resource tree, cluster cache information). If it is lost, it is rebuilt automatically, at the cost of higher load on repo-server and the API Server during the rebuild. So Argo CD's HA does not require backing up Redis. What it does require is enough replicas for each component, Redis not being a single point of failure, and sensible controller sharding.

Component scaling overview (v3.6.1)

ComponentWorkload typeHow to scaleWhat happens if one replica goes downChart key
argocd-server (API / UI)DeploymentStateless; multiple replicas or HPA; the official recommendation is ≥ 3 and to set ARGOCD_API_SERVER_REPLICAS (to spread login concurrency limits across replicas)The remaining replicas keep serving; in-progress gRPC streams (such as the UI's watch) reconnectserver.replicas,server.autoscaling.*
argocd-repo-serverDeploymentStateless (cache in Redis, clones in /tmp), multiple replicas or HPA; the most CPU- and memory-intensive componentThe controller's gRPC calls land on other replicas; that replica's local clones are lost and must be fetched again next timerepoServer.replicas,repoServer.autoscaling.*
argocd-application-controllerStatefulSetSharded by cluster: replica count = shard count; each cluster is handled by exactly one shard (Module 2)Clusters that shard is responsible for pause reconciliation and sync, until the StatefulSet brings the Pod back (usually tens of seconds); there is no “hot standby” takeovercontroller.replicas
argocd-applicationset-controllerDeploymentMultiple replicas + leader election (only the leader works); the chart applicationSet.replicas > 1 sets this automatically when applicationsetcontroller.enable.leader.election: trueanother replica acquires the lease and continuesapplicationSet.replicas
RedisDeployment (single instance) or redis-ha (StatefulSet + HAProxy)redis-ha: 3 redis + sentinel, fronted by 3 HAProxy; Argo CD components connect to HAProxySingle instance: the whole cache is lost and rebuilt; redis-ha: Sentinel elects a new primary and HAProxy switches overredis-ha.enabled
argocd-dex-serverDeploymentIn-memory storage; multiple instances would be inconsistent → usually 1 replicaSSO login is briefly unavailable; JWTs of logged-in users remain validdex.*
argocd-notifications-controllerDeploymentUsually 1 replicaNotifications delayed during restartnotifications.*

Why: why the controller doesn't do “leader election + hot standby”

The controller keeps one copy for each managed cluster cluster cache (it watches all resource types and keeps a lightweight object tree in memory). This cache is large and slow to warm up. A hot-standby replica would either also watch everything (doubling API Server load) or start cold on takeover. Argo CD's choice is: to assign clusters to different replicas, with each replica watching only its own share of clusters. This gives both HA (one replica going down affects only part of the clusters) and horizontal scaling. The trade-off is: one very large cluster cannot be split across multiple replicas, so a single shard's memory limit caps the size of that cluster.

How: the chart's official HA values

The “HA mode without autoscaling” example in the chart README (10.18.0):

redis-ha:
  enabled: true

controller:
  replicas: 1

server:
  replicas: 2

repoServer:
  replicas: 2

applicationSet:
  replicas: 2

Note controller.replicas: 1— the official example does not enable sharding by default; sharding should be decided separately based on the number of clusters. Another example replaces server and repoServer with autoscaling.enabled: true,minReplicas: 2. The README explicitly warns: You need at least 3 worker nodes as the HA mode of redis enforces Pods to run on separate nodes.

When: when HA is needed

  • Argo CD is itself the production delivery channel (if it goes down, you cannot deploy or roll back) → at least 2 replicas each of server and repo-server, plus redis-ha and a PDB.
  • Managing several or more clusters and hundreds of apps → then look at sharding and processors in Module 2.
  • Dev / lab environments → a single replica is enough; HA would only add 3 Redis and 3 HAProxy Pods.

Comparison with similar options

chart HA valuesOfficial manifests/ha/install.yamlManaged / commercial versions (such as Akuity, OpenShift GitOps)
Redisredis-ha subchart (DandyDeveloper/redis-ha 4.38.0)Also 3-node redis + sentinel + HAProxyProvided by the platform
Tunabilityvalues cover everything (replicas, PDB, HPA, affinity)Requires Kustomize patchesLimited by the platform
Upgradeshelm upgrade (Module 7)kubectl apply --server-side --force-conflictsHandled by the platform
Common misconceptions① “Multiple controller replicas = high-availability hot standby” — no, it is sharding; each cluster is managed by only one replica. ② “If Redis goes down, Argo CD loses data” — Redis is only a cache; if it is lost it is rebuilt, but during the rebuild the UI slows and repo-server gets saturated. ③ “HA requires 3 controllers” — the controller replica count should follow the number of clusters and the load; with 1 cluster, extra replicas are pointless because they have no cluster to take over. ④ “A single-node kind can run the official HA values” — redis-ha's hard anti-affinity leaves 2 Redis Pods stuck in Pending.

HA topology: who connects to whom, and what can have multiple replicas

Users / CIUI · CLI · Webhook argocd-server × 2–3Deployment · HPAStateless repo-server × 2+Deployment · HPAclones in /tmp application-controllerStatefulSet · replicas = shards-0 manages cluster A · -1 manages cluster B applicationset × 2Leader election: only the leader worksLease redis-ha: HAProxy × 3 → redis + sentinel × 3 (anti-affinity across 3 nodes)Manifest cache · resource tree · cluster info — all rebuildable cachesComponents connect to argocd-redis-ha-haproxy:6379 etcd (the real state)Application / AppProjectSecrets: repository / cluster credentialsargocd-cm / rbac-cm / params-cm Managed clusters A / B …watch · apply
Figure 1-1: only the controller is “sharded” rather than “replicated”; Redis is a cache, and etcd holds the state

Failure impact

A server replica goes downRefresh the UI and it recoversSync is unaffected(sync is performed by the controller) A repo-server replica goes downOther replicas take over manifest generationWith a single replica: ComparisonError(connection refused / timeout) controller-N goes downClusters in shard N pause reconciliationAuto-sync / self-heal pausesAfter the Pod is rebuilt, it starts watching from scratch Single-instance Redis goes downUI resource tree fails to loadAfter recovery, all caches are rebuiltrepo-server load spike
Figure 1-2: green = users barely notice; yellow = some clusters “frozen”; red = everything slows down

Interactive: HA topology “unplug” simulator

First select a deployment shape, then click “delete one Pod” on a component to see the event timeline and what users notice. Data is modeled on v3.6.1 component behavior; times are illustrative.

Select a deployment shape.
$ kubectl -n argocd get pods -w

Core commands

CommandDescription
helm show values argo/argo-cd --version 10.18.0 | grep -n -A3 '^redis-ha:'View the redis-ha defaults (enabled: false,hardAntiAffinity: true,masterGroupName: argocd)
helm upgrade argocd argo/argo-cd -n argocd --version 10.18.0 -f base.yaml -f ha.yamlMultiple values files are layered; later files override earlier ones
kubectl -n argocd get pods -o wideSee which nodes the replicas are spread across
kubectl -n argocd get pdbConfirm the PodDisruptionBudget is in effect
kubectl -n argocd get leaseApplicationSet controller leader-election lease
kubectl -n argocd get cm argocd-cmd-params-cm -o yamlParameters generated by the chart (including redis.server, the leader-election switch)
kubectl -n argocd exec sts/argocd-redis-ha-server -c sentinel -- redis-cli -p 26379 sentinel get-master-addr-by-name argocdCheck the current Redis primary (a password may be required when auth is enabled; verify against your actual setup)
helm get values argocd -n argocd -a | grep -E '^(redis-ha|controller|server|repoServer|applicationSet):' -A3 | head -40
kubectl -n argocd get cm argocd-cmd-params-cm -o jsonpath='{.data.redis\.server}{"\n"}'
argocd-redis-ha-haproxy:6379

How to verify: After enabling redis-ha, redis.server points to the HAProxy Service; when disabled it is argocd-redis:6379. Common mistake: Changing only server.replicas and forgetting that Redis is still a single point of failure. Production use: Put the HA values into bootstrap/, so that when Argo CD manages itself it also renders from Git.

Lab 1: deploy the “teaching-version HA” on a single-node lab and unplug components (about 6 minutes)

Write the HA overlay values (a separate file, for easy reset).
redis-ha:
  enabled: true
  hardAntiAffinity: false        # teaching only: allows the 3 Redis Pods on the same node (keep true in production)
  haproxy:
    hardAntiAffinity: false
server:
  replicas: 2
  env:
    - name: ARGOCD_API_SERVER_REPLICAS
      value: "2"
  pdb:
    enabled: true
    minAvailable: 1
repoServer:
  replicas: 2
  pdb:
    enabled: true
    minAvailable: 1
applicationSet:
  replicas: 2
controller:
  replicas: 1
Upgrade and observe (on a single-node kind, pulling images takes about 1–3 minutes).
cd ~/gitops-lab/bootstrap
helm upgrade argocd argo/argo-cd -n argocd --version 10.18.0 \
  -f argocd-values.yaml -f argocd-values-ha-lab.yaml --wait --timeout 10m
kubectl -n argocd get pods
kubectl -n argocd get pdb
kubectl -n argocd get lease | grep -i applicationset
NAME                                                READY   STATUS    RESTARTS   AGE
argocd-application-controller-0                     1/1     Running   0          60s
argocd-applicationset-controller-6c9d7b8f5d-2kq9x   1/1     Running   0          70s
argocd-applicationset-controller-6c9d7b8f5d-wq7lm   1/1     Running   0          70s
argocd-redis-ha-haproxy-7b5c9d6f8-4xk2p             1/1     Running   0          95s
argocd-redis-ha-haproxy-7b5c9d6f8-d8m5s             1/1     Running   0          95s
argocd-redis-ha-haproxy-7b5c9d6f8-qz7tn             1/1     Running   0          95s
argocd-redis-ha-server-0                            3/3     Running   0          95s
argocd-redis-ha-server-1                            3/3     Running   0          70s
argocd-redis-ha-server-2                            3/3     Running   0          45s
argocd-repo-server-5f8b6c7d9-h2c4v                  1/1     Running   0          70s
argocd-repo-server-5f8b6c7d9-p9w3k                  1/1     Running   0          70s
argocd-server-7d4f8b9c6-8tq2m                       1/1     Running   0          70s
argocd-server-7d4f8b9c6-zm5rx                       1/1     Running   0          70s
...
NAME                 MIN AVAILABLE   MAX UNAVAILABLE   ALLOWED DISRUPTIONS
argocd-repo-server   1               N/A               1
argocd-server        1               N/A               1

Port-forward svc/argocd-server is dropped when a Pod is rebuilt; re-run kubectl -n argocd port-forward svc/argocd-server 8080:443 to restore it.

Unplug the server: keep hitting the API while deleting one server Pod.
for i in $(seq 1 20); do argocd app get fault-lab -o json >/dev/null 2>&1 && echo "ok $i" || echo "FAIL $i"; sleep 1; done &
POD=$(kubectl -n argocd get pod -l app.kubernetes.io/name=argocd-server -o name | head -1)
kubectl -n argocd delete "$POD" --wait=false
wait

Via kubectl port-forward access: the port-forward is bound to one specific Pod. If that is the one you delete, you will see a few FAILs until you restart the forward. This is a limitation of port-forward, not of Argo CD. In production, access through a Service / Ingress does not have this problem.

Unplug the controller: delete controller-0, change the replica count of faulty at the same time, and observe when self-healing happens.
kubectl -n argocd delete pod argocd-application-controller-0
kubectl -n faults scale deploy faulty --replicas=5
kubectl -n argocd get pod argocd-application-controller-0 -w   # wait until Running, then Ctrl-C
kubectl -n faults get deploy faulty -w                          # wait until it is restored to 2/2

Symptom: while the controller is absent, nothing sets the replica count back to 2; self-healing happens only after the Pod is rebuilt and the cluster cache has synced. This is the real cost of the controller having no hot standby.

Reset (return to non-HA to save resources; skip this if you want to keep HA for Module 2).
helm upgrade argocd argo/argo-cd -n argocd --version 10.18.0 -f argocd-values.yaml --wait
kubectl -n argocd get pods | grep -c redis-ha || echo "redis-ha removed"

Case 1: node maintenance takes all of Argo CD down

Problem: The cluster rotated nodes (drain). Argo CD's server and repo-server were each a single replica and happened to be on the same node, so during the release window the UI and sync were both down for 4 minutes. Fix: 2 replicas each for server and repo-server, plus a PDB minAvailable: 1 + topology spread (the chart's topologySpreadConstraints), and switch Redis to redis-ha. Result: Subsequent drains only cause UI reconnects. Limitation: The controller still pauses briefly when its Pod is moved. Configure priorityClassName and sufficient resource requests to reduce eviction and scheduling waits.

Case 2: redis-ha Pods stay Pending in a three-node cluster

Problem: The test cluster has only 2 worker nodes,argocd-redis-ha-server-2 so the Pod stays Pending forever; the event reads didn't match pod anti-affinity rules (verify against your actual output). Fix: Either add nodes, or in a non-production environment set redis-ha.hardAntiAffinity to false (switching to soft anti-affinity). Lesson: The official README's “at least 3 worker nodes” is a prerequisite, not a suggestion.

Case 3: HPA scales repo-server to 10 replicas, but app refresh is still slow

Problem: In a monorepo, 300 Kustomize apps all use parameter overrides. repo-server allows only one generation at a time per repository that “modifies local files” (Module 3), so adding replicas only adds more people to the queue. Fix: Remove parameter overrides and use the manifest-generate-paths annotation, and split the repository by directory. Conclusion: Use metrics to identify the bottleneck first (Module 4), then decide which component to scale.

Common errors and fixes

argocd-redis-ha-server-1 Pending: 0/1 nodes are available: 1 node(s) didn't match pod anti-affinity rules (verify against your actual output)

Cause: redis-ha defaults to hardAntiAffinity: true, requiring each Redis Pod to be on a different node. Diagnosis:kubectl -n argocd describe pod argocd-redis-ha-server-1 | tail,kubectl get nodes. Fix: In production, add nodes; in a lab, set redis-ha.hardAntiAffinity=false and redis-ha.haproxy.hardAntiAffinity=false.

The UI reports “Unable to load data: ... connect: connection refused”, and the argocd-server logs are full of Redis connection errors

Cause: Redis (or HAProxy) is unavailable. Diagnosis:kubectl -n argocd get pods | grep redis,kubectl -n argocd get cm argocd-cmd-params-cm -o jsonpath='{.data.redis\.server}' confirm the address; kubectl -n argocd logs deploy/argocd-redis-ha-haproxy. Fix: Restore Redis; if you switched from a single instance to redis-ha, confirm that all components have been rolled and are reading the new redis.server.

When upgrading the chart, argocd-redis-ha-haproxy reports that the selector is immutable (field is immutable)

Cause: Some versions of the redis-ha subchart changed the selector labels of the HAProxy Deployment (documented in the chart README's upgrade notes). Fix: Following the README, delete the Deployment with orphan propagation before upgrading. If Argo CD manages itself and Server-Side Diff is enabled, the README recommends switching back to client-side diff first. See Module 7.

Both ApplicationSet controller replicas are generating Applications, causing duplicate updates or overwrites

Cause: Multiple replicas but leader election is not enabled (hand-written manifests or a custom chart turned off applicationsetcontroller.enable.leader.election). Diagnosis:kubectl -n argocd get cm argocd-cmd-params-cm -o yaml | grep leader,kubectl -n argocd get lease. Fix: Enable leader election, or go back to 1 replica.

The controller replica count was changed to 3, but argocd-application-controller-2 stays idle

Cause: The sharding unit is the cluster; with only 2 clusters, the third shard has no work. Diagnosis:argocd admin cluster stats (Module 2). Fix: Replica count ≤ cluster count; for the load of a single large cluster, optimize with processors, kubectl concurrency, and resource exclusions.

Command-line exercises
1. Without modifying the existing values file, temporarily scale repo-server to 3 replicas, enable a PDB, and then confirm the PDB's allowed disruptions.
helm upgrade argocd argo/argo-cd -n argocd --version 10.18.0 -f ~/gitops-lab/bootstrap/argocd-values.yaml \
  --set repoServer.replicas=3 --set repoServer.pdb.enabled=true --set repoServer.pdb.minAvailable=2 --wait
kubectl -n argocd get pdb argocd-repo-server
2. Find the Redis address each Argo CD component connects to, and whether the ApplicationSet controller has leader election enabled.
kubectl -n argocd get cm argocd-cmd-params-cm -o json \
  | jq -r '.data | {"redis.server", "applicationsetcontroller.enable.leader.election"}'
Scenario analysis
The team requires that “no single Argo CD Pod failure may affect automatic sync for any application.” Can this be achieved? How would you respond?

Not entirely: the application controller shards by cluster and has no hot standby. When the controller Pod responsible for a cluster goes down, reconciliation and automatic sync for that cluster pause until the Pod is rebuilt and its cache has synced (usually tens of seconds to a few minutes, depending on cluster size). What you can do: shorten the impact window (sufficient resource requests,priorityClassName, a PDB to prevent voluntary eviction, node affinity to avoid nodes that get reclaimed), reduce the blast radius (multiple shards, each managing only part of the clusters), and improve observability (alert when a controller Pod is not ready,argocd_cluster_cache_age_seconds anomalies). Single-Pod failures in server, repo-server, ApplicationSet, and Redis can be made unnoticeable.

Verified instructional videos

▶
GitOps Guide to the Galaxy (Ep.79) | ArgoCD High Availability with Christian Hernandez — Red Hat
English · Argo CD HA components and deployment options (recorded earlier; for chart key names, follow this lesson and the official README)

Official documentation

Video storyboard (about 90 seconds)

Shot 1 · 0–20s
Visual: seven component blocks; etcd is shown as a green vault icon, and Redis as a “sticky note” icon.
Narration: Argo CD's state lives in etcd; Redis is just a sticky note, and if it is lost you can write it again.
Shot 2 · 20–45s
Visual: server and repo-server are duplicated, with load-balancing arrows in front; of the two ApplicationSet copies, one wears a “leader” crown.
Narration: stateless components simply get more replicas; ApplicationSet relies on leader election.
Shot 3 · 45–70s
Visual: two controller replicas, each holding the rope of a different cluster; delete one, and the clusters it held turn gray.
Narration: the controller shards; it is not a hot standby. If one goes down, the clusters it manages pause.
Shot 4 · 70–90s
Visual: three Redis instances are placed on three nodes; Sentinel elects a new primary, and the HAProxy arrow switches over.
Narration: redis-ha needs three nodes; this is a prerequisite, not a suggestion.
or score ≥ 70% on the quiz

Module 2 · Application Controller sharding and performance tuning

06:00 – 13:00 · The sharding unit is the “cluster,” not the “application.” The sharding algorithm decides which replica a cluster lands on; processors and kubectl concurrency determine how fast each replica can work
7 minlegacy · round-robin · consistent-hashing★★★★★
Learning objectives
  • Explain the three sharding algorithms with source-level accuracy: legacy (FNV-32a hash of the cluster ID, modulo the replica count; the default),round-robin (index after sorting by ID, modulo replicas; alpha),consistent-hashing (consistent hashing with bounded loads, using the application count as load; alpha).
  • Configure sharding correctly: controller.replicas and ARGOCD_CONTROLLER_REPLICAS must match,controller.sharding.algorithm, the cluster Secret's shard field, dynamic cluster assignment (alpha).
  • Tune a single shard: controller.status.processors / operation.processors,controller.kubectl.parallelism.limit,timeout.reconciliation and jitter, self-heal backoff, resource exclusions.
Prerequisites: Lesson 1 reconciliation loop; Lesson 4 registration of cluster lab2. Importance:★★★★★

What: sharding = assigning clusters to controller replicas

The controller runs as a StatefulSet, and the Pod argocd-application-controller-N infers from its hostname suffix that it is shard number N (or sets it explicitly with ARGOCD_CONTROLLER_SHARD ). At startup it reads ARGOCD_CONTROLLER_REPLICAS (the total shard count) and the sharding algorithm, computes a shard number for each cluster,and watches and processes only the clusters whose shard number equals its own, along with the Applications targeting those clusters. The chart writes controller.replicas automatically into ARGOCD_CONTROLLER_REPLICAS; when writing manifests by hand, the two must be kept in sync manually.

The three sharding algorithms (controller/sharding/sharding.go, v3.6.1)

AlgorithmHow it's computedAdvantagesDrawbacks / status
legacy (default)If the cluster Secret sets shard and it is less than the replica count → use it; otherwise FNV-32a(cluster ID) % replicas. An empty cluster ID (in-cluster, not declared by a Secret) → 0Stateless and stable: the same cluster always lands on the same shard (while the replica count is unchanged)Uneven distribution (the official wording is non-uniform), especially noticeable with few clusters; application count is not considered
round-robinAll clusters are sorted by ID,index % replicasperfectly even in countalpha; deleting a cluster near the top of the ranking (such as rank-0) reshuffles all clusters after it
consistent-hashingConsistent hashing + bounded loads; load = number of Applications on each clustertends toward balance, and moves the fewest clusters when shards or clusters are added or removedalpha; the official project published benchmarks on the CNOE blog and is seeking community feedback

How to set it (choose one; the first option is the official recommendation): argocd-cmd-params-cm in the controller.sharding.algorithm; environment variable ARGOCD_CONTROLLER_SHARDING_ALGORITHM; flag --sharding-method. When an unsupported value is set, the controller prints distribution type %s is not supported, defaulting to legacy and falls back.

Manual shard assignment and dynamic assignment

  • Manual shard: in the cluster Secret's stringData add shard: "1". If the value is ≥ the replica count, the log shows Specified cluster shard (1) for cluster: … is greater than the number of available shard. Assigning automatically.
  • Dynamic cluster assignment (alpha, since v2.9): the controller becomes a Deployment, the replica count is read directly from the Deployment, and a ConfigMap argocd-app-controller-shard-cm records “Pod ↔ shard ↔ heartbeat,” with heartbeats every 10 seconds by default (ARGOCD_CONTROLLER_HEARTBEAT_TIME); when replicas are added or removed, assignments are redistributed automatically, with no need to restart all Pods. Chart key: controller.dynamicClusterDistribution: true,controller.heartbeatTime.

Processing capacity of a single shard (v3.6.1 defaults)

Parameter (argocd-cmd-params-cm)DefaultPurposeWhen to adjust
controller.status.processors20Reconciliation queue (app_reconciliation_queue) concurrent workers, for millisecond-level tasksMany apps and refreshes queuing; official guidance: 50 for 1000 apps
controller.operation.processors10Sync queue (app_operation_processing_queue) concurrent workers, for second-level tasksMany apps syncing at once; official guidance: 25 for 1000 apps
controller.kubectl.parallelism.limit20Upper limit on concurrent cluster operations during sync (kubectl apply, etc.); <1 means unlimitedargocd_kubectl_exec_pending Long-term > 0
controller.repo.server.timeout.seconds60RPC timeout for the controller calling repo-server to generate manifestsAppears with large charts / slow plugins context deadline exceeded
timeout.reconciliation (argocd-cm)120sPeriodic refresh (polling Git); plus timeout.reconciliation.jitter (60s) gives “check every 3 minutes by default”With webhooks, it can be raised to 15m / 1h to reduce load; restart the controller after changing it
timeout.hard.reconciliation (argocd-cm)0 (disabled)Periodic “hard refresh” that ignores the manifest cacheWhen an upstream chart changes content without changing its version
controller.self.heal.backoff.*2s · ×3 · cap 300sExponential backoff for repeated self-healsThe “brake” for OutOfSync loops (Module 5)
controller.resource.health.persistfalse (since v3)Whether to write each resource's health status into the Application CRUsually keep false to reduce CR writes
controller.diff.server.sidefalseEnable Server-Side Diff globally (apps with SSA enabled use it automatically since 3.6)See Module 5

Other load-reduction measures: the v3 defaults resource.exclusions (exclude high-churn objects such as Endpoints, EndpointSlice, Lease, various Reviews, and Kyverno / Cilium objects),resource.customizations.ignoreResourceUpdates (ignore refreshes triggered by frequent changes such as status),ARGOCD_CLUSTER_CACHE_BATCH_EVENTS_PROCESSING (default true, 100ms batching),ARGOCD_APPLICATION_TREE_SHARD_SIZE (split the resource tree across multiple Redis keys; 100 recommended).

When: when to shard and how many shards

  • Controller memory grows with the “total number of resources in managed clusters.” Consider sharding when a single replica's memory nears its limit, or when argocd_app_reconcile P95 reconciliation time noticeably increases.
  • Replica count ≤ cluster count. With only 1 cluster, sharding is pointless— tune processors and resource exclusions first.
  • When cluster sizes differ greatly (one huge cluster plus several small ones),legacy hashing may place the huge cluster on the same shard as several medium clusters; use the Secret's shard to “pin” the huge cluster to its own shard.
Common misconceptions① “Sharding is by application” — no, it is by cluster; all apps in the same cluster are on the same shard. ② “Changing the StatefulSet replica count is enough” — with hand-written manifests you must also update ARGOCD_CONTROLLER_REPLICAS, otherwise “a computed shard has no Pod to claim it” will happen (fault F8). ③ “Bigger processors is always better” — they share the same cluster cache lock and repo-server; blindly raising them only shifts the pressure onto repo-server and the API Server. ④ “round-robin is the most even, so it's best” — it is alpha, and deleting a cluster near the top of the ranking triggers a full reshuffle.

Inside one controller shard: two queues + one cluster cache

Triggers refreshResource watch events120s + jitter periodWebhook / manual refresh app_reconciliation_queuestatus processors × 20 → comparison + health app_operation_processing_queueoperation processors × 10 → sync repo-serverRPC timeout 60s kubectl applyconcurrency limit 20 Cluster cache (one per cluster this shard is responsible for)watches all non-excluded resource types · memory ∝ number of resources · argocd_cluster_api_resource_objects Managed clusterAPI Server When sync is needed
Figure 2-1: processors decide “how many apps are handled at once,” kubectl concurrency decides “how many objects are written at once,” and the cluster cache determines memory

Allocation diagram for the three algorithms (3 shards, 6 clusters)

legacyFNV-32a(ID) % 3 shard 0: in-cluster · c3 · c5 shard 1: c1 · c2 · c4 shard 2: (empty) round-robinsort by ID, then index % 3 shard 0: #0 · #3 shard 1: #1 · #4 shard 2: #2 · #5 consistent-hashingRing + bounded load (number of apps) shard 0: large cluster (80 apps) shard 1: 3 small clusters shard 2: 2 medium clusters
Figure 2-2 (illustrative): legacy may produce an empty shard; round-robin is even by count; consistent-hashing balances by application count (the allocation shown is illustrative and depends on cluster IDs in practice)

Core animation: how controller sharding splits clusters

The legacy and round-robin results below are computed with the same rules as the source code (32-bit FNV-1a hash, sorted by ID and taken modulo); consistent-hashing is a “ring + bounded load”simplified implementation, used to observe trends. Cluster IDs are simulated with random UIDs. Try: ① change the replicas from 2 to 3 and see how many clusters legacy moves; ② switch to round-robin, then click “delete the top-ranked cluster”; ③ turn on “env replica count ≠ Pod count.”

replicas = 2
Adjust parameters and observe the allocation.
$ argocd admin cluster stats

Core commands

Command / configurationDescription
argocd admin cluster statsPrint statistics for each cluster and its inferred shard number (reads Kubernetes and Redis directly; automatically port-forwards Redis by default)
argocd admin cluster shardsPrint cluster assignments by shard; supports --replicas,--sharding-method for “what-if” dry runs
argocd admin cluster stats --shard=1Show only shard 1
configs.params."controller.sharding.algorithm"Set the algorithm in the chart (written to argocd-cmd-params-cm)
controller.replicas: 2The chart also sets the StatefulSet replica count and ARGOCD_CONTROLLER_REPLICAS
kubectl -n argocd patch secret <cluster Secret> --type merge -p '{"stringData":{"shard":"1"}}'Manually pin a shard
kubectl -n argocd logs sts/argocd-application-controller | grep -i shardShard information in startup logs
argocd admin cluster shards --replicas 3 --sharding-method round-robin -n argocd
argocd admin cluster stats -n argocd
SHARD  SERVER                          APPS COUNT  RESOURCES COUNT
0      https://kubernetes.default.svc  9           412
1      https://lab2-control-plane:6443 3           188

SERVER                          SHARD  CONNECTION  APPS COUNT  RESOURCES COUNT
https://kubernetes.default.svc  0                  9           412
https://lab2-control-plane:6443 1                  3           188

How to verify: Shard numbers match controller Pod ordinals (shard 1 ↔ argocd-application-controller-1). Common mistake: Running in the wrong namespace: the command reports no error but the output is empty — add -n argocd. When Redis has authentication or TLS enabled, extra parameters are needed; verify against your actual setup. Production use: Before scaling shards, first use shards --replicas N to dry-run whether the allocation is balanced.

Tuning values snippet

controller:
  replicas: 2
  resources:
    requests: {cpu: "1", memory: 2Gi}
    limits: {memory: 4Gi}
configs:
  params:
    controller.sharding.algorithm: legacy
    controller.status.processors: 50
    controller.operation.processors: 25
    controller.kubectl.parallelism.limit: 20
    controller.repo.server.timeout.seconds: 120
  cm:
    timeout.reconciliation: 180s
    timeout.reconciliation.jitter: 60s

Lab 2: two-replica sharding + manual shard pinning (about 6 minutes, requires lab2)

Observe the allocation with a single replica.
argocd cluster list
argocd admin cluster stats -n argocd

With a single replica, all clusters are shard 0. No lab2? Follow Lesson 4 kind create cluster --name lab2 and argocd cluster add kind-lab2 --name lab2 --cluster-endpoint kube-public (the server is https://lab2-control-plane:6443; for handling addresses between kind clusters and fallback options, see Lesson 4), or just read this lab and skip to the “tuning” step.

Dry-run before executing: first check how legacy would distribute clusters across 2 replicas, then actually scale out.
argocd admin cluster shards -n argocd --replicas 2 --sharding-method legacy
helm upgrade argocd argo/argo-cd -n argocd --version 10.18.0 -f ~/gitops-lab/bootstrap/argocd-values.yaml \
  --set controller.replicas=2 --wait
kubectl -n argocd get sts argocd-application-controller -o jsonpath='{.spec.template.spec.containers[0].env[?(@.name=="ARGOCD_CONTROLLER_REPLICAS")].value}{"\n"}'
argocd admin cluster stats -n argocd
2
SERVER                          SHARD ...
https://kubernetes.default.svc  0     ...
https://lab2-control-plane:6443 1     ...   ← could also be 0: legacy depends on the hash of the Secret UID
Manually pin the shard: if lab2 landed on 0, pin it to 1 (and vice versa).
S=$(kubectl -n argocd get secret -l argocd.argoproj.io/secret-type=cluster -o name | head -1)
kubectl -n argocd get "$S" -o jsonpath='{.data.name}' | base64 -d; echo
# After confirming it is lab2's Secret:
kubectl -n argocd patch "$S" --type merge -p '{"stringData":{"shard":"1"}}'
argocd admin cluster stats -n argocd

The controller watches for changes to cluster Secrets and updates the shard cache, so a restart is usually not needed (if the stats do not change, run once rollout restart, verify against your actual setup). Also note a detail in the source code: when ARGOCD_CONTROLLER_REPLICAS ≤ 1, every Pod prints Processing all cluster shards and processes all clusters — this is exactly why “changing only the replica count and not the env” causes duplicate processing.

Switch algorithm: change to round-robin (alpha) and observe the allocation after the controller rolls out.
helm upgrade argocd argo/argo-cd -n argocd --version 10.18.0 -f ~/gitops-lab/bootstrap/argocd-values.yaml \
  --set controller.replicas=2 --set-string 'configs.params.controller\.sharding\.algorithm=round-robin' --wait
kubectl -n argocd get cm argocd-cmd-params-cm -o jsonpath='{.data.controller\.sharding\.algorithm}{"\n"}'
kubectl -n argocd rollout restart sts/argocd-application-controller   # parameter changes require a restart to take effect
kubectl -n argocd rollout status sts/argocd-application-controller
argocd admin cluster stats -n argocd

Note --set Dots in key names must be escaped with \. . The manually set shard field takes priority under every algorithm.

Reset: return to 1 replica and legacy, and delete the manual shard.
kubectl -n argocd patch "$S" --type json -p '[{"op":"remove","path":"/data/shard"}]'
helm upgrade argocd argo/argo-cd -n argocd --version 10.18.0 -f ~/gitops-lab/bootstrap/argocd-values.yaml --wait
kubectl -n argocd rollout restart sts/argocd-application-controller

Case 1: 40 clusters, 3 shards, one shard OOMs

Problem: legacy hashed the two largest clusters onto the same shard. That Pod, with 12Gi of memory, was OOMKilled. After the restart, the re-watch ran out of memory again, and all apps in both clusters stayed in their old state. Fix:argocd admin cluster stats Check resource counts per shard; pin the two large clusters to different shards (the Secret's shard); also check resource exclusions (whether the v3 default exclusions were overridden by a custom resource.exclusions setting). Result: Memory per shard dropped to 5–6Gi. Limitation: Manual shard pinning must be maintained in step with scaling up or down.

Case 2: hand-written HA manifests, only the StatefulSet replica count changed

Problem: The platform team used Kustomize to scale the controller to 3, but did not change ARGOCD_CONTROLLER_REPLICAS (still 1). Symptom: All three Pods believe the total shard count is 1 and each processes all clusters, causing duplicate syncs and operation states overwriting each other. Fix: Use the chart (it keeps both in sync automatically), or change the env in the patch at the same time. The reverse error (env count greater than Pod count) is fault F8: some clusters are not handled by anyone.

Case 3: refresh delays of 10 minutes for 1200 apps

Problem: A single cluster on a single shard,workqueue_depth{name="app_reconciliation_queue"} with a queue that stays at several hundred for long periods. Fix: status processors 20 → 50, operation processors 10 → 25 (official recommended values for 1000 apps),timeout.reconciliation set to 10m, fully enable Webhooks, and scale repo-server to 4 replicas. Result: Queue depth dropped back to single digits. Lesson: For a single-cluster scenario, sharding does not help; only tuning processors and reducing unnecessary refreshes works.

Common errors and fixes

All apps on one cluster stop refreshing; the UI status is stuck from hours ago, and manual Refresh does nothing

Possible causes: The cluster was assigned to a shard that “no Pod claims” (env replica count > actual Pod count), or the controller Pod responsible for it is in CrashLoop. Diagnosis:argocd admin cluster stats Check SHARD; kubectl -n argocd get pods -l app.kubernetes.io/name=argocd-application-controller; kubectl -n argocd get sts argocd-application-controller -o yaml | grep -A1 CONTROLLER_REPLICAS. Fix: Make the two match; check the Secret's shard to see whether it points to a nonexistent Pod.

Log: distribution type round_robin is not supported, defaulting to legacy

Cause: Algorithm name misspelled (the correct names are legacy,round-robin,consistent-hashing). Fix: Correct controller.sharding.algorithm and restart the controller.

Log: Specified cluster shard (3) for cluster: prod-eu is greater than the number of available shard. Assigning automatically.

Cause: The cluster Secret's shard is ≥ the replica count (for example, after scaling down and forgetting to update it). Fix: Update or delete the shard field.

Sync is very slow, and argocd_kubectl_exec_pending stays > 0

Cause: Many apps syncing at once, hitting controller.kubectl.parallelism.limit (default 20). Diagnosis: the Module 4 dashboards. Fix: Raise it moderately; also check for very slow resources in Sync Waves, or for API Server throttling itself (argocd_kubectl_rate_limiter_duration_seconds).

Changed timeout.reconciliation but it has no effect

Cause: The official documentation notes that the controller must be restarted. Fix:kubectl -n argocd rollout restart sts/argocd-application-controller (the chart adds a configuration checksum annotation to Pods, so when helm upgrade changes configs.cm it usually rolls the Pods automatically; verify against your actual setup).

Cluster cache sync failed: continue parameter is too old to display a consistent list result

Cause: Paginated list calls on a very large cluster are too slow and exceed the etcd compaction interval. Fix: Increase ARGOCD_CLUSTER_CACHE_LIST_PAGE_BUFFER_SIZE (official HA documentation), and consider resource exclusions.

Command-line exercises
1. Without changing the cluster, dry-run which clusters each shard would get with “3 replicas + consistent-hashing.”
argocd admin cluster shards -n argocd --replicas 3 --sharding-method consistent-hashing
2. Use the chart to set status / operation processors to 50 / 25, and confirm the ConfigMap has been updated.
helm upgrade argocd argo/argo-cd -n argocd --version 10.18.0 -f ~/gitops-lab/bootstrap/argocd-values.yaml \
  --set-string 'configs.params.controller\.status\.processors=50' \
  --set-string 'configs.params.controller\.operation\.processors=25' --wait
kubectl -n argocd get cm argocd-cmd-params-cm -o yaml | grep processors
Scenario analysis
The company has 1 large production cluster (3000 apps) and 20 small dev clusters. The controller already runs 4 replicas; the shard holding the large cluster has its CPU maxed out, while the other 3 shards are idle. What should you do?

The sharding unit is the cluster; a large cluster can only ever be handled by one shard, so adding replicas does not help it. Approach: ① pin the large cluster to its own shard (Secret shard), with the remaining 20 small clusters shared among the other 3 shards (round-robin or consistent-hashing can balance the small clusters more evenly); ② give the shard holding the large cluster more resources (all Pods in a StatefulSet share the same resources, so raise them together if needed); ③ reduce the large cluster's load: resource exclusions,ignoreResourceUpdates Webhooks + a longer timeout.reconciliation,manifest-generate-paths; ④ raise processors for this instance; ⑤ long term: split into multiple Argo CD instances (by team or environment), or evaluate distributed architectures such as Argo CD Agent.

Verified instructional videos

▶
Scaling Argo CD: From Symptoms To Solution - Alexandre Gaudreault, Intuit — CNCF [Cloud Native Computing Foundation]
English · KubeCon talk: locating Argo CD's scaling bottlenecks starting from symptoms (queues, memory, latency)
▶
How I Tricked ArgoCD Into Sharding on a Single Cluster - Faeka Ansari, Slice Financial Bank — The Linux Foundation
English · sharding approaches for single-cluster scenarios (the techniques in the talk are not official features; evaluate them before using in production)

Official documentation

Video storyboard (about 90 seconds)

Shot 1 · 0–20s
Visual: 6 cluster icons in a queue; 3 controller boxes labeled 0, 1, 2.
Narration: the sharding unit is the cluster — each cluster is handed to exactly one controller.
Shot 2 · 20–45s
Visual: cluster UIDs go through an FNV hash to become numbers; after modulo 3 they drop into boxes; one box is empty.
Narration: legacy is stable but uneven.
Shot 3 · 45–70s
Visual: clusters are sorted by ID and dealt out in turn; delete the first one, and all the rest move.
Narration: round-robin is even in count, but deleting a cluster near the top of the ranking reshuffles everything.
Shot 4 · 70–90s
Visual: 3 shards on a hash ring, each with a load cap; the large cluster takes a slot of its own.
Narration: consistent-hashing balances both evenness and stability; it is still alpha.
or score ≥ 70% on the quiz

Module 3 · Repo Server: caching, timeouts, and manifest generation

13:00 – 21:00 · Manifest generation is usually the slowest step in reconciliation. What the cache key is, when it expires, and which timeout layer reports which error — once you understand these, ComparisonError is no longer a mystery
8 minCache 24h · exec 90s · RPC 60s★★★★★
Learning objectives
  • Draw the path of one GenerateManifest request: resolve the revision (git ls-remote) → check the Redis manifest cache → concurrency semaphore → repo lock → git fetch / checkout → run Kustomize / Helm / plugin → write the cache.
  • Distinguish three timeout layers: ARGOCD_EXEC_TIMEOUT (default 90s, a single tool process),controller.repo.server.timeout.seconds (default 60s, the controller's RPC),reposerver.git.request.timeout (default 15s, Git requests), and read the corresponding errors.
  • Understand error caching: after 3 consecutive failures (ARGOCD_PAUSE_GEN_AFTER_FAILED_ATTEMPTS) generation is paused for 1 hour (ARGOCD_PAUSE_GEN_MINUTES), during which Manifest generation error (cached) is returned; a hard refresh can bypass it.
  • Master monorepo optimization: argocd.argoproj.io/manifest-generate-paths, full references (refs/heads/main),.argocd-allow-concurrency, and why Webhooks “don't fire.”
Prerequisites: Lesson 2 Kustomize / Helm sources. Importance:★★★★★

What: the complete path of one manifest generation

  1. Resolve the revision: targetRevision when it is a branch or tag, use git ls-remote to resolve it to a commit SHA (result cached for 3 minutes: --revision-cache-expiration). Using a full reference refs/heads/main can reduce the overhead of scanning all references in large repos (a new recommendation in the v3.6 HA documentation).
  2. Manifest cache lookup: cached in Redis; the key includes the commit SHA and all parameters of the application source (path, Helm values, Kustomize settings, plugin environment variables, etc.). On a hit it returns immediately, and the repo-server log shows manifest cache hit. Default expiry is 24 hours (reposerver.repo.cache.expiration / --repo-cache-expiration).
  3. Concurrency semaphore: --parallelismlimit (reposerver.parallelism.limit, environment variable ARGOCD_REPO_SERVER_PARALLELISM_LIMIT) limits the number of concurrent generations; default 0 = unlimited; wait time appears in the metric argocd_repo_parallelism_wait_duration_seconds .
  4. Repository lock: each repository has only one local clone. If generation modifies local files (Kustomize with parameter overrides, or legacy plugins that lack .argocd-allow-concurrency ), they must run one at a time on the same instance; since v3.0, Helm generation runs in parallel by default. The queue length is shown in argocd_repo_pending_request_total.
  5. Fetch and execution: clone into /tmp (or TMPDIR), run kustomize build / helm template / plugin; once it exceeds ARGOCD_EXEC_TIMEOUT (default 90s), send SIGTERM, and after another ARGOCD_EXEC_FATAL_TIMEOUT (default 10s), send SIGKILL.
  6. Write the cache: on success the manifests are cached; failures are also counted, for the “error cache.”

The three timeout layers and the original error messages

TimeoutDefaultWhere to set itError seen after a timeout (source format)
Tool process execution90srepo-server environment variable ARGOCD_EXEC_TIMEOUT (Go duration, e.g. 2m30s)`kustomize build <path>` failed timeout after 1m30s (format from util/exec: `command` failed reason)
controller → repo-server RPC60scontroller.repo.server.timeout.secondsrpc error: code = DeadlineExceeded desc = context deadline exceeded (the official HA documentation writes “Context deadline exceeded”)
Git requests15sreposerver.git.request.timeout; retry count ARGOCD_GIT_ATTEMPTS_COUNTunable to resolve git revision main: … or failed to list refs: … (verify details against your actual output)
API Server → repo-server60sserver.repo.server.timeout.secondsThe “App Details / Parameters” page in the UI fails to load

All of these errors ultimately appear in the Application's conditions: ComparisonError: Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = …. The prefix Failed to load target state and failed to generate manifest for source %d of %d both come from controller/state.go, and the real repo-server cause comes after it —read the error up to the part after the last colon.

Error cache: Manifest generation error (cached)

To keep a broken repository from overwhelming repo-server, when the same source fails consecutively 3 times (ARGOCD_PAUSE_GEN_AFTER_FAILED_ATTEMPTS), subsequent requests within 1 hour (ARGOCD_PAUSE_GEN_MINUTES; or by request count ARGOCD_PAUSE_GEN_REQUESTS) return the cached error directly, and the message begins with Manifest generation error (cached) . Official FAQ: a hard refresh (ignoring the cache) can overcome transient issues; if the root cause remains, a hard refresh will not help either, so search the repo-server logs for the application name to find the actual error.

Why: how can Git changes still be seen promptly with a 24-hour cache?

The cache key contains the commit SHA: as soon as there is a new commit, the key changes and the manifests are regenerated. The 24-hour expiry only matters when content changes under the same commit — for example, a remote Kustomize base, or a Helm dependency chart republished without a version bump. For this case, use timeout.hard.reconciliation or lower --repo-cache-expiration (the official guidance is to try 1h in low-traffic environments).

Two major monorepo pitfalls and how to handle them

  • Any commit invalidates the cache for every application in that repository → add an annotation to the applications argocd.argoproj.io/manifest-generate-paths: . (separate multiple paths with semicolons; relative, absolute, and glob paths are supported). Since v2.11 it takes effect even without webhooks: it compares the changed files between the “last cached commit” and the “new commit,” and if no path matches, the cache is reused directly. Metric for the effect: argocd_webhook_store_cache_attempts_total{successful="true"}.
  • Serialize generation that modifies local files → do not use Kustomize parameter overrides; for legacy plugins, place .argocd-allow-concurrency, or switch to a sidecar plugin.

Webhooks: make refreshes go from “up to 3 minutes” to “a few seconds”

The Git service sends push events to argocd-server 's /api/webhook; the server verifies the signature (GitHub uses webhook.github.secret, GitLab uses webhook.gitlab.secret, both in argocd-secret), and finds repoURL matching applications whose repository matches and whose pushed branch affects their targetRevision applications, and puts them in the refresh queue (server.webhook.refresh.workers default 20). The log messages, in order, are Received push event repo: …, revision: …, touchedHead: … and Requested app 'x' refresh. Under heavy load you can use webhook.refresh.jitter to spread them out.

Why a Webhook doesn't fireEvidence
The Git service cannot reach Argo CD (kind / internal network / firewall)GitHub “Recent Deliveries” shows connection failures; the server log has no webhook record at all
URL is not https://<host>/api/webhookGitHub receives a 404 / HTML page
GitHub Content type is the default application/x-www-form-urlencodedThe official documentation requires application/json; returns 400
Mismatched secretHTTP 400, response body Webhook processing failed; server log Webhook processing failed: … (GitHub's reason is HMAC verification failed)
payload exceeds webhook.maxPayloadSizeMB (default 50)Webhook processing failed: payload must be valid JSON under 50 MB
the pushed branch is not the application's targetRevision, or repoURL is written differently (mirror address)200 OK, with Received push event, but no Requested app … refresh
the refresh queue is fullHTTP 503 Queue is full, discarding webhook payload
Gitea / Gogs: the secret was configured in webhook.github.secretwith X-Gogs-Event requests are handled by the Gogs parser, which verifies webhook.gogs.secret; on mismatch, 400
Gitea: webhook.ALLOWED_HOST_LIST is the default externalthe delivery is rejected on the Gitea side; there is no record in the Argo CD logs
Gitea: ROOT_URL and the Application's repoURL hostname differs200 + Received push event (the repo shows the address under ROOT_URL), but there is no Requested app … refresh
Common misconceptions① “Refresh re-renders” — a normal refresh hits the cache (same commit); only Hard Refresh bypasses the manifest cache. ② “If repo-server times out, raise the controller's 60s” — if the tool itself exceeds 90s, the one to adjust is ARGOCD_EXEC_TIMEOUT, and both may be needed. ③ “Webhooks are received by repo-server” — no, argocd-server receives them; it only handles “notify refresh.” ④ “Adding repo-server replicas always makes it faster” — the repository lock is per instance, so with a monorepo plus parameter overrides, adding replicas helps only a little.

GenerateManifest request pipeline

controllerRPC ≤ 60s ls-remotebranch → SHA Redis cacheSHA + source parameters semaphoreparallelismlimit repo lockserialized when files are modified fetch + exec≤ 90s, then TERM write cache24h Hit: manifest cache hit (milliseconds) Failure path exec timeout → `kustomize build …` failed timeout after 1m30s Queueing + execution > 60s → controller: context deadline exceeded 3 consecutive failures → within 1 hour: Manifest generation error (cached)
Figure 3-1: on a cache hit, all later steps are skipped; “slowness” usually occurs in three places: the semaphore, the repo lock, and exec

Webhook path

GitHub pushHMAC-SHA256 argocd-server/api/webhook verifies signature match applicationsrepoURL + branch + path refresh queue20 workers controllerreconcile Failure: 400 Webhook processing failedNo match: 200 but no refresh
Figure 3-2: a Webhook only “knocks early”; actual rendering still follows Figure 3-1

Interactive: manifest generation pipeline simulator

Set the number of concurrent requests, the concurrency limit, whether a repo lock is needed, the tool execution time, and ARGOCD_EXEC_TIMEOUT, then click “Send request.” The simulator uses Figure 3-1 to calculate each request's completion time in the queue, and marks exec timeouts, the controller's 60s RPC timeout, and the error cache according to the real rules. Times are simulated values.

Set the parameters, then click “Send request.”
$ kubectl -n argocd logs deploy/argocd-repo-server -f

Core commands

CommandDescription
argocd app get APP --refreshNormal refresh: re-compare; the manifests may come from cache
argocd app get APP --hard-refreshHard refresh: ignore the manifest cache (including cached errors) and regenerate
argocd app manifests APP --source gitView the manifests repo-server generated for the current target
kubectl -n argocd logs deploy/argocd-repo-server | grep -E 'manifest cache (hit|miss)'Cache hit status (JSON logs)
kubectl -n argocd set env deploy/argocd-repo-server ARGOCD_EXEC_TIMEOUT=3mTemporarily adjust the exec timeout (when managed by the chart, it should be written into repoServer.env)
kubectl -n argocd annotate app APP argocd.argoproj.io/manifest-generate-paths=.Regenerate only when relevant paths change (recommended: put it in the Application in Git)
kubectl -n argocd logs deploy/argocd-server | grep -iE 'webhook|push event'Webhook receipt and processing status
argocd app get fault-lab --hard-refresh >/dev/null
kubectl -n argocd logs deploy/argocd-repo-server --since=2m | grep -E 'manifest cache' | tail -3
argocd app get fault-lab --refresh >/dev/null
kubectl -n argocd logs deploy/argocd-repo-server --since=1m | grep -E 'manifest cache' | tail -3
{"application":"fault-lab","level":"info","msg":"manifest cache miss",...}
{"application":"fault-lab","level":"info","msg":"manifest cache hit",...}

repo-server tuning values snippet

repoServer:
  replicas: 2
  env:
    - name: ARGOCD_EXEC_TIMEOUT
      value: "3m"                 # large charts / slow plugins
    - name: ARGOCD_GIT_ATTEMPTS_COUNT
      value: "3"                  # retry when ls-remote occasionally fails
  # /tmp is easily filled by many repositories: the chart mounts an emptyDir at /tmp by default,
  # when more space is needed, adjust the volume per the chart README (the chart documentation is authoritative)
configs:
  params:
    reposerver.parallelism.limit: 10
    controller.repo.server.timeout.seconds: 180   # must be greater than EXEC_TIMEOUT
    reposerver.repo.cache.expiration: 24h0m0s

Lab 3: cache, timeout injection, and Webhook simulation (about 7 minutes)

Observe the cache: first do a hard refresh (miss), then a normal refresh (hit). See the “Commands” page for the commands.
Inject an exec timeout (equivalent to fb inject F5).
kubectl -n argocd set env deploy/argocd-repo-server ARGOCD_EXEC_TIMEOUT=1ms
kubectl -n argocd rollout status deploy/argocd-repo-server
argocd app get fault-lab --hard-refresh | grep -A3 -i condition
CONDITION        MESSAGE                                                                                      LAST TRANSITION
ComparisonError  Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = `kustomize build /tmp/_argocd-repo/<uuid>/apps/faults` failed timeout after 1ms   ...

The timeout may also happen first in git a child process; then the backticks contain a git command — this likewise indicates an “exec timeout.”

Observe the error cache: do several normal refreshes in a row; the message prefix changes.
for i in 1 2 3 4; do argocd app get fault-lab --refresh -o json | jq -r '.status.conditions[]?.message' | cut -c1-90; sleep 5; done
Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: ...
...
Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = Manifest generation error (cached): `kustomize build ...
Reset and confirm recovery: after removing the environment variable, a normal refresh may still return the cached error,so a hard refresh is required.
kubectl -n argocd set env deploy/argocd-repo-server ARGOCD_EXEC_TIMEOUT-
kubectl -n argocd rollout status deploy/argocd-repo-server
argocd app get fault-lab --hard-refresh | grep -E 'Sync Status|Health Status'
Webhook simulation: the kind cluster runs locally and GitHub cannot reach it, so we use curl to forge a signed push event.
BODY=$(printf '{"ref":"refs/heads/main","repository":{"html_url":"%s","default_branch":"main"},"commits":[]}' "$REPO_URL")
sign(){ printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$1" | awk '{print $NF}'; }
for key in lab-secret wrong-key; do
  curl -sk -o /dev/null -w "$key -> HTTP %{http_code}\n" https://localhost:8080/api/webhook \
    -H 'Content-Type: application/json' -H 'X-GitHub-Event: push' \
    -H "X-Hub-Signature-256: sha256=$(sign $key)" -d "$BODY"
done
kubectl -n argocd logs deploy/argocd-server --since=1m | grep -E 'push event|Requested app|Webhook processing failed'
lab-secret -> HTTP 200
wrong-key -> HTTP 400
... "msg":"Received push event repo: https://github.com/<you>/gitops-lab, revision: main, touchedHead: true" ...
... "msg":"Requested app 'fault-lab' refresh" ...
... "msg":"Webhook processing failed: HMAC verification failed" ...

The Requested app after the third line indicates the refresh has been queued. revision and touchedHead values and the full text of error causes: verify against your actual output.

Real Webhook: in-cluster Gitea → argocd-server (Lesson 1 deferred the Webhook demo to here). kind runs locally and GitHub cannot push into it, so we install Gitea in the namespace gitea (chart gitea-charts/gitea 12.7.0, Gitea 1.27.0, single Pod + sqlite, lab only), so that it calls directly after a push https://argocd-server.argocd.svc.cluster.local/api/webhook.
helm repo add gitea-charts https://dl.gitea.com/charts/ && helm repo update
cat > ~/gitops-lab/bootstrap/gitea-values.yaml <<'EOF'
valkey-cluster: {enabled: false}
valkey: {enabled: false}
postgresql: {enabled: false}
postgresql-ha: {enabled: false}
persistence: {enabled: false}          # lab only: data is lost when the Pod is rebuilt
gitea:
  admin: {username: gitea_admin, password: "Lab-Passw0rd-7", email: "admin@lab.local"}
  config:
    server:
      ROOT_URL: http://gitea-http.gitea.svc.cluster.local:3000/   # determines the repository address in the Webhook payload
    database: {DB_TYPE: sqlite3}
    session: {PROVIDER: memory}
    cache: {ADAPTER: memory}
    queue: {TYPE: level}
    webhook:
      ALLOWED_HOST_LIST: private      # the default, external, rejects in-cluster (private IP) targets
      SKIP_TLS_VERIFY: true           # argocd-server uses a self-signed certificate (lab only)
EOF
helm upgrade --install gitea gitea-charts/gitea -n gitea --create-namespace --version 12.7.0 \
  -f ~/gitops-lab/bootstrap/gitea-values.yaml --wait --timeout 10m
kubectl -n gitea port-forward svc/gitea-http 3000:3000 &

On the Argo CD side: requests sent by Gitea carry both X-Gogs-Event and X-GitHub-Event headers; in the v3.6.1 source code (util/webhook/scm.go) they are claimed in order, first by the Gogs parser claims it (the condition is that X-Gogs-Event is non-empty), so the secret must be configured in webhook.gogs.secret rather than github. Add it to the Argo CD values:

# Edit ~/gitops-lab/bootstrap/argocd-values.yaml and add one line under the existing configs.secret:
#   configs:
#     secret:
#       githubSecret: lab-secret
#       gogsSecret: gitea-lab-secret      # written to webhook.gogs.secret in argocd-secret
helm upgrade argocd argo/argo-cd -n argocd --version 10.18.0 -f ~/gitops-lab/bootstrap/argocd-values.yaml --wait
kubectl -n argocd get secret argocd-secret -o jsonpath='{.data.webhook\.gogs\.secret}' | base64 -d; echo

Create the repository, push content, create the Application, and create the Webhook:

GP=Lab-Passw0rd-7; GAPI=http://localhost:3000/api/v1
curl -s -u gitea_admin:$GP -H 'Content-Type: application/json' -X POST $GAPI/user/repos \
  -d '{"name":"webhook-demo","private":false,"default_branch":"main"}' | jq -r .html_url
mkdir -p ~/webhook-demo && cd ~/webhook-demo && git init -q -b main
cat > configmap.yaml <<'EOF'
apiVersion: v1
kind: ConfigMap
metadata: {name: hello}
data: {message: "v1"}
EOF
git add . && git commit -qm v1 && git push -q http://gitea_admin:$GP@localhost:3000/gitea_admin/webhook-demo.git main
argocd app create webhook-demo --project default \
  --repo http://gitea-http.gitea.svc.cluster.local:3000/gitea_admin/webhook-demo.git --path . --revision main \
  --dest-server https://kubernetes.default.svc --dest-namespace webhook-demo \
  --sync-policy automated --sync-option CreateNamespace=true
curl -s -u gitea_admin:$GP -H 'Content-Type: application/json' -X POST $GAPI/repos/gitea_admin/webhook-demo/hooks \
  -d '{"type":"gitea","active":true,"events":["push"],"config":{"url":"https://argocd-server.argocd.svc.cluster.local/api/webhook","content_type":"json","secret":"gitea-lab-secret"}}' | jq -r .id

Timing: push v2 and see how long it takes to sync (without a Webhook, up to about 120s + 60s jitter).

sed -i 's/"v1"/"v2"/' configmap.yaml   # macOS: sed -i '' ...
git commit -qam v2 && git push -q http://gitea_admin:$GP@localhost:3000/gitea_admin/webhook-demo.git main
start=$(date +%s)
until [ "$(kubectl -n webhook-demo get cm hello -o jsonpath='{.data.message}')" = v2 ]; do sleep 1; done
echo "synced in $(( $(date +%s) - start ))s"
kubectl -n argocd logs deploy/argocd-server --since=2m | grep -E 'push event|Requested app'
synced in 4s
... "msg":"Received push event repo: http://gitea-http.gitea.svc.cluster.local:3000/gitea_admin/webhook-demo, revision: main, touchedHead: true" ...
... "msg":"Requested app 'webhook-demo' refresh" ...

Make three “breaking” changes, then check Gitea repository → Settings → Webhooks → Recent deliveries:① Change the hook's secret to something else → Argo CD returns 400 Webhook processing failed; ② remove ALLOWED_HOST_LIST reinstall Gitea → the delivery is rejected on the Gitea side (the message says to check webhook.ALLOWED_HOST_LIST; verify the exact text against your actual output); there is nothing in the Argo CD logs; ③ change ROOT_URL to http://localhost:3000/ → Argo CD returns 200, with Received push event, but no Requested app— the repository hostname in the payload and the Application's repoURL do not match (the source matches on hostname + path; protocol and port are optional). Compare each run with the timing script above: it degrades to polling of up to about 3 minutes. Cleanup:argocd app delete webhook-demo --cascade --yes; helm -n gitea uninstall gitea; kubectl delete ns gitea webhook-demo.

(optional) manifest-generate-paths: in argocd/apps/fault-lab.yaml 's metadata.annotations add argocd.argoproj.io/manifest-generate-paths: ., and after committing, change files in the repository that are unrelated to apps/faults files, and check that the repo-server log no longer shows fault-lab's manifest cache miss.

Case 1: one large Helm chart “stalls” the entire instance

Problem: One team's umbrella chart takes 110 seconds to render. It exceeds 90s, gets SIGTERM, and the application shows ComparisonError. Meanwhile it holds repo-server's CPU, so generation for other applications also slows down. Fix: Short term ARGOCD_EXEC_TIMEOUT=3m + controller.repo.server.timeout.seconds=180; medium term, split the chart and remove lookup -type heavy template logic; long term, move rendering into CI (Rendered Manifests / Source Hydrator). Limitation: Raising the timeout only makes slow operations “legal”; it does not make them faster.

Case 2: every monorepo merge triggers re-rendering of 400 applications

Problem: One repository with 400 applications; any commit invalidates the cache, and repo-server CPU is pegged for 5 minutes. Fix: Add to all Applications manifest-generate-paths: . (add it in the ApplicationSet template),targetRevision change to refs/heads/main, and for plain-YAML repositories set in the Repository Secret webhookManifestCacheWarmDisabled: "true". Result: Each merge now renders only the few affected applications.

Case 3: the Webhook is configured, but deployment still takes 3 minutes

Problem: GitHub shows 200, and the server log has Received push event, but no Requested app … refresh. Root cause: The application's repoURL points to the company's internal Git mirror, and the URL in the GitHub event does not match it. Fix: Configure the Webhook on the mirror service (instead of GitHub), or make repoURL match the repository address in the event.

Common errors and fixes

ComparisonError: Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = `helm template . --name-template x ...` failed timeout after 1m30s (verify the command portion against your actual output)

Layer: repo-server exec. Diagnosis: Time the same command locally with the same parameters time helm template …; check whether repo-server CPU is being throttled. Fix: Increase ARGOCD_EXEC_TIMEOUT and increase in step controller.repo.server.timeout.seconds; optimize the chart; give repo-server more CPU.

rpc error: code = DeadlineExceeded desc = context deadline exceeded

Layer: controller → repo-server RPC (60s). Cause: Queueing (semaphore / repo lock) + total execution time over 60s, or repo-server is unreachable. Diagnosis:argocd_repo_pending_request_total,argocd_repo_parallelism_wait_duration_seconds, repo-server replicas and resources. Fix: Increase the timeout, scale out repo-server, and eliminate repo locks (see the module principles).

Manifest generation error (cached): …

Cause: After 3 consecutive failures, the error cache is entered (default 1 hour). Fix: Fix the root cause first, then argocd app get APP --hard-refresh; do not just wait for it to recover on its own.

rpc error: code = Unknown desc = exceeded max combined manifest file size (directory-type application)

Cause: The total manifest size of a directory-type (plain YAML) application exceeds reposerver.max.combined.directory.manifests.size (default 10M; the official documentation notes that memory during parsing can expand about 300 times). Fix: Make sure no large files (such as bundled CRDs or test data) are in the application directory; raise the limit cautiously only if necessary.

repo-server log: no space left on device

Cause: Repository clones are stored in /tmp, with many or large repositories. Fix: The official recommendation is to mount a persistent volume or a larger emptyDir; clean up unused repositories; enable tar exclusion for plugins.

GitHub Recent Deliveries: 400, response body Webhook processing failed

Cause: Signature verification failed (mismatched secret), or the Content type is not application/json. Diagnosis: server log Webhook processing failed: …; compare argocd-secret in webhook.github.secret. Fix: Make the secrets match on both sides; change the Content type to application/json.

Command-line exercises
1. After fixing a broken Kustomize reference, the application still shows “Manifest generation error (cached).” Use one command to regenerate it immediately and view its status.
argocd app get fault-lab --hard-refresh
2. View the repo-server generation logs for fault-lab from the last 10 minutes (including cache hits and errors).
kubectl -n argocd logs deploy/argocd-repo-server --since=10m --all-containers | grep '"fault-lab"' | grep -E 'manifest cache|error|failed'
Scenario analysis
The upstream Helm repository republished the chart without changing its version number (to fix a bug), and your application never picked up the new content. Why? What should you do?

The manifest cache key is based on “source parameters + commit SHA” (for a Helm repository source, the chart version). The version has not changed → the key has not changed → the old cache is hit until it expires after 24 hours. Immediate action: hard-refresh the affected applications. Long term: require the upstream to follow SemVer (the version must change when the content changes), or set in argocd-cm timeout.hard.reconciliation, or lower reposerver.repo.cache.expiration (this increases repo-server load); best of all, pin the content with an OCI digest or a self-hosted image registry.

Verified instructional videos

▶
Keynote: Pushing the Limits: Scaling ArgoCD’s Repo-Server To Handle 30... Aditya Sharma & Isha Gusai — CNCF [Cloud Native Computing Foundation]
English · repo-server scaling in practice (the title is already truncated on YouTube)
▶
Supercharging Argo CD’s Manifest Generation Capabilities — CNCF [Cloud Native Computing Foundation]
English · manifest generation mechanics and scaling

Official documentation

Video storyboard (about 90 seconds)

Shot 1 · 0–20s
Visual: a request envelope flies from the controller to repo-server and first bumps into a “cache” sign at the Redis door.
Narration: same commit, same parameters — take the cache directly.
Shot 2 · 20–50s
Visual: cache miss; the envelope queues in the “semaphore” line, then in the “repo lock” line, and finally enters the kustomize machine, with a 90-second countdown appearing overhead.
Narration: it's slow, usually because of queueing and execution.
Shot 3 · 50–75s
Visual: the countdown hits zero, the machine smokes, and the envelope is stamped “timeout after”; after the third failure, a “cached” seal is applied.
Narration: after three consecutive failures, the error is cached for an hour; after fixing it, remember to hard-refresh.
Shot 4 · 75–90s
Visual: the GitHub icon sends a push lightning bolt at argocd-server; when the signature doesn't match, it bounces back “400.”
Narration: the Webhook only knocks; if the signature is wrong, the door stays shut.
or score ≥ 70% on the quiz

Module 4 · Monitoring Argo CD: metrics, logs, and alerts

21:00 – 28:00 · Three /metrics endpoints, a dozen-plus genuinely useful metrics, and 9 alert rules validated with promtool — so that “Argo CD has a problem” becomes an alert before users notice
7 min8082 · 8083 · 8084★★★★☆
Learning objectives
  • Name each component's metrics endpoint: controller :8082/metrics, API Server :8083/metrics, repo-server :8084/metrics (there are also ApplicationSet, notifications, commit-server, Dex, and redis-ha exporter), and the chart keys that enable them.
  • Master the key metrics and their labels: argocd_app_info,argocd_app_sync_total,argocd_app_reconcile,workqueue_depth,argocd_git_request_total / _duration_seconds,argocd_kubectl_exec_pending,argocd_cluster_connection_status,argocd_repo_pending_request_total.
  • Write alerts: application Degraded / long-running OutOfSync, sync failures,sync loops, queue backlog, slower reconciliation, Git fetch failures, and cluster disconnects; know that v3 removed argocd_app_sync_status and other legacy metrics.
  • Extract key events from JSON logs: Reconciliation completed,Initiated automated sync,Skipping auto-sync: ….
Prerequisites:Prometheus & Grafana lesson's kube-prometheus-stack (release kps, namespace monitoring). Importance:★★★★☆

What: metrics endpoints (v3.6.1 official metrics documentation)

ComponentEndpointChart toggleWhat to look at
application-controller:8082/metrics (in the official manifests, the Service is argocd-metrics, and in the chart it is argocd-application-controller-metrics)controller.metrics.enabledApplication status, reconciliation duration, sync count, queues, kubectl, cluster cache
argocd-server:8083/metrics (argocd-server-metrics)server.metrics.enabledLogin, gRPC requests, Redis, proxy extensions
repo-server:8084/metrics (the chart key is argocd-repo-server-metrics)repoServer.metrics.enabledGit / OCI requests, queueing, concurrency wait, Redis
commit-server (Source Hydrator):8087/metricscommitServer.*Commit requests
ApplicationSet / notifications / Dex / redis-haeach component's metrics portapplicationSet.metrics.enabled etc.appset reconciliation, notification delivery, HAProxy

When using the Prometheus Operator, the chart's *.metrics.serviceMonitor.enabled: true generates a ServiceMonitor; kube-prometheus-stack by default only selects ServiceMonitors that carry release: <its release name> label (in the Prometheus lesson it is kps), using serviceMonitor.additionalLabels to add it. The official warning: when the controller has multiple replicas, scrapers that are not from the Operator must use Pod / Endpoint discovery,since scraping only the ClusterIP returns the metrics of just one replica.

Key metrics at a glance

MetricTypeKey labelsPurpose
argocd_app_infogaugenamespace, name, project,sync_status,health_status, autosync_enabled, repo, dest_server, operation, phaseStatus panels and Degraded / OutOfSync alerts (v3 removed argocd_app_sync_status,argocd_app_health_status,argocd_app_created_time; use these labels instead)
argocd_app_sync_totalcountername, project, dest_server,phase (Error / Failed / Running / Succeeded / Terminating), dry_runSync failures,sync loops (an abnormally high number of successful syncs in a short time)
argocd_app_reconcilehistogramnamespace, dest_server (no application name); buckets 0.25…16 secondsreconciliation duration heatmap, P95
workqueue_depthgaugename=app_reconciliation_queue / app_operation_processing_queue / project_reconciliation_queuewhether the controller is “overwhelmed” (the official dashboard uses name=~"app_.*")
argocd_app_k8s_request_totalcountername, verb, resource_kind, response_codeFind applications that fall back to querying the API Server because of a non-preferred API version
argocd_kubectl_exec_pendinggaugecommandSync queueing (kubectl concurrency limit)
argocd_cluster_connection_statusgaugeserver, k8s_versionA value of 1 means cluster cache sync has no errors (source: SyncError == nil)
argocd_cluster_api_resource_objectsgaugeserverNumber of objects in each cluster cache; use it to estimate shard memory
argocd_git_request_totalcounterrepo, request_type (ls-remote / fetch)Git load
argocd_git_request_duration_secondshistogramrepo, request_typeSlow Git
argocd_git_fetch_fail_totalcounterrepo, revisionfetch failures
argocd_repo_pending_request_totalgaugerepoNumber of requests waiting for the repo lock (monorepo serialization)
argocd_repo_parallelism_wait_duration_secondshistogram—Time spent waiting --parallelismlimit for the semaphore
argocd_redis_request_totalcounterinitiator, command, failedRedis failure
argocd_app_conditiongaugename, conditiondisabled by default; set controller.metrics.application.conditions (for example OrphanedResourceWarning,ComparisonError)

Why: why looking only at the UI is not enough

The UI shows the state of “right now”; whereas OutOfSync loops, queue backlogs, and occasional Git failures are patterns that change over time: an application that syncs 40 times in 30 minutes always looks like “Synced” or “Syncing” in the UI. Metrics turn these patterns into numbers that can be alerted on.

How: logs complement metrics

Components output JSON logs by default (*.log.format: json), each carrying application and similar fields. The controller's key messages (original source text):

  • Reconciliation completed: with time_ms,patch_ms,setop_ms and per-stage duration fields (such as already_attempted_sync_ms), which let you find the slowest applications.
  • Initiated automated sync to '<revision>': each automatic sync (appears frequently during loops).
  • Skipping auto-sync: already attempted sync to … with timeout … (retrying in …): self-heal backoff is in effect.
  • Skipping auto-sync: failed previous sync attempt to … and will not retry for …: the previous auto-sync failed, and the same revision is not retried automatically.

When: which alerts are the minimum needed

Start with 9 (see the “Commands” page; validated with promtool 3.16.0): application Degraded, auto-sync application OutOfSync for a long time, sync failures, sync loops, queue backlog, slower reconciliation, Git fetch failures, cluster disconnects, and kubectl queueing.

Common misconceptions① “The dashboard going empty after upgrading to v3 is a Prometheus problem” — no, it is that argocd_app_sync_status and other metrics were removed; switch to argocd_app_info labels instead. ② “argocd_app_reconcile can find slow applications by application name” — it only has namespace and dest_server labels; to find a specific one, check the time_ms field in the logs. ③ “Scraping one Service is enough” — a multi-replica controller must be scraped Pod by Pod. ④ “Turn every application label into a metric label” —argocd_app_labels will inflate cardinality; the official guidance is to use it with caution.

Where metrics come from and where alerts are viewed

controller :8082app_info · sync_total · reconcileworkqueue_depth · kubectl · cluster_* repo-server :8084git_request_* · repo_pending · parallelism_wait argocd-server :8083grpc_server_handled_total · login · redis ServiceMonitorlabel release: kpsScraped Pod by Pod PrometheusPrometheusRule9 alerts GrafanaOfficial dashboard.json AlertmanagerRoute to on-call
Figure 4-1: three endpoints → ServiceMonitor → Prometheus → Grafana / Alertmanager

Symptom → metric lookup

SymptomMetrics to check first “After deployment, the application keeps Syncing / flapping back and forth”increase(argocd_app_sync_total[30m]) by (name) “No reaction 10 minutes after pushing code”workqueue_depth, argocd_git_request_total, Webhook logs “UI is slow, resource tree won't load”argocd_redis_request_total{failed="true"}, gRPC latency “Many ComparisonErrors”argocd_git_fetch_fail_total, repo_pending, parallelism_wait “All applications on one cluster show Unknown”argocd_cluster_connection_status, argocd_cluster_info
Figure 4-2: translating user complaints into PromQL

Interactive: alert firing simulator

Select a fault scenario and play it. Each “tick” of the simulator represents 1 minute; it shows changes in the relevant metrics and the state of the 9 rules (inactive → pending → firing, according to each rule's for timing). Values are simulated; rule expressions match the “Commands” page.

Select a scenario.

Read the three endpoints directly

kubectl -n argocd port-forward svc/argocd-application-controller-metrics 8082:8082 &
kubectl -n argocd port-forward svc/argocd-repo-server-metrics 8084:8084 &
kubectl -n argocd port-forward svc/argocd-server-metrics 8083:8083 &
sleep 2
curl -s localhost:8082/metrics | grep -E '^argocd_app_info' | head -3
curl -s localhost:8082/metrics | grep -E '^workqueue_depth\{.*app_'
curl -s localhost:8084/metrics | grep -E '^argocd_git_request_total' | head -3
curl -s localhost:8083/metrics | grep -c '^grpc_server_handled_total'
argocd_app_info{autosync_enabled="true",dest_namespace="faults",dest_server="https://kubernetes.default.svc",health_status="Healthy",hydrator_status="",name="fault-lab",namespace="argocd",operation="",phase="Succeeded",project="default",repo="https://github.com/<you>/gitops-lab",sync_status="Synced"} 1
...
workqueue_depth{name="app_operation_processing_queue"} 0
workqueue_depth{name="app_reconciliation_queue"} 0
argocd_git_request_total{repo="https://github.com/<you>/gitops-lab",request_type="fetch"} 12
argocd_git_request_total{repo="https://github.com/<you>/gitops-lab",request_type="ls-remote"} 57
86

Chart: ServiceMonitor and PrometheusRule

controller:
  metrics:
    enabled: true
    serviceMonitor: {enabled: true, additionalLabels: {release: kps}}
repoServer:
  metrics:
    enabled: true
    serviceMonitor: {enabled: true, additionalLabels: {release: kps}}
server:
  metrics:
    enabled: true
    serviceMonitor: {enabled: true, additionalLabels: {release: kps}}
configs:
  params:
    controller.metrics.application.conditions: "OrphanedResourceWarning,ComparisonError,SyncError"

9 alert rules (promtool 3.16.0 check rules: SUCCESS: 9 rules found)

apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: argocd-alerts
  namespace: argocd
  labels: {release: kps}
spec:
  groups:
    - name: argocd
      rules:
        - alert: ArgoCDAppDegraded
          expr: argocd_app_info{health_status="Degraded"} == 1
          for: 10m
          labels: {severity: warning}
          annotations:
            summary: "Application {{ $labels.name }} is Degraded"
        - alert: ArgoCDAppOutOfSyncTooLong
          expr: argocd_app_info{sync_status="OutOfSync", autosync_enabled="true"} == 1
          for: 30m
          labels: {severity: warning}
          annotations:
            summary: "Auto-sync app {{ $labels.name }} OutOfSync for 30m"
        - alert: ArgoCDSyncFailed
          expr: sum by (namespace, name, project) (increase(argocd_app_sync_total{phase=~"Error|Failed"}[15m])) > 0
          labels: {severity: warning}
          annotations:
            summary: "Sync of {{ $labels.name }} failed"
        - alert: ArgoCDSyncLoop
          expr: sum by (namespace, name) (increase(argocd_app_sync_total{phase="Succeeded"}[30m])) > 6
          labels: {severity: warning}
          annotations:
            summary: "{{ $labels.name }} synced {{ $value }} times in 30m (self-heal loop?)"
        - alert: ArgoCDReconcileQueueBacklog
          expr: sum by (namespace, name) (workqueue_depth{name=~"app_reconciliation_queue|app_operation_processing_queue"}) > 100
          for: 15m
          labels: {severity: warning}
          annotations:
            summary: "Argo CD queue {{ $labels.name }} depth > 100"
        - alert: ArgoCDReconcileSlow
          expr: histogram_quantile(0.95, sum by (le, dest_server) (rate(argocd_app_reconcile_bucket[10m]))) > 8
          for: 15m
          labels: {severity: info}
          annotations:
            summary: "P95 reconcile > 8s for {{ $labels.dest_server }}"
        - alert: ArgoCDGitFetchFailing
          expr: sum by (repo) (increase(argocd_git_fetch_fail_total[10m])) > 3
          labels: {severity: warning}
          annotations:
            summary: "git fetch failing for {{ $labels.repo }}"
        - alert: ArgoCDClusterUnreachable
          expr: argocd_cluster_connection_status == 0
          for: 5m
          labels: {severity: critical}
          annotations:
            summary: "Argo CD cannot reach cluster {{ $labels.server }}"
        - alert: ArgoCDKubectlBacklog
          expr: sum by (namespace) (argocd_kubectl_exec_pending) > 0
          for: 10m
          labels: {severity: info}
          annotations:
            summary: "kubectl executions are queuing (parallelism limit?)"
If you are reusing the environment from Lesson 6 Lesson 6 installed a slim prometheus chart (29.47.2, Prometheus v3.16.0),rather than kube-prometheus-stack, so there are no ServiceMonitor / PrometheusRule CRDs. In that case: ① have the chart's kubernetes-service-endpoints scrape jobs discover Argo CD via annotations — add annotations to the three metrics Services in argocd-values:
controller:
  metrics:
    enabled: true
    service:
      annotations: {prometheus.io/scrape: "true", prometheus.io/port: "8082"}
repoServer:
  metrics:
    enabled: true
    service:
      annotations: {prometheus.io/scrape: "true", prometheus.io/port: "8084"}
server:
  metrics:
    enabled: true
    service:
      annotations: {prometheus.io/scrape: "true", prometheus.io/port: "8083"}
② Put the spec.groups content into the prometheus chart's serverFiles."alerting_rules.yml" (that is, groups: list) after helm upgrade. For annotation discovery and key names, follow the Lesson 6 values and the prometheus chart README.

Notes:argocd_app_reconcile 's largest bucket is 16 seconds, so do not set thresholds above 16; the sync-loop threshold of 6 times / 30 minutes is an empirical value, so adjust it to your team's release frequency. Common mistakes: PrometheusRule is missing the release: kps label, so Prometheus does not load it.

Log queries

# The 5 slowest reconciliations (JSON logs)
kubectl -n argocd logs sts/argocd-application-controller --since=30m \
  | jq -rc 'select(.msg=="Reconciliation completed") | [.time_ms, .application] | @tsv' 2>/dev/null | sort -rn | head -5
# Auto-sync / self-heal backoff
kubectl -n argocd logs sts/argocd-application-controller --since=30m | grep -E 'Initiated automated sync|Skipping auto-sync' | tail

Lab 4: make the alerts actually fire (about 6 minutes)

Preparation: choose one of two environments — ① the slim prometheus chart from Lesson 6: following the callout on the “Commands” page, add scrape annotations to the metrics Services and put the rules into serverFiles."alerting_rules.yml"; ② the kube-prometheus-stack from the Prometheus lesson (release kps, namespace monitoring): use the ServiceMonitor snippet and kubectl apply -f argocd-alerts.yaml. Without Prometheus, you can observe metric changes with curl alone (skip step 4).
Record the baseline:
curl -s localhost:8082/metrics | grep -E '^argocd_app_sync_total\{.*name="fault-lab"'
Inject a sync loop (equivalent to fb inject F1), then check the count 10 minutes later:
~/gitops-lab/scripts/fault-box.sh inject F1
sleep 600
curl -s localhost:8082/metrics | grep -E '^argocd_app_sync_total\{.*name="fault-lab".*Succeeded'
kubectl -n argocd logs sts/argocd-application-controller --since=10m | grep fault-lab | grep -cE 'Initiated automated sync'
argocd_app_sync_total{dest_server="https://kubernetes.default.svc",dry_run="false",name="fault-lab",namespace="argocd",phase="Succeeded",project="default"} 9
7
Confirm in Prometheus:
kubectl -n monitoring port-forward svc/kps-kube-prometheus-stack-prometheus 9090:9090 &
curl -s 'localhost:9090/api/v1/query' --data-urlencode 'query=sum by (name) (increase(argocd_app_sync_total{phase="Succeeded"}[30m]))' | jq '.data.result'
curl -s localhost:9090/api/v1/alerts | jq -r '.data.alerts[] | [.labels.alertname,.state] | @tsv'

The name above is the kps Service; in Lesson 6 the prometheus chart's Service is usually svc/prometheus-server (port 80; for the namespace, follow what you actually installed in Lesson 6): kubectl -n <ns> port-forward svc/prometheus-server 9090:80.

Reset: ~/gitops-lab/scripts/fault-box.sh reset; alerts clear automatically once the 30-minute window has passed.

Case 1: Grafana dashboards are blank after upgrading to v3

Problem: The old dashboards used argocd_app_sync_status and argocd_app_health_status (disabled by default since 1.5, requires ARGOCD_LEGACY_CONTROLLER_METRICS=true; removed completely in v3.0). Fix: change to sum by (sync_status) (argocd_app_info),sum by (health_status) (argocd_app_info); before upgrading, use the detection methods in the 2.14→3.0 upgrade notes to confirm the impact.

Case 2: one application synced 2000 times in a day

Problem: An Operator writes default fields into a CR; selfHeal keeps reverting them, and the Operator changes them back again. Everything looks normal in the UI. Discovered via theArgoCDSyncLoop alert. Fix: See Module 5 (ignoreDifferences + RespectIgnoreDifferences). Benefit: API Server write requests dropped by 30%.

Case 3: controller with 2 replicas, only half the application metrics visible

Problem: The team scraped the ClusterIP with Grafana Agent. Fix: Following the official recommendation, switch to Pod / Endpoint discovery, or use the Prometheus Operator's ServiceMonitor (scraping per Endpoint).

Common errors and fixes

No argocd_ metrics at all in Prometheus

Diagnosis:kubectl -n argocd get svc | grep metrics (whether the metrics service is enabled),kubectl -n argocd get servicemonitor --show-labels (whether it carries release: kps), and the Prometheus Targets page. Fix: Enable *.metrics.enabled and serviceMonitor.enabled, and add the label.

The argocd_app_condition metric does not exist

Cause: It is disabled by default. Fix: Set controller.metrics.application.conditions (comma-separated condition types), and restart the controller.

Deleted applications still appear in the metrics, and cardinality keeps growing

Cause: The metrics cache retains history. Fix:controller.metrics.cache.expiration Reset periodically (for example 24h0m0s, disabled by default).

histogram_quantile result is +Inf

Cause:argocd_app_reconcile The largest bucket is 16s, so everything above that falls into +Inf. Fix: Confirm that reconciliation really exceeds 16s, then look at the logs time_ms to locate the specific application; set thresholds below 16.

After ARGOCD_ENABLE_GRPC_TIME_HISTOGRAM is turned on, Prometheus memory spikes

Cause: The official documentation explicitly states that this metric is expensive to both query and store. Fix: Enable it only briefly, when investigating performance problems.

Command-line exercises
1. Write a PromQL query that counts applications by health status (v3-compatible).
sum by (health_status) (argocd_app_info)
2. Write a PromQL query that finds the 5 applications with the most sync failures in the past hour.
topk(5, sum by (name) (increase(argocd_app_sync_total{phase=~"Error|Failed"}[1h])))
Scenario analysis
On-call receives ArgoCDReconcileQueueBacklog (app_reconciliation_queue depth 400, sustained for 20 minutes). In what order do you investigate?

① Is it a sudden spike or sustained: did a large batch of merges or a Webhook storm just happen (server logs,argocd_webhook_requests_total). ② Is repo-server the bottleneck: argocd_repo_pending_request_total,parallelism_wait, the number of ComparisonErrors, and repo-server CPU. ③ The controller itself: whether its CPU / memory is maxed out, whether it just restarted (cache rebuild),argocd_app_reconcile P95. ④ Is any application syncing in a loop (ArgoCDSyncLoop) and continuously creating refreshes? ⑤ Remediation: temporarily raise status processors, scale out repo-server, add jitter to Webhook refreshes; long term: manifest-generate-paths, resource exclusions, sharding.

Verified instructional videos

▶
When GitOps Becomes the Bottleneck: Scaling Argo CD for High-Churn Platforms - S. Kanabar & V. Jain — CNCF [Cloud Native Computing Foundation]
English · identifying Argo CD bottlenecks on high-churn platforms (metrics and tuning)
▶
Extending Observability to the Application Lifecycle with ArgoCD, Flux...- Ana Medina & Adam Gardner — CNCF [Cloud Native Computing Foundation]
English · extending observability across the delivery lifecycle

Official documentation

Video storyboard (about 90 seconds)

Shot 1 · 0–20s
Visual: each of the three components lights up its 8082 / 8083 / 8084 port indicator.
Narration: the controller, server, and repo-server each have a metrics endpoint.
Shot 2 · 20–45s
Visual: one row of argocd_app_info is enlarged, with the sync_status and health_status labels highlighted.
Narration: in v3 the statuses are all on app_info's labels; the old metrics have been removed.
Shot 3 · 45–70s
Visual: the sync_total curve climbs like a staircase, non-stop, and the alert light turns from yellow to red.
Narration: the UI looks normal, but the metrics tell you it synced dozens of times in an hour.
Shot 4 · 70–90s
Visual: workqueue_depth piles up, and next to it repo-server's queue count rises in step.
Narration: when the queue backs up, first find out who is holding things up.
or score ≥ 70% on the quiz

Module 5 · Troubleshooting: OutOfSync loops and sync failures

28:00 – 35:00 · Permanent OutOfSync, flip-flopping self-heal, sync failures, ComparisonError — these happen at different stages of reconciliation. Identify the stage first, then find “the one fighting Argo CD over fields”
7 mindiff · managedFields · ignoreDifferences★★★★★
Learning objectives
  • Distinguish four kinds of problems: Persistent OutOfSync (comparison stage),OutOfSync loop (self-heal tug-of-war with other writers),sync failure (apply stage),ComparisonError (cannot obtain desired or live state).
  • Name the common causes of loops: HPA-managed replicas, mutating Webhooks, API Server defaults and normalization (1000m → 1), CRD defaults and preserveUnknownFields, Helm random functions, SSA field ownership, and two applications managing the same resource.
  • Use argocd app diff,--show-managed-fields, controller logs, and argocd_app_sync_total to find “the one fighting over fields,” and choose the right fix: remove the field from Git,ignoreDifferences + RespectIgnoreDifferences=true, or Server-Side Diff.
  • Read the original sync failure messages: one or more objects failed to apply (dry run),one or more objects failed to apply, reason: …,Failed last sync attempt to ….
Prerequisites: Lesson 1 Sync / Health status and self-heal; Lesson 2 Sync Options. Importance:★★★★★

What: how Argo CD decides “out of sync”

The controller gets the desired manifests rendered by repo-server, and compares each one against the live objects one by one. Before comparison, both sides are normalized (removing status— since v3 ignored by default for all resources, and applying ignoreDifferences, and unit normalization for known types). v3.6.1 has two diff strategies:

Legacy (client-side three-way diff)Server-Side Diff
How it worksUses kubectl.kubernetes.io/last-applied-configuration, desired, and live state for a three-way comparison: Fields that are neither written in Git nor applied last time are ignoredSends an SSA dry-run to the API Server and compares against the returned “predicted live state”; defaults and admission (validating) are taken into account
When to useDefaultSince 3.6: applications that enable ServerSideApply=true use it automatically; or the annotation argocd.argoproj.io/compare-options: ServerSideDiff=true; or controller.diff.server.side=true (global). ServerSideDiff=false The annotation has the highest priority
Mutating WebhookOnly changes to fields declared in Git count as a differenceDefault does not include changes from mutation webhooks; requires IncludeMutationWebhook=true
CostComputed locallyA dry-run request is generated on each refresh when the revision / resource version changes (cached)

(3.6 removed the old Structured-Merge Diff; SSA applications now always use Server-Side Diff.)

Why: how loops form

Once selfHeal selfHeal is enabled, whenever the live state drifts from Git the controller syncs again. If another “writer” in the cluster insists on its own value, a tug-of-war forms: Argo CD writes 2, HPA writes 3, Argo CD writes 2 again, and so on. v3's self-heal has exponential backoff (starting at 2s, ×3, capped at 300s), and the logs will show Skipping auto-sync: already attempted sync to … with timeout … (retrying in …)— backoff is a brake, not a fix.

Common causes and correct fixes

CauseEvidencePreferred fixAlternative
HPA management spec.replicasthe diff shows only replicas; in managedFields, replicas belong to kube-controller-manager (the process where the HPA controller runs; verify against your actual setup)In Git,delete replicas (left to HPA)ignoreDifferences /spec/replicas + RespectIgnoreDifferences=true
A mutating Webhook rewrites fields declared in Git (a policy engine enforces a specific value)Reverted within seconds after each sync; events or policy reportsMake Git match the policy (write the value the policy requires in Git)Write for that field ignoreDifferences (a jq expression)
Webhook injects new fields (sidecars, default labels)Legacy diff usually does not report it; Server-Side Diff + IncludeMutationWebhook=true reports it whenkeeps the default (mutation webhooks excluded)managedFieldsManagers Ignore that manager
Unit / format normalization (for example, in CRDs 1000m → 1,3072Mi → 3Gi,8760h → 8760h0m0s)the two sides in the diff “look the same”Write the normalized format in GitOfficial FAQ: customize the diff for known types
A misspelled / unknown field in Git (API Server drops it)the diff shows the live object is missing this fieldCorrect the field name (kubectl explain)—
The CRD's spec.preserveUnknownFields: false (v3 no longer ignores it by default)CRD OutOfSync after upgrading to v3Remove that field from the CRDOfficial ignoreDifferences snippet
Helm template uses randAlphaNum,genCA,nowdiffers on every render (the diff changes after a hard refresh)Switch to lookup a stable source other than it: external Secret management (Lesson 5)ignoreDifferences on that field
Two Applications manage the same resourceCondition SharedResourceWarning: Deployment/x is part of applications argocd/a and argocd/bkeep only one manager—
Under SSA, another manager keeps writing the same fieldtwo managers appear in managedFields; Argo CD applies in forced mode (argocd-controller manager; verify against your actual setup)Clarify field ownership; Git no longer declares fields that the other side ownsignoreDifferences + RespectIgnoreDifferences
Why is ignoreDifferences not enough?ignoreDifferences It only affects “comparison.” If a sync is triggered by another field, Argo CD will still apply the value from Git for replicas: 2 together with it, and HPA changes it back — another flap. Add the sync option RespectIgnoreDifferences=true, so that during sync the ignored fields keep their live values.
The one-time flap from deleting replicas from Git When Legacy client-side apply runs,last-applied-configuration still has replicas: 2, so after deletion the three-way merge will remove that field, the Deployment falls back to the default of 1 replica, and then HPA scales back up to min. In production, first add ignoreDifferences + RespectIgnoreDifferences, confirm stability, and only then delete the field; or do it in a low-traffic period.

Sync failures and ComparisonError (original source text)

StageMessage you seeMeaning
ComparisonComparisonError: Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: …Cannot obtain desired state (Git / rendering / repo-server; see Module 3)
ComparisonComparisonError: Failed to load live state: …Cannot obtain live state (cluster unreachable, permissions, cache)
ComparisonInvalidSpecError: Namespace for <name> <gvk> is missing.Namespace-scoped resource has no namespace and the application does not set a destination namespace
Sync (dry-run)one or more objects failed to apply (dry run)Pre-check stage: the API Server rejects (invalid field, CRD does not exist, admission rejection),and no object is written
Syncone or more objects failed to apply, reason: …Fails during the actual write (immutable field, permissions, Webhook)
Syncone or more synchronization tasks completed unsuccessfully, reason: …Hook / task failure
Auto-syncSyncError: Failed last sync attempt to [<sha>]: …The last auto-sync failed, and the same revision is not retried automatically (unless syncPolicy.retry is configured or there is a new commit)
Auto-syncSkipping sync attempt to …: auto-sync will wipe out all resourcesRendering result is empty and prune is enabled; the safeguard (allowEmpty)
Common misconceptions① “Just click Sync when OutOfSync” — if it is a loop, Sync only speeds up the tug-of-war. ② “Once ignoreDifferences is written, it won't be overwritten” — you also need RespectIgnoreDifferences=true. ③ “Turning off selfHeal solves it” — it only stops the tug-of-war; the drift remains, and you lose self-healing. ④ “ComparisonError is a cluster problem” — most are Git / rendering problems; read to the part after the last colon. ⑤ “Auto-sync will keep retrying after a sync failure” — by default, the same revision is not retried automatically after it fails.

Anatomy of an OutOfSync loop

Gitreplicas: 2 Argo CD comparesdesired 2 ≠ live 3 → OutOfSync selfHeal syncswrites back 2 (backoff 2s→6s→…→300s) Another writerHPA: min 3 → writes back 3 Evidencesync_total keeps growing Triggers watch events
Figure 5-1: a loop needs three conditions: Git declares a field, another writer also writes it, and auto-sync has selfHeal enabled

Diagnostic decision: identify the stage first

Application abnormalargocd app get Has a ComparisonError condition Operation failed (SyncFailed) Sync succeeds but still / repeatedly OutOfSync → Module 3: rendering / Git / repo-server; Failed to load live state → cluster → --show-operation: dry run? which object? the API Server's original message → app diff → managedFields → find the writer → choose the fix
Figure 5-2: the three paths correspond to three entirely different fix directions

Core animation: diagnosing the causes of OutOfSync loops

① Choose a cause and “play the loop,” and observe the tug-of-war between Argo CD and the other writer, along with self-heal backoff; ② click “Collect evidence” to see what the real diagnostic commands return; ③ choose a fix and see whether the loop actually stops, and why.

Git (desired)
—
Cluster (live)
—
Other writer
—
Sync count 0Synced
Choose a cause.
$ argocd app get fault-lab

Core commands

CommandDescription
argocd app diff APPDiff of desired vs live; exit code 1 when there are differences (usable in CI)
argocd app diff APP --server-side-generateGenerate the desired manifests on the server side and then diff (no dependency on local tools)
argocd app get APP --show-operationStatus, message, and per-resource results of the most recent operation
argocd app history APPSync history; during a loop, you will see the same revision deployed repeatedly
argocd app resources APP --output tree=detailedSync / health status of each resource (parameter format depends on your actual version)
kubectl get deploy X -o yaml --show-managed-fieldsWhich manager wrote which fields, and when
argocd app set APP --sync-option RespectIgnoreDifferences=trueRespect ignoreDifferences during sync (recommended: put it in the Application in Git)
argocd admin settings resource-overrides ignore-differences ./deploy.yamlVerify the effect of system-level ignoreDifferences rules offline (requires a local argocd-cm; verify against your actual setup)
argocd app diff fault-lab; echo "exit=$?"
kubectl -n faults get deploy faulty -o json --show-managed-fields \
  | jq -r '.metadata.managedFields[] | [.manager, .operation, (.subresource // "-"), .time] | @tsv'
===== apps/Deployment faults/faulty ======
@@ ... @@
-  replicas: 3
+  replicas: 2
exit=1
argocd-controller        Update  -       2026-11-17T08:01:12Z
kube-controller-manager  Update  scale   2026-11-17T08:01:15Z
kube-controller-manager  Update  status  2026-11-17T08:01:20Z

How to read it:subresource=scale 's writes come from the HPA (via the scale subresource), and they come later than Argo CD's writes — this is the “one fighting over the field.” When Argo CD applies with a kubectl client, the manager name may be argocd-controller or argocd-application-controller, verify against your actual setup.

Fix syntax (the Application in Git)

spec:
  ignoreDifferences:
    - group: apps
      kind: Deployment
      name: faulty
      jsonPointers:
        - /spec/replicas
  syncPolicy:
    automated: {prune: true, selfHeal: true}
    syncOptions:
      - CreateNamespace=true
      - RespectIgnoreDifferences=true
resource.customizations.ignoreDifferences.apps_Deployment: |
  managedFieldsManagers:
    - kube-controller-manager

Lab 5: HPA fights over replica count → diagnose → two fixes; then look at sync failures and ComparisonError (about 7 minutes)

Inject: fb inject F1 (create an HPA with minReplicas 3). After 1–2 minutes, observe:
kubectl -n faults get deploy faulty -w            # READY bounces between 2 and 3; press Ctrl-C to stop
argocd app history fault-lab | tail -5
kubectl -n argocd logs sts/argocd-application-controller --since=5m | grep fault-lab | grep -E 'Initiated automated sync|Skipping auto-sync' | tail -4
... "msg":"Initiated automated sync to '3f2a9c1...'" ...
... "msg":"Skipping auto-sync: already attempted sync to [3f2a9c1...] with timeout 0s (retrying in 17.2s)" ...

The backoff gets longer and longer (2s → 6s → 18s → …, capped at 300s); verify the exact format against your actual output.

Diagnosis: run the argocd app diff and managedFields query from the “Commands” page, to confirm that the HPA (scale subresource) is writing replicas.
Fix A (immediate stop-gap): in argocd/apps/fault-lab.yaml add ignoreDifferences and RespectIgnoreDifferences=true (see the “Commands” page), then:
cd ~/gitops-lab && git commit -qam "fault-lab: let HPA own replicas" && git push -q
kubectl apply -f argocd/apps/fault-lab.yaml
argocd app get fault-lab | grep -E 'Sync Status|Health Status'
kubectl -n faults get deploy faulty     # stable at 3/3
Fix B (root-cause fix): from apps/faults/deployment.yaml delete replicas: 2 and push; watch for the one-time flap of “falling back to 1 and then being scaled back up to 3 by the HPA” (the hint on the Principles page). After this step, you can remove the ignoreDifferences from Fix A.
Sync failure: fb reset after fb inject F4 (Service type: Invalid).
argocd app get fault-lab --show-operation | sed -n '/Operation:/,$p' | head -20
Operation:          Sync
Phase:              Failed
Message:            one or more objects failed to apply (dry run)
...
GROUP  KIND     NAMESPACE  NAME          STATUS     HEALTH  HOOK  MESSAGE
       Service  faults     faulty-extra  OutOfSync                Service "faulty-extra" is invalid: spec.type: Unsupported value: "Invalid": supported values: "ClusterIP", "ExternalName", "LoadBalancer", "NodePort"

Check the conditions a few minutes later: SyncError Failed last sync attempt to [<sha>]: one or more objects failed to apply (dry run)— the same commit is not retried automatically. Fix: in Git, delete the file and its reference in kustomization (or fb reset).

ComparisonError: fb reset after fb inject F3 (the kustomization references missing.yaml).
argocd app get fault-lab --refresh | grep -A2 CONDITION
CONDITION        MESSAGE
ComparisonError  Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = `kustomize build /tmp/_argocd-repo/<uuid>/apps/faults` failed exit status 1: Error: accumulating resources: accumulation err='accumulating resources from 'missing.yaml': evalsymlink failure on '.../apps/faults/missing.yaml' : lstat ...: no such file or directory': must build at directory: not a valid directory: ...

Reproduce locally: kubectl kustomize ~/gitops-lab/apps/faults will produce the same kustomize error. Finally fb reset.

Case 1: Istio injection causes all apps to be OutOfSync under Server-Side Diff

Problem: The platform turned on controller.diff.server.side and added IncludeMutationWebhook=true to all applications, with the result that every Pod template showed differences because of sidecar-injected fields. Fix: Remove IncludeMutationWebhook (by default, Webhook changes are not included). Lesson: Include it only when a Webhook rewrites fields declared in Git and you want to see that difference.

Case 2: Kyverno enforces resource limits, and the application syncs every 5 minutes

Problem: The policy changes all containers' limits.memory to 512Mi, while Git says 1Gi. Fix: Not ignoreDifferences; instead, change Git to the value the policy requires, and pre-check with the policy engine's CLI in CI. Principle: If Git can tell the truth, do not “ignore” it.

Case 3: a batch of CRDs OutOfSync after upgrading to v3

Problem: Old CRDs contain spec.preserveUnknownFields: false, which v3 no longer ignores by default. Fix: Remove the field from the CRD (officially recommended); during the transition, use the ignoreDifferences given in the upgrade notes. See Module 7.

Case 4: Helm chart generates a new password on every render

Problem: The chart uses randAlphaNum to generate a Secret; Argo CD sees a difference on every refresh, and auto-sync actually rotates the password, disconnecting the application. Fix: Switch to an external Secret (Lesson 5: ESO / Sealed Secrets), and in the chart existingSecret.

Common errors and fixes

Sync succeeds, but the application immediately flips back to OutOfSync; the same commit was deployed dozens of times in history

Assessment: A loop. Diagnosis:argocd app diff Check which field → --show-managed-fields find the writer → controller logs Skipping auto-sync: already attempted sync …. Fix: Follow the cause table on the Principles page.

ignoreDifferences is written and the diff disappears, but after each sync the replica count still briefly reverts to 2

Cause: Missing RespectIgnoreDifferences=true, so sync still applies the value from Git. Fix: Add that sync option.

one or more objects failed to apply (dry run); the resource message is the server could not find the requested resource

Cause: The CRD for the CR does not exist yet (it is created only within the same sync, or is provided by another application). Fix: Put the CRD in an earlier sync wave; or add an annotation to the CR argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true.

one or more objects failed to apply, reason: Deployment.apps "x" is invalid: spec.selector: ... field is immutable (verify against your actual output)

Cause: An immutable field was changed (selector, Job template, etc.). Fix: After evaluating, use Replace=true or Force=true,Replace=true sync option (this deletes and recreates the resource), or rename and publish a new resource.

SyncError: Failed last sync attempt to [abc123]: … The cluster problem is fixed, but it does not sync automatically

Cause: After a failure on the same revision, auto-sync does not retry. Fix: Manually argocd app sync, or push a new commit; long term, configure syncPolicy.retry (limit, backoff).

SharedResourceWarning: ConfigMap/x is part of applications argocd/a and argocd/b

Cause: Two applications render the same resource, so they overwrite each other and prune each other. Fix: Let only one application manage it (remove it from the other one's source).

podinfo's Rollout stays OutOfSync; the diff only shows that resources.requests.cpu is written differently (for example, 100m vs. 0.1)

Cause: A known issue in the official Diffing documentation: the Rollout CRD reuses PodSpec, so IntOrString and similar types with custom serialization make the same value appear in different formats. Fix: Write the API Server's normalized format in Git; or, following the Diffing documentation's “Known Kubernetes types in CRDs,” declare the known type for argoproj.io/Rollout in argocd-cm to declare known-type fields.

The podinfo application's Health is Suspended, and auto-sync “does nothing”

Cause: This is not a sync problem: when the Lesson 6 canary Rollout pauses at a pause step, Argo CD reports Suspended. Diagnosis:kubectl argo rollouts get rollout podinfo -n podinfo-dev. Handling: Promote or abort following the release process; do not use Sync to “fix” it. Also check whether the project platform 's sync windows are currently in a blackout period (argocd proj windows list platform), and auto-sync outside the window is skipped.

Manually turning off selfHeal on an ApplicationSet-generated application, and it is turned back on within seconds — or you change it but the change is not reverted

Cause: The applicationset-controller reconciles and generates applications from the template; in Lesson 6, podinfo the ApplicationSet declares ignoreApplicationDifferences (/spec/syncPolicy), so only manual changes to syncPolicy are preserved (as an emergency switch); other fields are reverted. Temporarily turning off selfHeal while investigating an OutOfSync loop relies on exactly this; remember to restore it afterward.

Skipping sync attempt to [...]: auto-sync will wipe out all resources

Cause: The rendering result is empty (wrong path, wrong branch, or Kustomize filtered out all resources), and the safeguard blocks deleting all resources. Fix: Check the source; when you really need to empty it, set syncPolicy.automated.allowEmpty: true.

Command-line exercises
1. In CI, check whether Git and the cluster are consistent, and fail the pipeline if they are not.
argocd app diff podinfo-prod --refresh || { echo "drift detected"; exit 1; }
2. Find out who last wrote spec.replicas in faults/faulty.
kubectl -n faults get deploy faulty -o json --show-managed-fields \
  | jq -r '.metadata.managedFields[] | select(.fieldsV1."f:spec"."f:replicas" != null) | [.manager, (.subresource // "-"), .time] | @tsv'
Scenario analysis
An application's Deployment is synced every few minutes; the diff only shows one annotation in metadata.annotations example.com/last-scan that differs. That annotation is an initial value hard-coded in Git, and a security scanner keeps updating it. How do you fix it?

The root cause is that “Git declares a field maintained by someone else.” Preferred: delete this annotation from Git (so the scanner has sole ownership); if the initial value must be kept, use ignoreDifferences (jqPathExpressions: ['.metadata.annotations["example.com/last-scan"]'] or jsonPointers /metadata/annotations/example.com~1last-scan, note that / must be escaped as ~1) and add RespectIgnoreDifferences=true. Verify: argocd app diff no difference,argocd_app_sync_total no longer grows.

Verified instructional videos

▶
Argo CD Ignore Differences — Codefresh
English · how to use ignoreDifferences (combine with RespectIgnoreDifferences from this lesson)
▶
What's New in Argo CD 2.10? templatePatch for ApplicationSets, Server Side Diff, and more! — Akuity
English · background on Server-Side Diff (beta in 2.10; SSA applications use it by default since 3.6)

Official documentation

Video storyboard (about 90 seconds)

Shot 1 · 0–20s
Visual: two hands in a tug-of-war, with “replicas” written at the middle of the rope; the left hand is Argo CD and the right hand is HPA.
Narration: an OutOfSync loop is two writers in a tug-of-war.
Shot 2 · 20–45s
Visual: in the terminal, argocd app diff highlights only replicas; in managedFields, the scale subresource row is circled.
Narration: diff tells you which field; managedFields tells you who.
Shot 3 · 45–70s
Visual: ignoreDifferences covers the diff, but during sync the 2 gets written back; once RespectIgnoreDifferences is added, the rope goes slack.
Narration: ignoring a comparison is not the same as ignoring the application.
Shot 4 · 70–90s
Visual: three error bubbles float toward the “comparison,” “dry-run,” and “apply” stages.
Narration: identify the stage first, then read the cause after the last colon.
or score ≥ 70% on the quiz

Module 6 · Troubleshooting: stuck deletion, finalizers, and orphaned resources

35:00 – 42:00 · Deleting one Application can wipe out an entire environment, or delete nothing, or stay stuck on “Deleting” forever. Understand what finalizers mean, and deletion becomes predictable
7 minresources-finalizer.argocd.argoproj.io★★★★★
Learning objectives
  • Explain the three kinds of deletion: cascading foreground (resources-finalizer.argocd.argoproj.io, the default), cascading background (…/background), non-cascading (no finalizer / --cascade=false), and the difference between kubectl delete app and argocd app delete .
  • Locate the causes of stuck deletion: the child resource's own finalizer, target cluster unreachable, a broken repository that cannot generate manifests, failed deletion hooks, or the controller shard responsible for the cluster missing; read DeletionError and events Unable to delete application resources: ….
  • Safely unblock a stuck deletion: resolve the child resources first, remove the Application's finalizer only as a last resort, and know what that leaves behind.
  • Use the AppProject's orphanedResources to detect orphaned resources, and understand the deletion behavior of App of Apps and ApplicationSet (preserveResourcesOnDeletion).
Prerequisites: Kubernetes finalizers and cascading deletion; Lesson 3 ApplicationSet. Importance:★★★★★

What: the finalizer on the Application determines deletion semantics

Finalizer on the ApplicationWhen an Application is deletedTypical source
resources-finalizer.argocd.argoproj.ioCascading, foreground: the controller deletes all managed resources and waits for them to disappear, then removes the finalizer; only then does the Application disappearargocd app delete APP (added automatically); in the Application in Git, it is written explicitly as
resources-finalizer.argocd.argoproj.io/backgroundCascading, background: after issuing the delete, it does not wait for the resources to actually disappear--propagation-policy background
(none)Non-cascading: only the Application is deleted; all resources stay in the cluster (becoming “ownerless” resources)kubectl delete app and has no finalizer; argocd app delete --cascade=false (the finalizer is removed first)
pre-delete-finalizer.argocd.argoproj.io / post-delete-finalizer.argocd.argoproj.io (with a stage suffix)runs PreDelete / PostDelete hooks; a failed hook blocks deletionis managed automatically by the controller when deletion hooks exist in the application

How: the process of one cascading deletion (finalizeApplicationDeletion)

  1. The Application gets deletionTimestamp (the UI shows Deleting).
  2. The controller (the shard responsible for the target cluster) fetches the target cluster and runs the PreDelete hook (if any).
  3. Lists the “allowed” managed resources (restricted by the AppProject) and deletes them one by one according to the foreground / background policy.
  4. Waits for the resources to disappear (foreground). If a child resource has its own finalizer and its controller does not process it, this step never completes.
  5. Runs the PostDelete hook (if any), removes the finalizer, and the API Server deletes the Application.

On error, the controller sets the condition DeletionError (the message is the error itself), and emits a Warning event Unable to delete application resources: <error>; once deletion progresses again, this condition is cleared.

Five causes of stuck deletion

CauseEvidenceCorrect handling
Child resource has its own finalizer (the Operator was uninstalled, the PVC is still in use, or the external controller is down)Child resource has deletionTimestamp and finalizers non-emptyRestore the corresponding controller first; only after confirming that external resources are cleaned up, manually remove the child resource's finalizer
Target cluster unreachable / removed from Argo CDDeletionError mentions the cluster; argocd cluster listRestore the cluster connection; remove the Application finalizer only when the cluster has been permanently destroyed
Repository deleted / corrupted, so manifests cannot be generatedComparisonError Also present:Official FAQ: fix the repository, or --cascade=false clean up resources manually after deletion
Deletion hook failedpre/post-delete finalizer still present; hook Job failedFix the hook, or delete the hook resource
The responsible controller shard is missing (fault F8)application status is not updated for a long time; argocd admin cluster statsFix the shard configuration

Orphaned resources (Orphaned Resources)

“Orphaned resources” refers to resources that exist in the target namespace but do not belong to any Application. Enabling spec.orphanedResources.warn: true in the AppProject causes the application to show the condition OrphanedResourceWarning: Application has N orphaned resources (original source text), and it is listed in the UI / argocd app resources APP --orphaned ; ignore The list can exclude known objects (such as auto-generated ConfigMaps kube-root-ca.crt). Metric argocd_app_orphaned_resources_count. Common sources of orphaned resources: leftovers from non-cascading deletion, and someone kubectl apply changed something outside Git, and resources deleted during the first sync after v3 switched from label tracking to annotation tracking (a known edge case in the upgrade notes).

Deletion of App of Apps and ApplicationSet

  • App of Apps: when a parent application deletes a child Application, whether the child has its own finalizer determines whether its resources are cascaded. To make “deleting the parent deletes everything,” the child Applications must also carry resources-finalizer.argocd.argoproj.io.
  • ApplicationSet: deleting an ApplicationSet deletes the Applications it generates; the Lesson 3 podinfo ApplicationSet sets preserveResourcesOnDeletion: true, and the generated applications have no finalizer, so after deleting the ApplicationSet, podinfo's workloads are kept. Also,directly editing a generated Application will be reverted by the applicationset-controller— to change it, change the ApplicationSet template (see kubectl -n argocd logs deploy/argocd-applicationset-controller).
  • CreateNamespace=true A namespace that was created is not a managed resource, so deleting the application usually does not delete it (verify against your actual setup).
Common misconceptions① “kubectl delete app will delete resources” — this happens only when the Application has a finalizer. ② “If it's stuck, just remove the Application's finalizer” — this makes Argo CD give up on cleanup; all resources become orphans, and the stuck child resources remain stuck. ③ “Non-cascading deletion is dangerous” — on the contrary, it is the standard way to keep workloads during migrations (changing project, namespace, or instance); after rebuilding the Application, it re-adopts them via tracking annotations. ④ “Deleting an ApplicationSet always deletes all workloads” — it depends on preserveResourcesOnDeletion and the finalizer on the generated applications.

Cascading deletion state machine

delete requestdeletionTimestamp PreDelete hook(if any) Delete managed resourcesforeground / background Wait for disappearanceChild resource finalizer? Remove finalizerApplication disappears Stuck pointsCluster unreachable · manifest generation failure · hook failure → DeletionErrorChild resource finalizer not handled → waits forever (no error!)
Figure 6-1: the most hidden kind of stuck deletion has no error condition at all: Argo CD is simply waiting for a child resource that will never disappear

Results of the three deletion methods

Cascading · foreground (default)Resources are deleted firstApplication disappears lastSafest, and the most likely to “get stuck” Cascading · backgroundRemoves the finalizer as soon as the delete is issuedCleanup finished by Kubernetes GCFast, but you cannot see whether cleanup has completed Non-cascadingOnly the Application is deletedResources are kept (can be adopted by a new application)Used during migration
Figure 6-2: before choosing a deletion method, ask: should the resources stay? Should I wait for them to actually disappear?

Interactive: deletion state machine simulator

Choose the Application's finalizer and a “blocker,” click delete, and observe each step. After it gets stuck, try different handling approaches and see the results and side effects.

Choose a configuration, then delete.
$ kubectl -n argocd get app fault-lab -w

Core commands

CommandDescription
argocd app delete APP --cascade --propagation-policy foregroundCascading foreground delete (default)
argocd app delete APP --cascade=falseNon-cascading: keep resources
kubectl -n argocd get app APP -o jsonpath='{.metadata.deletionTimestamp} {.metadata.finalizers}'Whether it is being deleted, and which finalizers remain
argocd app resources APPWhich managed resources remain
argocd app resources APP --orphanedList orphaned resources (requires orphaned-resource detection enabled in the AppProject)
kubectl get KIND NAME -o jsonpath='{.metadata.deletionTimestamp} {.metadata.finalizers}'Why child resources do not disappear
kubectl -n argocd get events --field-selector involvedObject.name=APPUnable to delete application resources: … Events
kubectl -n argocd patch app APP --type merge -p '{"metadata":{"finalizers":null}}'Last resort: give up cleanup; the Application disappears immediately, and the remaining resources become orphans
# Find all objects in the namespace that are “being deleted but stuck on a finalizer”
kubectl api-resources --verbs=list --namespaced -o name \
  | xargs -n1 kubectl -n faults get --ignore-not-found -o json 2>/dev/null \
  | jq -r '.items[]? | select(.metadata.deletionTimestamp) | [.kind, .metadata.name, (.metadata.finalizers|join(","))] | @tsv'
ConfigMap	faulty-config	faults.example.com/hold

Enable orphaned-resource alerts in the AppProject

spec:
  orphanedResources:
    warn: true
    ignore:
      - kind: ConfigMap
        name: kube-root-ca.crt

Lab 6: stuck deletion, non-cascading deletion, and orphaned resources (about 7 minutes)

Inject: fb inject F6 (add a finalizer with no controller handling it to the ConfigMap, then cascade-delete fault-lab).
sleep 20
kubectl -n argocd get app fault-lab -o jsonpath='{.metadata.deletionTimestamp}{"  "}{.metadata.finalizers}{"\n"}'
argocd app resources fault-lab
kubectl -n faults get deploy,svc,cm
2026-11-17T08:30:02Z  ["resources-finalizer.argocd.argoproj.io"]
GROUP  KIND       NAMESPACE  NAME           ORPHANED
       ConfigMap  faults     faulty-config  No
NAME                         DATA   AGE
configmap/faulty-config      1      40m
configmap/kube-root-ca.crt   1      40m

The Deployment and Service have been deleted, and the Application still exists because it is waiting for the ConfigMap to disappear; the ConfigMap is stuck on its own finalizer. Note: at this point there is no error condition at all.

Diagnosis: use the script from the “Commands” page to find the stuck objects and finalizers.
Correct fix: confirm faults.example.com/hold Once there are no external resources behind it that need cleaning up, remove the child resource's finalizer.
kubectl -n faults patch configmap faulty-config --type merge -p '{"metadata":{"finalizers":null}}'
kubectl -n argocd get app fault-lab 2>&1 | tail -1
Error from server (NotFound): applications.argoproj.io "fault-lab" not found
Non-cascading deletion + re-adoption:
fb reset
argocd app delete fault-lab --cascade=false --yes
kubectl -n faults get deploy faulty            # still running
kubectl -n faults get deploy faulty -o jsonpath='{.metadata.annotations.argocd\.argoproj\.io/tracking-id}{"\n"}'
kubectl apply -f ~/gitops-lab/argocd/apps/fault-lab.yaml
argocd app get fault-lab | grep -E 'Sync Status|Health Status'
faulty   2/2   2   2   45m
fault-lab:apps/Deployment:faults/faulty
Sync Status:        Synced to main (3f2a9c1)
Health Status:      Healthy

Tracking annotation format <app name>:<group>/<kind>:<namespace>/<name> (v3 uses annotation tracking by default, consistent with Lesson 1); a new application with the same name can adopt the resources directly, with no interruption.

Orphaned resources: temporarily enable alerts for the default project that fault-lab belongs to, and create an orphan.
kubectl -n argocd patch appproject default --type merge -p '{"spec":{"orphanedResources":{"warn":true}}}'
kubectl -n faults create configmap stray --from-literal=who=kubectl
argocd app get fault-lab --refresh | grep -A2 CONDITION
argocd app resources fault-lab --orphaned
# Reset
kubectl -n faults delete configmap stray
kubectl -n argocd patch appproject default --type json -p '[{"op":"remove","path":"/spec/orphanedResources"}]'
CONDITION                MESSAGE                                  LAST TRANSITION
OrphanedResourceWarning  Application has 2 orphaned resources     ...
GROUP  KIND       NAMESPACE  NAME              ORPHANED
       ConfigMap  faults     kube-root-ca.crt  Yes
       ConfigMap  faults     stray             Yes

Case 1: deleting a test-environment application got stuck for 3 days

Problem: The application had a CR for a cloud database; its Operator was uninstalled first, so nobody processed the CR's finalizer anymore, and foreground deletion kept waiting. Someone removed the Application's finalizer, and as a result 40 resources were left unmanaged in the namespace. Fix: Reinstall the Operator so it completes cleanup (the cloud database is deleted along with it), then delete the application. Lesson: Deletion order: delete the application first, then uninstall the Operator. If the Operator is also managed by Argo CD, place it in a later deletion stage (for example, as a separate application deleted last).

Case 2: migrating to a new AppProject with zero production downtime

Fix: Non-cascading delete of the old Application → create it in the new project with the same name → the first sync only compares (the tracking annotations match, so it goes straight to Synced). Note: If the application name changed, the tracking annotations do not match, and the new application treats the existing resources as “someone else's.” You need to sync once first to update the annotations, and during that time you may see SharedResourceWarning.

Case 3: dozens of applications cannot be deleted after the cluster was decommissioned

Problem: The cluster was already destroyed and its Secret deleted; all Applications are stuck in Deleting, with the condition DeletionError. Fix: After confirming the cluster is permanently unavailable, remove the finalizers from these Applications in bulk: kubectl -n argocd get app -o name | xargs -I{} kubectl -n argocd patch {} --type merge -p '{"metadata":{"finalizers":null}}' (be sure to filter by label first so that only the applications for this cluster are affected). Lesson: The order for decommissioning a cluster is: delete the applications → wait for cleanup to finish → then remove the cluster.

Common errors and fixes

Application keeps showing Deleting, with no error condition at all

Cause: Most likely a child resource is stuck on its own finalizer (foreground deletion is waiting). Diagnosis:argocd app resources APP Check what remains, then check their finalizers. Fix: Restore the corresponding controller, or after confirming it is safe, remove the child resource's finalizer.

DeletionError / event: Unable to delete application resources: …

Cause: The text after the colon is the real cause: cluster connection failure, insufficient permissions (the controller's ServiceAccount lacks delete permission), inability to generate manifests, project permission check failure, and so on. Fix: Handle according to the cause; remove the Application finalizer only when recovery is permanently impossible.

The repository was deleted, and the application also cannot be deleted (ComparisonError at the same time)

Cause: Official FAQ: Argo CD cannot delete an application when it cannot generate manifests. Fix: Restore the repository, or argocd app delete APP --cascade=false then delete the resources manually.

After kubectl delete app, the workloads are still running

Cause: The Application does not have resources-finalizer.argocd.argoproj.io (for example, the podinfo application generated by the Lesson 3 ApplicationSet does not). Fix: When you need cascading, first kubectl patch app APP -p '{"metadata":{"finalizers":["resources-finalizer.argocd.argoproj.io"]}}' --type merge then delete, or use argocd app delete.

Manually editing an Application generated by an ApplicationSet (for example, adding ignoreDifferences) gets reverted within seconds

Cause: The applicationset-controller continuously reconciles the applications it generates from the template. Fix: Change the ApplicationSet's template / templatePatch; temporarily, you can configure ignoreApplicationDifferences (follow Lesson 3 and the official documentation).

After upgrading to v3, a batch of orphaned resources appeared, and deletion operations did not clean them up

Cause: A known edge case in the 2.14→3.0 upgrade notes: after switching from label tracking to annotation tracking, if the first sync includes a deletion, Argo CD does not recognize the resource. Fix: After upgrading, sync all applications once first (even if they are already synced) so the annotations get written; manually clean up any orphans already left behind.

Command-line exercises
1. Remove the application from Argo CD, but keep all running workloads.
argocd app delete podinfo-dev --cascade=false --yes
2. List all Applications in the argocd namespace that are being deleted (have a deletionTimestamp), along with their finalizers.
kubectl -n argocd get app -o json | jq -r '.items[] | select(.metadata.deletionTimestamp) | [.metadata.name, (.metadata.finalizers|join(","))] | @tsv'
Scenario analysis
You need to decommission cluster lab2, which has 15 Applications (some generated by an ApplicationSet). Write out a safe order of operations.

① Inventory: argocd app list --cluster lab2, confirm which ones are generated by an ApplicationSet, their finalizers, and preserveResourcesOnDeletion. ② Modify the ApplicationSet generator (for example, remove lab2's cluster label) so the controller deletes the corresponding applications; confirm that applications that need cascading deletion carry a finalizer. ③ For manually created applications, use argocd app delete --cascade, and watch deletion complete (no child resources stuck; when there are CRs managed by an Operator, delete the CRs before the Operator). ④ Confirm argocd app list --cluster lab2 is empty, then argocd cluster rm lab2. ⑤ Destroy the cluster last. If the order is reversed (destroying the cluster first), you can only remove the finalizers and clean up external resources elsewhere.

Verified instructional videos

▶
5 common Argo CD issues and how to fix them — Octopus Deploy
English · common Argo CD failures and approaches to fixing them

Official documentation

Video storyboard (about 90 seconds)

Shot 1 · 0–20s
Visual: the Application card has a “finalizer lock” hanging on it; after pressing delete, the card turns semi-transparent.
Narration: with this lock in place, Argo CD cleans up resources before letting go.
Shot 2 · 20–45s
Visual: the Deployment and Service disappear one after another; the ConfigMap also has someone else's lock on it and stops moving.
Narration: the most hidden kind of stuck deletion is a child resource's own finalizer.
Shot 3 · 45–70s
Visual: two buttons: “open the ConfigMap's lock” and “smash the Application's lock”; the latter turns the resources into gray orphans.
Narration: resolve the child resources first; removing the application's finalizer is the last resort.
Shot 4 · 70–90s
Visual: a stray ConfigMap appears in the namespace, marked with a yellow “orphan” tag.
Narration: enable orphanedResources so that things outside Git have nowhere to hide.
or score ≥ 70% on the quiz

Module 7 · Upgrades and disaster recovery: version migration, export, and restore

42:00 – 50:00 · Before upgrading, read the minor-version upgrade notes one by one and scan your configuration before acting. For disaster recovery, remember that everything in Argo CD lives in Kubernetes objects, which ideally should also be in Git from the start
8 minv2.14 → v3.0 → v3.6★★★★★
Learning objectives
  • List the breaking changes from v2.14 → v3.0 and how to detect them: fine-grained RBAC no longer inherits,logs, get enforced, default resource.exclusions, removing three legacy metrics, Dex sub → federated_claims.user_id, removing legacy repository configuration from argocd-cm, default annotation tracking, and so on.
  • Know the changes in each v3.x minor version that affect operations: starting from 3.3, the ApplicationSet CRD exceeds the client-side apply annotation limit (SSA required); 3.5 bundles Helm 4.2.0 and Source Integrity replaces GnuPG; 3.6 switches SSA applications to Server-Side Diff, and so on.
  • Upgrade the chart per checklist: read the notes → compare defaults → --dry-run=server → upgrade → verify → rollback plan.
  • Two DR paths: argocd admin export / import (includes Secrets, which must be stored encrypted) and “declarative rebuild from Git” (bootstrap + root application).
Prerequisites: Lesson 1 Helm installation; Lesson 3 App of Apps; Lesson 4 RBAC; Lesson 5 secrets management. Importance:★★★★★

What: Argo CD's versioning policy

Official upgrade overview: patch versions introduce no breaking changes; minor versions may have small changes that come with workarounds— upgrading from v3.2 to v3.6 means reading the four notes in sequence: 3.2→3.3, 3.3→3.4, 3.4→3.5, and 3.5→3.6; major versions have incompatible behavior changes; back up according to the disaster-recovery guide before upgrading. As of 2026-11, the maintained lines (3.6.x, 3.5.x, 3.4.x, and 3.3.x) are all still receiving patch releases (see GitHub Releases for the latest).

v2.14 → v3.0 breaking changes (official upgrade notes; each can be detected)

ChangeImpactDetection / fix
Fine-grained RBAC: update / delete no longer automatically applies to the application's child resourcesRoles that could previously delete Pods / modify resources suddenly lack permissionAdd to the roles that need it update/*,delete/* policy; or set server.rbac.disableApplicationFineGrainedRBACInheritance: "false" to restore v2 behavior
Log RBAC enforcement: server.rbac.log.enforce.enable has been removedUsers without logs, get cannot see Pod logsInstances without policy.default: role:readonly/admin are affected; add p, role:x, logs, get, */*, allow
as the default resource.exclusionsEndpoints, EndpointSlice, Lease, various Reviews, CSR, PolicyReport, cert-manager CertificateRequest, and high-churn Kyverno / Cilium objects are no longer watchedIf you manage these types in Git, you need to override the default exclusions
Removal of argocd_app_sync_status,argocd_app_health_status,argocd_app_created_timeOld dashboards / alerts stop workingSwitch to argocd_app_info 's labels (Module 4)
Dex: RBAC subjects change from sub to federated_claims.user_idPolicies written with Dex sub (base64 string) stop workingDecode the old sub to get the user_id, then rewrite the policy; the CLI must also be upgraded
Remove legacy repository configuration from argocd-cmrepositories,repository.credentials,helm.repositories no longer takes effectDetection command output [, , ] means unaffected; otherwise, migrate to repository Secrets
ApplicationSet applyNestedSelectors is ignoredNested selectors always take effectCheck the selectors of Matrix / Merge generators
Built-in Helm upgraded to 3.17.1In subchart values, the null will actually override it to nulldelete null objects from values
Default annotation tracking (previously labels)Labels are replaced with argocd.argoproj.io/tracking-id annotations; ApplyOutOfSyncOnly=true applications need an explicit sync once after upgrading; if the first sync includes a deletion, orphans may be producedkubectl get cm argocd-cm -n argocd -o jsonpath='{.data.application\.resourceTrackingMethod}'; you can set label to opt out; after upgrading, sync all applications once
Other behavior changesResource health is no longer written to the Application CR; status field is ignored for all resources; default ignoreResourceUpdates; no longer ignoring the CRD's preserveUnknownFields; plugins receive empty environment variables; project API responses are redacted; cluster.inClusterEnabled: "false" when in-cluster applications become UnknownCheck each item against the notes; health status can be written back via controller.resource.health.persist: "true" to restore writing

Changes worth operational attention in each v3.x minor

VersionChange
3.0 → 3.1Helm 3.18.4, Kustomize 5.7.0; the OIDC authorization code + PKCE flow is now handled server-side; v1 Actions API deprecated
3.1 → 3.2Hydrator paths must not be the root directory; respects .argocd-source.yaml the Kustomize version in; ApplicationSet status.resources defaults to a maximum of 5000 items
3.2 → 3.3ApplicationSet CRD exceeds the client-side apply annotation limit: kubectl apply reports metadata.annotations: Too long: may not be more than 262144 bytes, you must --server-side --force-conflicts; when Argo CD manages itself, the application needs ServerSideApply=true; using helm upgrade is not affected. Helm 3.19.2, Kustomize 5.8.0; --self-heal-backoff-cooldown-seconds Deprecated
3.3 → 3.4cluster version format changes (more detailed); gRPC DNS TXT queries disabled by default; Dex and go-oidc upgraded
3.4 → 3.5Built-in Helm 4.2.0: plain-HTTP OCI repositories require --insecure-oci-force-http; GnuPG signature verification is replaced by Source Integrity (AppProject's signatureKeys → sourceIntegrity, see Lesson 4); impersonation extended to server operations; repositories without credentials also use SSH known_hosts; repo-server supports mTLS
3.5 → 3.6OpenTelemetry-related environment variables renamed and sampler changes; local include now includes Helm helpers and Chart.lock; Applications with ServerSideApply=true enabled switch to Server-Side Diff (Validating Webhooks surface errors during the diff stage, and the API Server receives extra dry-run requests); health checks also run during deletion

How: chart upgrade process

  1. Determine the target: helm search repo argo/argo-cd --versions | head, note the chart version and appVersion.
  2. Read: the chart README's upgrade notes (chart major changes) + the Argo CD upgrade notes for each minor.
  3. Compare defaults: helm show values diff the old and new versions; confirm that the keys in your values still exist.
  4. Dry run: helm upgrade … --dry-run=server (or the helm-diff plugin).
  5. Back up: argocd admin export (see below).
  6. Upgrade and verify: all Pods Ready,argocd version, application status distribution (argocd_app_info), spot-check syncs.
  7. Rollback plan: helm rollback argocd <rev>; note that CRDs are installed by chart templates and kept by default (crds.keep). CRDs are not downgraded with rollback; read the notes before rolling back across majors.

Disaster recovery: two paths

argocd admin export / importDeclarative rebuild from Git
ContentsSettings ConfigMap, Secrets (repository / cluster credentials), Application, AppProject, and ApplicationSet in the Argo CD namespace (optionally other namespaces)bootstrap/ 's values + argocd/ Application / AppProject / ApplicationSet in
SecretThe export file contains plaintext Secrets, so it must be stored encryptedcome from ESO / Sealed Secrets (Lesson 5) —the Sealed Secrets private key must be backed up separately
StateIncluded by default status (sync history); --strip-status Yields clean manifestsNo history; recalculated on first sync
Use caseWarm standby, same-version migration, incident recoveryRebuild from scratch, consistency across environments, long-term standard practice

Commonly used parameters for import: --dry-run (print only the operations that would be executed),--prune (delete Secrets / applications / projects that are not in the backup),--stop-operation (stop operations in progress),--skip-resources-with-label,--override-on-conflict. Official tip: when the namespace is not the default, add -n, and argocd admin export will not report an error in the wrong namespace. Redis does not need to be backed up.

Common misconceptions① “Patch upgrades also require reading the notes” — no need; minor upgrades require it, and it is every single minor. ② “Upgrading with kubectl apply is enough” — starting from 3.3, the ApplicationSet CRD must be applied server-side. ③ “Putting the export file in Git makes it GitOps” — it contains plaintext credentials; what belongs in Git is the declarative manifests and encrypted secrets. ④ “Restoring re-deploys all workloads” — no; when the tracking annotations match, Argo CD considers the resources Synced directly.

Upgrade pipeline

Read the noteseach minor Scan configurationRBAC · metrics · tracking Compare valueshelm show values Back upadmin export Dry run + upgradedry-run=server VerifyPod · version · app_info On failure: helm rollback / admin import
Figure 7-1: back up before the “dry run,” because the dry run may reveal configuration that needs changing, and the pre-change state must also be kept on record

Dependency order for rebuilding from Git

1 New clusterkind / cloud 2 Secret rootSealed Secrets private key / ESO credentials 3 helm installbootstrap/*.yaml 4 Root applicationargocd/root.yaml 5 Everything comes backProjects · AppSets · applications
Figure 7-2: the only thing that cannot be obtained from Git is the “key that decrypts the secrets in Git” — it must have a separate backup

Interactive: v3 upgrade impact scanner

Paste your argocd-cm,argocd-rbac-cm, Helm values, alert rules, or upgrade script snippets (defaults to a “v2-era” example), then click scan. Rules come from the 2.14→3.0 and each 3.x upgrade notes; matching is a text heuristic, for use as a checklist only.

Pre-upgrade checks (from the official upgrade notes)

# Legacy repository configuration (output [, , ] means unaffected)
kubectl get cm argocd-cm -n argocd -o=jsonpath="[{.data.repositories}, {.data['repository\.credentials']}, {.data['helm\.repositories']}]"; echo
# Resource tracking method (empty or label = will switch to annotation)
kubectl get cm argocd-cm -n argocd -o jsonpath='{.data.application\.resourceTrackingMethod}'; echo
# Applications using ApplyOutOfSyncOnly (need one explicit sync after upgrading)
kubectl get applications.argoproj.io -A -o json | jq -r '.items[] | select(.spec.syncPolicy.syncOptions[]? == "ApplyOutOfSyncOnly=true") | .metadata.name'
# Log RBAC: whether there is a default role
kubectl get cm argocd-rbac-cm -n argocd -o jsonpath='{.data.policy\.default}'; echo

Chart upgrade

helm repo update
helm search repo argo/argo-cd --versions | head -5
CUR=$(helm -n argocd list -o json | jq -r '.[] | select(.name=="argocd") | .chart' | sed 's/argo-cd-//')
NEW=10.18.0                                  # target version
helm show values argo/argo-cd --version "$CUR" > /tmp/values-$CUR.yaml
helm show values argo/argo-cd --version "$NEW" > /tmp/values-$NEW.yaml
diff -u /tmp/values-$CUR.yaml /tmp/values-$NEW.yaml | less
helm upgrade argocd argo/argo-cd -n argocd --version "$NEW" -f ~/gitops-lab/bootstrap/argocd-values.yaml --dry-run=server > /dev/null && echo "dry-run OK"
helm upgrade argocd argo/argo-cd -n argocd --version "$NEW" -f ~/gitops-lab/bootstrap/argocd-values.yaml --wait --timeout 10m
argocd version --short
helm -n argocd history argocd | tail -3

Backup and restore

CommandDescription
argocd admin export -n argocd > backup.yamlExport (including status)
argocd admin export -n argocd --strip-status -o backup.yamlClean manifests, directly usable with kubectl apply
argocd admin export -n argocd --application-namespaces 'team-*'Also export applications in other namespaces (apps-in-any-namespace)
argocd admin import -n argocd --dry-run - < backup.yamlDry-run import
argocd admin import -n argocd --stop-operation - < backup.yamlImport and stop operations in progress
age -r <public key> -o backup.yaml.age backup.yamlEncrypt the backup (choose any encryption tool)

Lab 7: export → “disaster” → import restore; upgrade dry run (about 7 minutes)

Export (the CLI and server must be the same version):
mkdir -p ~/argocd-backup && cd ~/argocd-backup
argocd admin export -n argocd > backup-$(date +%F).yaml
grep -E '^kind:' backup-*.yaml | sort | uniq -c
      6 kind: Application
      1 kind: ApplicationSet
      4 kind: AppProject
      3 kind: ConfigMap
      5 kind: Secret

Opening the file, you can see argocd-secret and the contents of the repository / cluster Secrets —do not commit it to Git, and after the lab delete it or encrypt it.

Create a “disaster”: non-cascading delete fault-lab (workloads are retained), and delete platform as well as one project … here, deleting fault-lab alone is enough.
argocd app delete fault-lab --cascade=false --yes
kubectl -n argocd get app fault-lab 2>&1 | tail -1
kubectl -n faults get deploy faulty
Dry-run and import:
argocd admin import -n argocd --dry-run - < backup-$(date +%F).yaml | grep -i fault-lab
argocd admin import -n argocd - < backup-$(date +%F).yaml | grep -i fault-lab
argocd app get fault-lab | grep -E 'Sync Status|Health Status'
/Application fault-lab created (dry run)
/Application fault-lab created
Sync Status:        Synced to main (3f2a9c1)
Health Status:      Healthy

The Deployment's Pods were not rebuilt (kubectl -n faults get pods 's AGE is unchanged): the tracking annotations match, so Argo CD takes over directly.

Upgrade dry run: run the detection script from the “Commands” page against the current version, and helm upgrade --dry-run=server; apply the scanner (Animation page) to your argocd-values.yaml.
Cleanup: shred -u ~/argocd-backup/*.yaml (or keep it after encryption).

Case 1: after upgrading to 3.0, developers cannot see Pod logs

Problem: The instance does not have policy.default, and custom roles only have applications, get. Fix: Following the official “fix per policy” guidance, for each role with applications, get add logs, get (project-level or global). Lesson: The Detection section of the upgrade notes can be run before upgrading.

Case 2: a self-managed Argo CD upgrade to 3.3 failed

Problem: Argo CD manages itself with a Kustomize application, and sync reports CustomResourceDefinition "applicationsets.argoproj.io" is invalid: metadata.annotations: Too long: may not be more than 262144 bytes. Fix: Add to that application ServerSideApply=true (Argo CD adds conflict resolution automatically); during 3.3.0 / 3.3.1, you temporarily set ClientSideApplyMigration=false ; remove it after upgrading to 3.3.2. For comparison: Instances installed with helm upgrade are not affected.

Case 3: regional outage, rebuilding Argo CD within 2 hours

Fix: New cluster → restore the Sealed Secrets private key from the password vault → helm install (bootstrap values) → apply argocd/root.yaml → projects, ApplicationSets, and applications all come back; cluster credentials are pulled from the cloud key service via ESO. Gap: Repository credentials someone added temporarily in the UI that day had no declarative record. The rule became “UI is read-only, configuration goes through Git,” and daily admin export encrypted backups serve as a second safeguard.

Common errors and fixes

The CustomResourceDefinition "applicationsets.argoproj.io" is invalid: metadata.annotations: Too long: may not be more than 262144 bytes

Cause: Starting from 3.3, this CRD is too large, and client-side apply has to write the last-applied annotation. Fix:kubectl apply -n argocd --server-side --force-conflicts -f …install.yaml; when self-managed, ServerSideApply=true; helm installs are not affected.

After upgrading the chart, argocd-redis-ha-haproxy: spec.selector … field is immutable

Cause: The redis-ha subchart changed the selector labels. Fix: Following the chart README's upgrade notes, delete the Deployment with orphan propagation (kubectl -n argocd delete deploy argocd-redis-ha-haproxy --cascade=orphan) and then upgrade; after that, clean up the old ReplicaSet. Self-managed instances that have Server-Side Diff enabled should first switch back to client-side diff per the README.

After upgrading, some Helm applications render null-valued fields / OutOfSync

Cause: Starting from 3.0, the bundled Helm 3.17.1 changed the behavior of null objects in values; starting from 3.5, Helm 4.2.0 is bundled. Fix: Delete nulls from values; for plain-HTTP OCI repositories, set per the 3.5 notes --insecure-oci-force-http.

argocd admin export output is almost empty

Cause: Wrong namespace (official: no error is reported). Fix: Add -n argocd; confirm the kubeconfig context.

After import, all applications are Unknown, with a message that the cluster does not exist

Cause: In the new environment, the cluster server address differs (for example, kind's lab2-control-plane:6443 is unreachable on the new machine), or the cluster Secret was not restored with the backup. Fix: Restore or re-register the cluster (keep the same name), then refresh the applications.

After upgrading to v3, signatureKeys in AppProject no longer take effect (3.5+)

Cause: 3.5 replaced GnuPG signature verification with Source Integrity, and the old configuration is deprecated. Fix: Following the 3.4→3.5 notes, migrate to sourceIntegrity (Lesson 4).

Command-line exercises
1. Export a clean backup without status, encrypt it with age, and delete the plaintext.
argocd admin export -n argocd --strip-status -o backup.yaml
age -r "$AGE_PUBKEY" -o backup.yaml.age backup.yaml && shred -u backup.yaml
2. Before upgrading, confirm that no role depends on the removed log switch, and list the roles that lack logs permissions.
kubectl -n argocd get cm argocd-cm -o jsonpath='{.data.server\.rbac\.log\.enforce\.enable}'; echo
kubectl -n argocd get cm argocd-rbac-cm -o jsonpath='{.data.policy\.csv}' | grep -E 'applications, (get|\*)'
kubectl -n argocd get cm argocd-rbac-cm -o jsonpath='{.data.policy\.csv}' | grep -E ', logs, get'
Scenario analysis
You are responsible for upgrading a v2.13 instance to v3.6 (chart 10.18.0). Write out the upgrade path and the verification point for each step.

Route: 2.13 → 2.14 (read 2.13→2.14) → 3.0 (read 2.14→3.0, focusing on RBAC, logs, tracking method, metrics, Dex, legacy repository configuration) → 3.1 → … → 3.6 (read each note in turn: the SSA requirement in 3.3, Helm 4 and Source Integrity in 3.5, Server-Side Diff in 3.6). You may skip intermediate patch versions, but you cannot skip reading them. Each step: export an encrypted backup → helm show values Compare → --dry-run=server → upgrade → verify (Pods Ready,argocd version,sum by (sync_status, health_status) (argocd_app_info) match pre-upgrade values, spot-check syncs, and no large volume of log errors) → observe for a while before the next step. After 3.0, immediately sync all applications once to write the tracking annotations; switch dashboards to argocd_app_info. Rollback: helm rollback, CRDs are not downgraded, so when necessary admin import.

Verified instructional videos

▶
Project Lightning Talk: Argo CD 3.0: What’s New and What’s Next? - Nitish Kumar, Maintainer — CNCF [Cloud Native Computing Foundation]
English · maintainers introduce the 3.0 changes (follow the official upgrade notes)
▶
What’s New in Argo CD v3.3: Pre-Delete Hook, OIDC & Shallow Clone — Akuity
English · overview of 3.3 new features

Official documentation

Video storyboard (about 90 seconds)

Shot 1 · 0–20s
Visual: a staircase of version numbers 2.14 → 3.0 → … → 3.6, with an upgrade note stuck on each step.
Narration: read the notes for every minor.
Shot 2 · 20–45s
Visual: a scanner sweeps over argocd-cm, highlighting repositories, log.enforce, and argocd_app_sync_status.
Narration: detect first, then upgrade.
Shot 3 · 45–70s
Visual: backup.yaml is locked in a safe; after the cluster blows up, a new cluster appears, and the root application pulls all the applications back.
Narration: the export is the second safeguard; Git is the first.
Shot 4 · 70–90s
Visual: a single key sits in a separate safe.
Narration: the only thing not in Git is the key that decrypts the secrets.
or score ≥ 70% on the quiz

Module 8 · Mixed fault mystery box

50:00 – 60:00 · It does not tell you what was injected. Only symptoms are given; use the methods from the first 7 modules to locate, fix, and review — this is the real rhythm of on-call duty
10 minfault-box.sh random★★★★★
Learning objectives
  • Using the fixed five-step triage method (scope → stage → evidence → hypothesis → verification), within 3 minutes place a symptom in the correct layer: Git / rendering, comparison, sync, cluster writer, deletion, Webhook, or sharding.
  • For each of the 8 injected faults, state the “first command” and the “decisive evidence.”
  • After a fix, be able to prove it is fixed from four angles: status, conditions, metrics, and logs.
Prerequisites: Modules 1–7. Importance:★★★★★

Five-step triage method

StepQuestionCommand
1 ScopeOne application, all applications in one cluster, or all applications?argocd app list,argocd app list --cluster lab2,sum by (sync_status,health_status) (argocd_app_info)
2 StageComparison error (conditions)? Sync failure (operation)? Sync succeeds but unstable (loop)? Not being processed at all (shard / controller)? Being deleted?argocd app get APP --show-operation, condition list
3 EvidenceWhich field, which resource, which log?argocd app diff,--show-managed-fields, component logs, events
4 HypothesisWho changed what? (Git commits, cluster writers, Argo CD configuration)git log -3 --stat,kubectl -n argocd get deploy,sts -o yaml | grep -A1 ARGOCD_
5 VerifyAfter the fix, have the status, conditions, metrics, and logs all recovered?argocd app wait APP --sync --health,argocd app history

The 8 faults in the mystery box: symptom signatures

IDWhat you seeDecisive evidenceModule
F1Synced and OutOfSync flip back and forth; Pod count 2 ↔ 3diff shows only replicas; the scale subresource in managedFields5
F2Pods roll about every 20 seconds, and the sync count keeps growingdiff shows environment variables PODINFO_UI_MESSAGE; a kubectl-style manager appears in managedFields5
F3Sync Status Unknown, condition ComparisonErrorkustomize build … failed exit status 1 … missing.yaml3 / 5
F4OutOfSync, operation Failed, condition SyncErrorone or more objects failed to apply (dry run) + spec.type: Unsupported value5
F5All applications that need re-rendering show ComparisonErrorfailed timeout after 1ms; repo-server environment variable ARGOCD_EXEC_TIMEOUT3
F6Application stuck on Deleting, with no error conditionThe ConfigMap has deletionTimestamp and faults.example.com/hold6
F7After a push, sync takes about 3 minutes; the simulated push returns 400server log Webhook processing failed; argocd-secret 's webhook.github.secret was changed3
F8Applications on one cluster (lab2; if in-cluster also has a declarative Secret, it may include that too) stop refreshing, and manual refresh changes nothingargocd admin cluster stats shows SHARD 1, but only controller-0 exists; StatefulSet env ARGOCD_CONTROLLER_REPLICAS=22
About F8 and the Lesson 3 in-cluster Secret In Lesson 3, a declarative in-cluster cluster Secret was created, so it has a UID. Under the legacy algorithm, once the env replica count becomes 2, in-cluster may also hash to the nonexistent shard 1 — at that point fault-lab itself also “freezes.” This is the real face of the fault: When the env replica count and Pod count disagree, which clusters suffer depends on the hash.
Common on-call pitfalls① Jumping straight to Sync / Hard Refresh / restarting the controller wipes out the evidence. ② Looking only at the UI and not at the last segment of the condition message. ③ Not reviewing “why no alert fired” after the fix (the Module 4 rules cover the symptoms of F1, F2, F4, and F8).

Symptom → layer quick-reference diagram

Git / WebhookF7 · F3 (introduced by a commit) repo-server renderingF3 · F5 controller shardingF8 comparison / syncF4 (dry-run failure) other writers in the clusterF1 (HPA) · F2 (script / controller) → OutOfSync loop DeletionF6 (child-resource finalizer) First commandargocd app get APP --show-operation → conditions present? read the conditions; operation failed? read the resource message; all normal but flapping? app diff + managedFieldsAn entire cluster is abnormal? admin cluster stats; being deleted? app resources + finalizers; push has no effect? server log webhook
Figure 8-1: the eight faults are distributed across six layers

Interactive: in-browser fault mystery box

Click “Draw a mystery box,” read the symptoms (status, conditions, logs, metric snippets; all examples built in the real format), and choose your diagnosis. After a correct answer, the fix command is shown; scores are kept only in this page's memory.

Score 0 / 0
Nothing drawn yet.

Triage command set (run in order)

# 1 Scope
argocd app list -o wide | awk 'NR==1 || $5!="Synced" || $6!="Healthy"'
# 2 Stage
argocd app get fault-lab --show-operation | sed -n '1,25p'
argocd app get fault-lab -o json | jq -r '.status.conditions[]? | "\(.type): \(.message)"'
kubectl -n argocd get app fault-lab -o jsonpath='{.metadata.deletionTimestamp}{"\n"}'
# 3 Evidence
argocd app diff fault-lab | head -30
argocd app history fault-lab | tail -5
kubectl -n argocd logs sts/argocd-application-controller --since=10m | grep fault-lab | grep -E 'Skipping auto-sync|Initiated|error' | tail -5
kubectl -n argocd logs deploy/argocd-repo-server --since=10m | grep -iE 'timeout|failed' | tail -3
kubectl -n argocd logs deploy/argocd-server --since=10m | grep -iE 'webhook' | tail -3
# 4 Hypothesis: has Argo CD's own configuration been changed?
kubectl -n argocd get deploy argocd-repo-server -o jsonpath='{.spec.template.spec.containers[0].env}' | jq .
kubectl -n argocd get sts argocd-application-controller -o jsonpath='{.spec.replicas} {.spec.template.spec.containers[0].env[?(@.name=="ARGOCD_CONTROLLER_REPLICAS")].value}{"\n"}'
argocd admin cluster stats -n argocd
kubectl -n faults get hpa,deploy,cm
(cd ~/gitops-lab && git log -3 --stat --oneline)

How to use: Save the output as triage-$(date +%s).txt, and compare against it during the review. Common mistake: Running Hard Refresh or Sync before step 2 causes the error cache and operation state to be overwritten.

Lab 8: three rounds of the mystery box (3 minutes per round)

Start a round:
fb reset          # make sure you start from a clean state
fb random         # inject one random fault (number not shown)
date              # note the start time
Diagnose: use only the triage set from the “Commands” page and the commands from earlier modules. Write down: scope, stage, decisive evidence, and your hypothesis.
Fix: fix according to your hypothesis (do not use fb reset), then verify:
argocd app wait fault-lab --sync --health --timeout 180
argocd app get fault-lab -o json | jq '.status.conditions'

For F6, the “fix” is to let the deletion complete, and then kubectl apply -f ~/gitops-lab/argocd/apps/fault-lab.yaml restore; for F7, verification is re-simulating the push and getting a 200 back (see Module 3).

Reveal and review:
fb reveal         # check the answer
fb reset

Three review questions: ① Which piece of evidence was the fastest? ② Which alert (Module 4) could have caught it earlier? ③ What is the “real identity” of this fault in production (HPA, a policy engine, an upstream chart, secret rotation, hand-written HA manifests, …)?

Challenge: inject two at the same time: fb inject F1 && fb inject F5 (note: reveal records only the last one). Think about it: why would F5 make F1's loop “pause”? (Hint: after a hard refresh, rendering fails → ComparisonError → auto-sync stops.)

Case 1: Friday night, “all applications are Unknown”

Symptom: All applications in the UI are Unknown, with ComparisonError as the condition for each. Triage: Scope = all → not a single application's problem → check repo-server: logs full of unable to resolve git revision,argocd_git_request_total with ls-remote failing — a Git provider outage. Response: Do not sync anything; wait for recovery; afterward, hard-refresh the affected applications (error cache). Improvements: Add alerts for Git failures; mirror critical repositories to an internal Git.

Case 2: a newly launched HA plan leaves half the clusters “frozen”

Symptom: Only applications on some clusters are not updating. Triage: Scope = several clusters → suspect sharding → argocd admin cluster stats shows they are all on shard 2, while the StatefulSet has only 2 replicas (the env was set to 3). Response: Correct the env; in the Kustomize patch, use one variable to generate both the replica count and the env.

Case 3: nobody changed the code, but the service restarts every 5 minutes

Symptom: Pods keep rolling,ArgoCDSyncLoop and an alert fires. Evidence: diff shows an annotation in the Pod template; managedFields shows a configuration-injection controller writing it every 5 minutes. Response: Remove that annotation from Git and let the controller manage it.

Interactive troubleshooting tree

Start from a symptom, answer step by step, and get a diagnosis and commands. Covers the 8 faults in this lesson and common production variants.

Command-line exercises
1. Use one command to confirm whether the controller's Pod count matches ARGOCD_CONTROLLER_REPLICAS.
kubectl -n argocd get sts argocd-application-controller -o jsonpath='{.status.readyReplicas}/{.spec.replicas} env={.spec.template.spec.containers[0].env[?(@.name=="ARGOCD_CONTROLLER_REPLICAS")].value}{"\n"}'
2. List all applications with a ComparisonError or SyncError condition, along with the first 100 characters of the message.
argocd app list -o json | jq -r '.[] | . as $a | .status.conditions[]? | select(.type=="ComparisonError" or .type=="SyncError") | "\($a.metadata.name)\t\(.type)\t\(.message[0:100])"'
Scenario analysis
While on call, you notice fault-lab's Pods roll every 20 seconds, but argocd app diff is sometimes empty and sometimes shows a PODINFO_UI_MESSAGE difference. Why does the diff come and go? How do you confirm the writer?

This is an F2-type fault: an external writer changes the environment variable to a different value every 20 seconds, and selfHeal changes it back (subject to backoff). Whether the diff is empty depends on whether you run it right after the other side has made its change or right after Argo CD has reverted it — that is exactly the signature of a loop. To confirm the writer: kubectl -n faults get deploy faulty -o json --show-managed-fields | jq '.metadata.managedFields[] | {manager, operation, time}', find the most recent manager that is not Argo CD (a manual kubectl change or a script usually shows up as kubectl-set / kubectl-client-side-apply etc., verify against your actual setup); then combine it with the ReplicaSet history (kubectl -n faults rollout history deploy/faulty) and audit logs to identify the specific actor. Fix: stop that writer, or make Git match its intent.

Verified instructional videos

▶
One Dozen To One Thousand Clusters: How Argo Kept up as We Scaled - Jérémy Albuixech & Kahou Lei — CNCF [Cloud Native Computing Foundation]
English · Argo CD operations experience from a dozen to thousands of clusters
▶
5 common Argo CD issues and how to fix them — Octopus Deploy
English · quick overview of common questions, to compare against this module's mystery box

Official documentation

Video storyboard (about 90 seconds)

Shot 1 · 0–15s
Visual: a gift box shakes and opens, and a speech bubble pops out saying “the application is off.”
Narration: the mystery box gives only symptoms.
Shot 2 · 15–45s
Visual: five steps — scope, stage, evidence, hypothesis, verification; a character climbs them one by one, and at each step a command pops up.
Narration: don't rush to click Sync; first gather all the evidence.
Shot 3 · 45–75s
Visual: eight fault icons fly into their corresponding positions in a six-layer architecture diagram.
Narration: every fault has a “decisive evidence.”
Shot 4 · 75–90s
Visual: the alert panel lights up, and a review card reads “which alert could have caught this earlier?”
Narration: after the fix, ask one question: can we know sooner next time?
or score ≥ 70% on the quiz

Command cheat sheet

Scaling, high availability, and troubleshooting — organized by scenario; defaults are for v3.6.1
After classPrint-friendly
HA and scaling (chart)
redis-ha: {enabled: true}        # ≥3 nodes
server: {replicas: 2}            # + env ARGOCD_API_SERVER_REPLICAS
repoServer: {replicas: 2}        # or autoscaling.enabled
applicationSet: {replicas: 2}    # leader election is enabled automatically
controller: {replicas: 1}        # = number of shards; the chart syncs the env
Sharding
argocd admin cluster stats -n argocd
argocd admin cluster shards -n argocd --replicas 3 --sharding-method round-robin
# argocd-cmd-params-cm
controller.sharding.algorithm: legacy | round-robin | consistent-hashing
# Cluster Secret: stringData.shard: "1"
Controller tuning (argocd-cmd-params-cm)
controller.status.processors: "20"       # 1000 apps → 50
controller.operation.processors: "10"    # 1000 apps → 25
controller.kubectl.parallelism.limit: "20"
controller.repo.server.timeout.seconds: "60"
controller.self.heal.backoff.timeout.seconds: "2"   # ×3, cap 300
# argocd-cm (restart the controller after changing)
timeout.reconciliation: 120s
timeout.reconciliation.jitter: 60s
repo-server
ARGOCD_EXEC_TIMEOUT=90s            # tool process
ARGOCD_EXEC_FATAL_TIMEOUT=10s       # KILL after TERM
ARGOCD_PAUSE_GEN_AFTER_FAILED_ATTEMPTS=3
ARGOCD_PAUSE_GEN_MINUTES=60
reposerver.parallelism.limit: "0"   # unlimited
reposerver.repo.cache.expiration: 24h0m0s
argocd app get APP --hard-refresh   # bypass the manifest / error cache
# annotation argocd.argoproj.io/manifest-generate-paths: .
Metrics and alerts
sum by (sync_status, health_status) (argocd_app_info)
sum by (name) (increase(argocd_app_sync_total{phase="Succeeded"}[30m])) > 6
sum by (name) (increase(argocd_app_sync_total{phase=~"Error|Failed"}[15m])) > 0
sum by (name) (workqueue_depth{name=~"app_.*"})
histogram_quantile(0.95, sum by (le) (rate(argocd_app_reconcile_bucket[10m])))
argocd_cluster_connection_status == 0
# endpoints :8082 controller · :8083 server · :8084 repo-server
OutOfSync and sync failures
argocd app diff APP; echo $?
argocd app get APP --show-operation
kubectl get deploy X -o json --show-managed-fields | jq '.metadata.managedFields[]|{manager,subresource,time}'
# Application:
#   ignoreDifferences: [{group: apps, kind: Deployment, jsonPointers: [/spec/replicas]}]
#   syncOptions: [RespectIgnoreDifferences=true]
# annotation: argocd.argoproj.io/compare-options: ServerSideDiff=true,IncludeMutationWebhook=true
Deletion and orphaned resources
argocd app delete APP --cascade --propagation-policy foreground
argocd app delete APP --cascade=false
kubectl -n argocd get app APP -o jsonpath='{.metadata.deletionTimestamp} {.metadata.finalizers}'
argocd app resources APP --orphaned
# Last resort:
kubectl -n argocd patch app APP --type merge -p '{"metadata":{"finalizers":null}}'
Webhook
URL            https://<argocd>/api/webhook   (Content type: application/json)
GitHub secret    argocd-secret: webhook.github.secret
GitLab secret    webhook.gitlab.secret
Gitea / Gogs   webhook.gogs.secret   (X-Gogs-Event header → Gogs parser)
400            Webhook processing failed (signature / format)
200 but no refresh   repoURL hostname / branch mismatch
503            Queue is full, discarding webhook payload
Upgrades and disaster recovery
helm show values argo/argo-cd --version NEW > new.yaml
helm upgrade argocd argo/argo-cd -n argocd --version NEW -f values.yaml --dry-run=server
argocd admin export -n argocd [--strip-status] > backup.yaml
argocd admin import -n argocd [--dry-run] - < backup.yaml
kubectl apply -n argocd --server-side --force-conflicts -f install.yaml   # 3.3+ non-Helm installation
Key error messages (original text)
Failed to load target state: failed to generate manifest for source 1 of 1: ...
`kustomize build ...` failed timeout after 1m30s
Manifest generation error (cached): ...
rpc error: code = DeadlineExceeded desc = context deadline exceeded
one or more objects failed to apply (dry run)
one or more objects failed to apply, reason: ...
Failed last sync attempt to [...]: ...
Skipping auto-sync: already attempted sync to ... (retrying in ...)
Unable to delete application resources: ...
Application has N orphaned resources

Capstone lab + final quiz

“Production readiness review”: run a complete HA, sharding, alerting, and disaster-recovery drill on your Argo CD, and write the conclusions up as a one-page review report
≈ 45 minkind lab · lab2 · Gitea

Scenario

The platform team plans to use Argo CD as the company's only release channel. Your task: in the lab, demonstrate that it “keeps running when one component goes down, alerts when something goes wrong, and can be rebuilt even after total failure,” and provide production configuration recommendations.

HA overlay: use the Module 1 argocd-values-ha-lab.yaml to upgrade; delete one server Pod, one repo-server Pod, and the redis-ha primary Pod, and record the user-visible impact (in a table).
Sharding: controller.replicas=2 Use argocd admin cluster shards to dry-run the three algorithms, choose one and justify it, and use the Secret shard to pin lab2 to shard 1, and verify.
Alerts: deploy the 9 rules (either kps or the Lesson 6 prometheus chart); inject F1, F4, and F8 in turn, and capture screenshots of the matching alerts entering firing (or substitute PromQL query results).
Webhook: use the in-cluster Gitea to demonstrate syncing within 10 seconds of a push; then demonstrate one cause of “Webhook not firing” and fix it.
Loops and deletion: inject F1, stop the bleeding with ignoreDifferences + RespectIgnoreDifferences, then remove replicas from Git as the root-cause fix; inject F6 and release it correctly.
Disaster-recovery drill: argocd admin export to create an encrypted backup; non-cascading delete of two applications and one AppProject; import --dry-run then import; confirm the workloads were not restarted.
Upgrade assessment: use the Module 7 detection commands and scanner to check your configuration; write out “if this were a v2.14 instance, what would need to change to upgrade to v3.6.”
Reset: fb reset; go back to the non-HA values; delete Gitea (optional).

Acceptance checklist

☐ Component failure impact table (server / repo-server / controller / Redis)
☐ Sharding algorithm selection rationale + admin cluster stats output
☐ 9 alert rules pass promtool check rules, and at least 3 have actually fired
☐ Comparison of push-to-sync time (with / without Webhook)
☐ Diagnostic evidence and fix records for F1 and F6
☐ Backup stored encrypted; Pod AGE unchanged after restore
☐ One-page “production readiness review” conclusions

Open-ended self-check (6 questions)

1. Why does the Argo CD controller choose “sharding by cluster” rather than “primary/standby”? Where are the limits of this design?

The cluster cache must watch all resources; a hot standby would mean either double the API Server load or a cold start. Sharding provides both scaling and fault isolation. The limit: a single cluster can only be handled by one shard, so the memory and processing capacity for a huge cluster is capped by a single Pod; handle this with resource exclusions, processors, and splitting instances.

2. An application shows ComparisonError, with a message starting with “Manifest generation error (cached).” You fixed Git — why is the application still red?

The error is cached (after 3 consecutive failures, the cached error is returned directly for 1 hour); a normal refresh hits the error cache. A hard refresh is needed.

3. When should timeout.reconciliation be increased? What are the prerequisites for increasing it?

When there are many applications / repositories and polling generates heavy ls-remote and refresh load. The prerequisite is that Webhooks are reliable (and Git-failure alerts are in place); otherwise change detection becomes slower. Setting it to 0 is not recommended.

4. What problem does each of ignoreDifferences, RespectIgnoreDifferences, and Server-Side Diff solve?

ignoreDifferences: ignores specified fields during comparison; RespectIgnoreDifferences: does not overwrite ignored fields during sync; Server-Side Diff: compares using API Server dry-run results, naturally accounting for defaults and admission, which reduces false positives caused by defaults / normalization.

5. What is the difference in consequences between removing an Application's finalizer and removing a child resource's finalizer?

Removing the Application's finalizer: Argo CD gives up on cleanup, all remaining resources become orphans, and the stuck child resources stay stuck. Removing a child resource's finalizer: that resource disappears immediately; if it represents an external resource (such as a cloud database), the external resource may leak; however, Argo CD's deletion flow can complete normally.

6. How do “admin export” and “rebuild from Git” work together in disaster recovery?

Rebuilding from Git is the primary path (declarative, auditable, consistent across environments); export is a supplement (it covers undeclared UI configuration, preserves sync history, and gives a fast warm standby). Both depend on separate backups of the secret root (Sealed Secrets private key / external secrets service credentials); the export file contains plaintext credentials and must be encrypted.

Sources and version notes

Sources for all version numbers, default values, and error message text; verification date 2026-11-17
Verification date 2026-11-17

Source table

TopicSourceWhat was verifiedDate
Argo CD versionargo-cd Releasesv3.6.1 (2026-11-04), v3.6.0, v3.5.7, v3.4.13, v3.3.192026-11-17
Helm chartargo-helm · argo-cd(tag argo-cd-10.18.0: Chart.yaml, values.yaml, README, templates)10.18.0 / appVersion v3.6.1; redis-ha 4.38.0 dependency; HA examples; controller.replicas written into ARGOCD_CONTROLLER_REPLICAS; ApplicationSet multi-replica automatic leader election; metrics service ports; configs.secret.githubSecret / gogsSecret2026-11-17
HA and scalingHigh Availability(v3.6.1 source files)processors 20/10 (1000 apps recommended 50/25), 90s exec timeout, 24h cache, sharding algorithms and alpha status, monorepo, manifest-generate-paths, Webhook jitter, workqueue rate limiting2026-11-17
Parameter defaultsdocs/operator-manual/argocd-cmd-params-cm.yaml,argocd-application-controller / argocd-repo-server Command reference--app-resync 120,--app-resync-jitter 60,--kubectl-parallelism-limit 20,--repo-server-timeout-seconds 60,--sharding-method legacy, metrics ports 8082 / 8084, self-heal backoff 2 / 3 / 3002026-11-17
Sharding source codecontroller/sharding/sharding.go,common/common.go (v3.6.1)FNV-32a modulo, empty in-cluster ID → 0, shard field takes precedence, round-robin sorted by ID, consistent-hashing with bounded loads,Processing all cluster shards, original text of related logs2026-11-17
Dynamic cluster assignmentDynamic Cluster Distributionalpha (since v2.9),argocd-app-controller-shard-cm, heartbeat 10s2026-11-17
Error message textcontroller/state.go,controller/appcontroller.go,gitops-engine/pkg/sync/sync_context.go,reposerver/repository/repository.go,util/exec/exec.go,util/webhook/webhook.go and scm.go (v3.6.1); go-playground/webhooks v6.4.0Condition types,Failed to load target state,failed to generate manifest for source %d of %d, dry run / apply failure messages,Failed last sync attempt,Skipping auto-sync series,Manifest generation error (cached),`%v` failed timeout after %v, Webhook 400/503 messages,HMAC verification failed, Gogs parser precedence2026-11-17
MetricsMetrics,controller/metrics/*.go,reposerver/metrics/metrics.go,examples/dashboard.jsonendpoints, metrics and labels,argocd_app_reconcile buckets,argocd_cluster_connection_status semantics, queue names2026-11-17
Diff and syncDiffing,Diff Strategies,FAQOutOfSync causes, normalization examples, mutation webhooks excluded by default2026-11-17
DeletionApp Deletionfinalizer semantics, foreground / background / non-cascading2026-11-17
UpgradeUpgrading: 2.14→3.0, 3.0→3.1 … 3.5→3.6all entries in the two Module 7 tables2026-11-17
Disaster recoveryDisaster Recovery,argocd admin export/import command reference--strip-status, import parameters, namespace tips2026-11-17
Giteagitea helm chart(index.yaml and the 12.7.0 README / values)chart 12.7.0 / Gitea 1.27.0, single-Pod sqlite configuration, Service gitea-http:3000, default admin key names2026-11-17
kind and podinfokind Releases, podinfo Git tagkind v0.33.0 (default kindest/node:v1.37.0), podinfo 6.17.02026-11-17
Alert rulespromtool 3.16.0 (run locally)check rules: SUCCESS: 9 rules found2026-11-17

Video verification notes

All videos were verified via YouTube oEmbed (https://www.youtube.com/oembed?url=…&format=json), listed after verifying titles and channel names; the titles are written exactly as oEmbed returns them: fhkE4OdsUj8 (Red Hat), LlAt8yx7goA (CNCF), DBrIJhidymA (The Linux Foundation), IvgHucOQrBE (CNCF), toqwPh19qL8 (CNCF), dsgjxqrGapo (CNCF), RgzGNY1uy3U (CNCF), VMvbVF1xEUU (Codefresh), 6Dwhxk0m6W0 (Akuity), za_SNwjXehM (Octopus Deploy), z_DgVAzS9Nw (CNCF), eEqMEs2IY0I (Akuity), 4yVSqDJm5RI (CNCF). Parameter names in videos recorded earlier may differ from v3.6; follow this lesson and the official documentation.

Audio notes

The “Audio” page uses the browser's Web Speech API: Chinese narration uses a zh-CN voice, and English terms are pronounced with en-US. No data is uploaded. Without a Chinese voice pack, the narration script can be read directly or handed to another TTS tool.

Known limitations

  • Commands in this lesson have not been run one by one on a real cluster; all “expected outputs” are examples built from source code and documentation. Parts marked “verify against your actual output” (the API Server's original response, kustomize error details, managedFields manager names,admin cluster stats column formats, Gitea's delivery-rejection hints) may differ in your environment. The only things actually run locally are: the syntax check of fault-box.sh and its offline subcommands (bash -n,list,reveal, and baseline file generation),kubectl kustomize rendering of the baseline and F3, and promtool rule checks.
  • The “teaching-version HA” turns off redis-ha's hard anti-affinity and is only for single-node kind; production must have at least 3 nodes.
  • round-robin,consistent-hashing Sharding and dynamic cluster assignment are still alpha in v3.6.1; the consistent-hashing in the Module 2 animation is a simplified implementation that only demonstrates trends.
  • argocd admin cluster stats/shards requires access to Redis (automatic port-forwarding by default); when Redis has authentication or TLS enabled, extra parameters may be needed.
  • The scope of F8 depends on the hash of the cluster Secret's UID (after Lesson 3 declares the in-cluster Secret, in-cluster may also be affected).
  • The Gitea Webhook lab depends on Gitea sending X-Gogs-Event headers at the same time (in the v3.6.1 source, the Gogs parser claims the request first). If a future version changes the parsing order, follow the official documentation.