Tag 15: Wettkampf
Ziel: Fünf Störungen finden und beheben, jede beim Testen dieses Buchs wirklich aufgetreten oder nachgestellt. · Dauer: ca. 120 min · Voraussetzung: Tag 0–14
Spielregeln
- Jede Runde beginnt mit einer Lage: Was ist passiert, was meldet das Team? Die Befehle unter „Lage“ bauen die Störung nach. Führe sie aus, ohne die Lösung zu lesen.
- Du findest die Ursache mit den Werkzeugen aus dem Buch:
argocd app get,argocd app list,kubectl get events, die Logs der Controller,git log. Erst dann reparierst du. - Repariert wird in Git, nie mit
kubectl edit. Self-Heal würde es ohnehin zurückdrehen. - Für jede Runde gibt es einen Hinweis. Lies ihn erst, wenn du zehn Minuten nicht weiterkommst.
- Zähl die Runden, die du ohne Hinweis schaffst.
Vor dem Start:
cd ~/argo-lab/argocd-fleet
git pull
argocd app list | awk 'NR>1 {print $5, $6}' | sort | uniq -cErwartet: alle elf Applications Synced Healthy.
Runde 1: Die verschwundene Umgebung
Lage: Ein Kollege räumt auf und vereinheitlicht Dateiendungen:
git mv apps/notes/overlays/dev/env.yaml apps/notes/overlays/dev/env.yml
git commit -m "dev: Endung vereinheitlicht"
git push
kubectl -n argocd annotate appset notes \
argocd.argoproj.io/application-set-refresh=true --overwrite
sleep 20Das Team meldet: „notes-dev ist aus Argo CD verschwunden. Die App läuft aber noch.“
argocd app list -o name | grep notes
kubectl -n notes-dev get deployErwartet:
argocd/notes
argocd/notes-rollout
NAME READY UP-TO-DATE AVAILABLE AGE
notes 1/1 1 1 23h
notes-db 1/1 1 1 23h
Zeitlimit: 15 min
Hinweis: Wonach sucht der Generator des ApplicationSets?
Lösung
kubectl -n argocd get appset notes -o jsonpath='{.spec.generators[0].git.files[0].path}'
echo
ls apps/notes/overlays/*/env.*Erwartet:
apps/notes/overlays/*/env.yaml
apps/notes/overlays/dev/env.yml
apps/notes/overlays/prod/env.yaml
Der Git-Generator sucht env.yaml. Für
env.yml erzeugt er nichts, also hat das ApplicationSet
notes-dev gelöscht. Dass notes-api und die Datenbank noch
laufen, verdankst du preserveResourcesOnDeletion aus Tag 8.
Ohne die Option wäre die Umgebung samt Volume weg.
git mv apps/notes/overlays/dev/env.yml apps/notes/overlays/dev/env.yaml
git commit -m "dev: env.yaml zurück"
git push
kubectl -n argocd annotate appset notes \
argocd.argoproj.io/application-set-refresh=true --overwrite
sleep 20
argocd app get notes-dev | grep -E "Sync Status|Health Status"
kubectl -n notes-dev get deployErwartet (gekürzt):
…
Sync Status: Synced to main (6d8f945)
Health Status: Healthy
NAME READY UP-TO-DATE AVAILABLE AGE
notes 1/1 1 1 23h
notes-db 1/1 1 1 24h
Die neue Application hat die laufenden Objekte übernommen. Kein Pod wurde neu gestartet.
Fortschritt speichern? Kostenlos registrieren
Runde 2: Die Umgebung, die nicht startet
Lage: Die Tester bekommen eine eigene Umgebung
qa auf NodePort 30087:
mkdir -p apps/notes/overlays/qa
cat > apps/notes/overlays/qa/env.yaml <<'EOF'
name: notes-qa
namespace: qa
EOF
cat > apps/notes/overlays/qa/kustomization.yaml <<'EOF'
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
patches:
- path: nodeport.yaml
EOF
cat > apps/notes/overlays/qa/nodeport.yaml <<'EOF'
apiVersion: v1
kind: Service
metadata:
name: notes
spec:
ports:
- port: 80
targetPort: 8080
nodePort: 30087
EOF
git add -A
git commit -m "Umgebung qa"
git push
kubectl -n argocd annotate appset notes \
argocd.argoproj.io/application-set-refresh=true --overwrite
sleep 20Die Tester melden: „Port 30087 antwortet nicht.“
argocd app get notes-qa | grep -E "Sync Status|Health Status"
curl -s -m 3 localhost:30087/version; echo "rc=$?"Erwartet:
Sync Status: Unknown
Health Status: Unknown
rc=7
Zeitlimit: 15 min
Hinweis: Unknown heißt, Argo CD hat gar
nicht erst angefangen. Warum?
Lösung
argocd app get notes-qa | grep InvalidSpecError
argocd proj get notes | grep "^Destinations"Erwartet:
InvalidSpecError application destination server 'https://kubernetes.default.svc' and namespace 'qa' do not match any of the allowed destinations in project 'notes' 2026-11-15 08:53:05 +0000 UTC
Destinations: https://kubernetes.default.svc,notes*
Das Projekt aus Tag 9 erlaubt nur Namespaces, die mit
notes beginnen. Die Grenze funktioniert, nur die neue
Umgebung hält sich nicht daran:
sed -i "s/^namespace: qa$/namespace: notes-qa/" apps/notes/overlays/qa/env.yaml
git commit -am "qa: Namespace notes-qa"
git push
kubectl -n argocd annotate appset notes \
argocd.argoproj.io/application-set-refresh=true --overwrite
sleep 15
argocd app wait notes-qa --health --operation --timeout 300 \
| grep -E "Health Status|^Phase"
curl -s localhost:30087/version; echoErwartet (gekürzt):
…
Health Status: Healthy
Phase: Succeeded
0.5.3
0.5.3, weil qa die Version aus
base bekommt. Der Image Updater überwacht nur
notes und notes-dev. Die Tester sind
zufrieden, die Umgebung kommt wieder weg:
git rm -r apps/notes/overlays/qa
git commit -m "qa entfernt"
git push
kubectl -n argocd annotate appset notes \
argocd.argoproj.io/application-set-refresh=true --overwrite
sleep 20
kubectl delete ns notes-qaErwartet (gekürzt):
…
namespace "notes-qa" deleted
Fortschritt speichern? Kostenlos registrieren
Runde 3: Das kleine Label
Lage: Ein Kollege will das Datenbank-Secret mit einem Label versehen. Die Datei ist ja lesbar, also ergänzt er die Zeilen direkt:
sed -i "s/^ name: notes-db$/ name: notes-db\n labels:\n team: notes/" \
apps/notes/base/db-secret.enc.yaml
head -8 apps/notes/base/db-secret.enc.yaml
git commit -am "notes-db: Label team"
git push
argocd app get notes --refresh
sleep 10Erwartet (gekürzt):
apiVersion: v1
kind: Secret
metadata:
name: notes-db
labels:
team: notes
annotations:
argocd.argoproj.io/sync-wave: "-1"
…
Das Monitoring meldet: „notes hat keinen Sync-Status mehr.“
argocd app list | awk 'NR>1 && /notes/ {print $1, $5, $6}'
curl -s localhost:30080/version; echoErwartet (gekürzt):
argocd/notes Unknown Healthy
…
0.7.1
Zeitlimit: 20 min
Hinweis: Was sagt die Bedingung der Application? Und
was hast du in Tag 10 über das Feld mac gelesen?
Lösung
kubectl -n argocd get app notes -o jsonpath='{.status.conditions[0].message}' \
| grep -o "Failed to verify data integrity"
sops decrypt apps/notes/base/db-secret.enc.yaml 2>&1 | head -1Erwartet (gekürzt):
Failed to verify data integrity
Failed to verify data integrity
MAC mismatch. File has 06702062AA62759C…, computed CE790C67338B2EC8…
Die Prüfsumme von SOPS deckt auch die unverschlüsselten Felder ab.
Jede Änderung von Hand macht die Datei unbrauchbar. notes läuft weiter,
denn ohne Sollzustand synchronisiert Argo CD nicht. Repariert wird mit
git revert, das Label setzt danach SOPS selbst:
git revert --no-edit HEAD
sops set apps/notes/base/db-secret.enc.yaml '["metadata"]["labels"]' '{"team": "notes"}'
sops decrypt apps/notes/base/db-secret.enc.yaml | head -8
git commit -am "notes-db: Label team, mit sops"
git push
argocd app get notes --refresh
argocd app get notes-dev --refresh
sleep 15
argocd app list | awk 'NR>1 && /notes/ {print $1, $5, $6}'
kubectl -n notes get secret notes-db --show-labelsErwartet (gekürzt):
[main a27ed25] Revert "notes-db: Label team"
…
apiVersion: v1
kind: Secret
metadata:
name: notes-db
annotations:
argocd.argoproj.io/sync-wave: "-1"
labels:
team: notes
…
argocd/notes Synced Healthy
argocd/notes-dev Synced Healthy
argocd/notes-rollout Synced Healthy
NAME TYPE DATA AGE LABELS
notes-db Opaque 1 24h team=notes
Fortschritt speichern? Kostenlos registrieren
Runde 4: Die stille Benachrichtigung
Lage: Der Echo-Dienst soll irgendwann in einen
eigenen Namespace notify umziehen. Ein Kollege stellt die
Adresse schon einmal um:
sed -i "s#url: http://echo.echo.svc#url: http://echo.notify.svc#" \
platform/argocd/argocd-notifications-cm.yaml
git commit -am "Notifications: neuer Namespace"
git push
argocd app get argocd-extras --refresh
kubectl -n echo logs deploy/echo | grep -c '"body"'Erwartet (gekürzt):
…
10
Deine Zahl kann eine andere sein. Merk sie dir. Dann ein normales Deployment:
sed -i "s/replicas: 1/replicas: 2/" apps/notes/overlays/dev/replicas.yaml
git commit -am "notes-dev: zwei Repliken"
git push
argocd app get notes-dev --refresh
sleep 30
kubectl -n notes-dev get deploy notes
kubectl -n echo logs deploy/echo | grep -c '"body"'Erwartet (gekürzt):
…
NAME READY UP-TO-DATE AVAILABLE AGE
notes 2/2 2 2 24h
10
Das Team meldet: „Das Deployment lief, aber es kam keine Nachricht.“
Zeitlimit: 15 min
Hinweis: Wer verschickt die Nachrichten, und was schreibt er in sein Log?
Lösung
kubectl -n argocd logs deploy/argocd-notifications-controller --since=5m \
| grep "request failed" | tail -1Erwartet:
2026/11/15 08:57:45 [ERR] POST http://echo.notify.svc request failed: Post "http://echo.notify.svc": dial tcp: lookup echo.notify.svc on 10.43.0.10:53: no such host
Den Namespace notify gibt es nicht. Du nimmst genau den
Commit zurück, der die Datei geändert hat:
C=$(git log -1 --format=%h -- platform/argocd/argocd-notifications-cm.yaml)
echo $C
git revert --no-edit $C
git push
argocd app get argocd-extras --refresh
sleep 30
kubectl -n echo logs deploy/echo | grep -c '"body"'Erwartet (gekürzt):
2dfe98f
[main 643ea8a] Revert "Notifications: neuer Namespace"
…
10
Immer noch keine neue Nachricht. Die verlorene kommt nicht nach:
git log -1 --format=%h -- apps/notes/overlays/dev/replicas.yaml
kubectl -n argocd get app notes-dev \
-o jsonpath='{.metadata.annotations.notified\.notifications\.argoproj\.io}' \
| tr "," "\n" | grep baf262e | cut -c1-60Erwartet:
baf262e
"baf262e445f4512bc9781c43f922a80e7e2449a7:on-deployed:[0].y7
Ausprobiert: Argo CD hat die Nachricht für den Commit
baf262eals verschickt vermerkt, obwohl der Versand scheiterte. WegenoncePerversucht es kein zweites Mal. Fehler beim Versand stehen nur im Log des Controllers.
Das nächste Deployment kommt wieder an:
sed -i "s/replicas: 2/replicas: 1/" apps/notes/overlays/dev/replicas.yaml
git commit -am "notes-dev: wieder eine Replik"
git push
argocd app get notes-dev --refresh
sleep 30
kubectl -n echo logs deploy/echo | grep -c '"body"'Erwartet (gekürzt):
…
11
Fortschritt speichern? Kostenlos registrieren
Runde 5: Die Vorschau, die nicht fertig wird
Lage: Ein Kollege will den Patch 0.7.10
als Blue-Green testen:
sed -i "s/notes-api:0.7.0/notes-api:0.7.10/" apps/notes-rollout/rollout.yaml
git commit -am "notes-rollout: 0.7.10"
git push
argocd app get notes-rollout --refresh
sleep 60Er meldet: „Die Vorschau ist nach einer Minute noch nicht da. Argo CD
sagt nur Progressing.“
argocd app get notes-rollout | grep -E "Sync Status|Health Status"
curl -s localhost:30085/versionErwartet:
Sync Status: Synced to main (0792426)
Health Status: Progressing
0.7.0
Zeitlimit: 15 min
Hinweis: Sieh dir die Pods der Vorschau an.
Lösung
kubectl argo rollouts get rollout notes -n notes-rollout \
| grep -E "Message|preview|ErrImagePull"Erwartet (gekürzt):
Message: active service cutover pending
ghcr.io/thomaszachmann/notes-api:0.7.10 (preview)
│ └──⧉ notes-6b8967d675 ReplicaSet ◌ Progressing 59s preview
│ ├──□ notes-6b8967d675-jp7cd Pod ⚠ ErrImagePull 59s ready:0/1
│ ├──□ notes-6b8967d675-lp7mx Pod ⚠ ErrImagePull 59s ready:0/1
…
kubectl -n notes-rollout get events --field-selector reason=Failed \
| grep "0.7.10" | head -1Erwartet (gekürzt):
… Warning Failed pod/notes-6b8967d675-jp7cd Failed to pull image "ghcr.io/thomaszachmann/notes-api:0.7.10": rpc error: code = NotFound …
Einen Tag 0.7.10 gibt es nicht, das zeigt die Liste aus
Tag 12. Der Verkehr auf 30085 hat davon nichts gemerkt,
denn Blue-Green schaltet erst um, wenn die Vorschau bereit ist. Zurück
auf den Stand davor:
git revert --no-edit HEAD
git push
argocd app get notes-rollout --refresh
sleep 60
argocd app get notes-rollout | grep -E "Sync Status|Health Status"
kubectl -n notes-rollout get rs \
-o custom-columns=NAME:.metadata.name,DESIRED:.spec.replicas,\
IMAGE:.spec.template.spec.containers[0].image | grep -E "NAME|0.7.10|0.7.0"Erwartet (gekürzt):
[main cadbc89] Revert "notes-rollout: 0.7.10"
…
Sync Status: Synced to main (cadbc89)
Health Status: Healthy
NAME DESIRED IMAGE
notes-5ff689668b 4 ghcr.io/thomaszachmann/notes-api:0.7.0
notes-6b8967d675 0 ghcr.io/thomaszachmann/notes-api:0.7.10
Fortschritt speichern? Kostenlos registrieren
Auswertung
| Runden ohne Hinweis | Einschätzung |
|---|---|
| 5 | Du betreibst Argo CD, nicht umgekehrt. |
| 3–4 | Solide. Lies die Tage zu den verpassten Runden noch einmal. |
| 0–2 | Arbeite Tag 8 bis 13 ein zweites Mal durch, diesmal ohne die Lösungen. |
Allen Runden gemeinsam: Repariert wurde jedes Mal mit einem Commit. Git zeigt danach, wer was wann geändert und wer es zurückgenommen hat.