Anhang A: Spickzettel
Alles auf einen Blick, sortiert nach Thema.
Das Lab
| Was | Wo |
|---|---|
VM argo |
172.16.0.182, k3s mit Argo CD, Image Updater, Rollouts |
VM prod |
172.16.0.123, k3s ohne Argo CD, ab Tag 11 |
| Weboberfläche | https://172.16.0.182:30443, admin /
lab-argo-pw-123 |
| Benutzerin alice | lab-alice-pw-123, Rolle notes-entwickler
(Tag 9) |
| notes (prod) | http://172.16.0.182:30080, mit Postgres |
| notes-dev | http://172.16.0.182:30081 |
| notes-rollout | stabil 30085, Canary oder Vorschau
30086 |
| podinfo | 30090 auf beiden Clustern (Tag 11) |
| API-Key notes | lab-api-key-456 seit Tag 10, Header
X-API-Key |
| Fleet-Repo | ~/argo-lab/argocd-fleet, auf GitHub mit Deploy-Key |
| age-Schlüssel | ~/argo-lab/age.key, im Cluster Secret
sops-age |
| Zugang zu prod | ~/.kube/prod.yaml, Kontext prod |
Das Fleet-Repo
| Pfad | Inhalt | Verwaltet von |
|---|---|---|
bootstrap/root.yaml |
die einzige Application von Hand | kubectl apply |
applications/ |
Applications, ApplicationSets, Projekt, ImageUpdater | root |
apps/notes/base, overlays/* |
notes mit Kustomize, env.yaml pro Umgebung |
ApplicationSet notes |
apps/notes-rollout/ |
Rollout, Services, Analyse | notes-rollout |
addons/* |
Plattform-Dienste für alle Cluster | ApplicationSet addons |
platform/argocd/ |
NodePort, argocd-rbac-cm,
argocd-notifications-cm |
argocd-extras |
platform/argo-rollouts/ |
Rollouts-Controller | argo-rollouts |
platform/echo/ |
Empfänger für Webhooks | echo |
.sops.yaml |
Regel für *.enc.yaml |
SOPS |
Applications
| Aufgabe | Befehl |
|---|---|
| Liste | argocd app list,
argocd app list -o name |
| Zustand | argocd app get <app>, … --refresh,
… --hard-refresh |
| Baum | argocd app get <app> -o tree |
| Abweichung | argocd app diff <app> |
| Sollzustand | argocd app manifests <app> |
| Sync | argocd app sync <app> [--prune] |
| Warten | argocd app wait <app> --health --sync --operation |
| Verlauf, Rollback | argocd app history <app>,
argocd app rollback <app> <id> |
| Hängender Sync | argocd app terminate-op <app> |
| Objekte | argocd app resources <app> |
Sync und Verhalten
| Einstellung | Wirkung |
|---|---|
automated: {} |
Sync bei neuem Commit |
selfHeal: true |
Abweichungen im Cluster zurückholen |
prune: true |
Objekte löschen, deren Datei weg ist |
CreateNamespace=true |
Ziel-Namespace anlegen |
ServerSideApply=true |
große Objekte wie CRDs |
RespectIgnoreDifferences=true |
ignoreDifferences auch beim Sync |
argocd.argoproj.io/sync-wave: "-1" |
Reihenfolge, kleinere zuerst |
argocd.argoproj.io/hook: PreSync |
Job vor dem Sync, auch Sync, PostSync |
hook-delete-policy: BeforeHookCreation,HookSucceeded |
alten Hook-Job vorher löschen |
Finalizer resources-finalizer.argocd.argoproj.io |
Objekte beim Löschen mitnehmen |
ApplicationSets
| Generator | Liefert |
|---|---|
list |
Einträge aus der Datei |
git.files |
Felder aus Dateien, dazu {{.path.path}},
{{.path.basename}} |
git.directories |
jeden passenden Ordner |
clusters |
{{.name}}, {{.server}}, Filter mit
selector |
matrix |
jede Kombination zweier Generatoren |
goTemplate: truemitmissingkey=error.syncPolicy.preserveResourcesOnDeletion: true, wenn Daten im Spiel sind.- Sofort neu auswerten: Annotation
argocd.argoproj.io/application-set-refresh=true.
Projekte und Rechte
| Aufgabe | Befehl oder Zeile |
|---|---|
| Projekt ansehen | argocd proj get <projekt> |
| Benutzer anlegen | accounts.<name>: login in
argocd-cm |
| Passwort setzen | argocd account update-password --account <name> … |
| Recht vergeben | p, role:<rolle>, applications, sync, <projekt>/<app>, allow |
| Rolle zuweisen | g, <benutzer>, role:<rolle> |
| Prüfen | argocd account can-i sync applications "<projekt>/*" |
| Token für Pipeline | argocd proj role create-token <projekt> <rolle> --expires-in 1h |
| Kontext wechseln | argocd context <name> |
Secrets mit SOPS
| Aufgabe | Befehl |
|---|---|
| Schlüssel erzeugen | age-keygen -o ~/argo-lab/age.key |
| Öffentlicher Schlüssel | age-keygen -y ~/argo-lab/age.key |
| Verschlüsseln | sops encrypt -i <datei>.enc.yaml |
| Lesen | SOPS_AGE_KEY_FILE=~/argo-lab/age.key sops decrypt <datei> |
| Einen Wert ändern | sops set <datei> '["stringData"]["apiKey"]' '"neu"' |
| Neue Empfänger | sops updatekeys <datei> |
Nie eine .enc.yaml von Hand ändern, die Prüfsumme deckt
alle Felder ab.
Cluster
| Aufgabe | Befehl |
|---|---|
| Anmelden | argocd cluster add <kontext> --kubeconfig <datei> --name <name> |
| Liste | argocd cluster list |
| Label | argocd cluster set <name> --label stufe=prod |
| Zugänge | kubectl -n argocd get secret -l argocd.argoproj.io/secret-type=cluster |
Image Updater, Notifications, Rollouts
| Aufgabe | Befehl |
|---|---|
| Image Updater | kubectl -n argocd get imageupdater, Logs von
argocd-image-updater-controller |
| Trigger prüfen | kubectl -n argocd exec deploy/argocd-notifications-controller -- argocd admin notifications trigger run <trigger> <app> |
| Testnachricht | … argocd admin notifications template notify <template> <app> --recipient <service> |
| Abonnieren | Annotation
notifications.argoproj.io/subscribe.<trigger>.<service>: "" |
| Rollout ansehen | kubectl argo rollouts get rollout <name> -n <ns> |
| Weiter, abbrechen | kubectl argo rollouts promote <name>,
… abort <name> |
| Status | kubectl argo rollouts status <name> -n <ns> |
| Analysen | kubectl -n <ns> get analysisrun |
Betrieb
| Aufgabe | Befehl |
|---|---|
| Backup | argocd admin export -n argocd > backup.yaml |
| Zurückspielen | argocd admin import -n argocd - < backup.yaml |
| Metriken | kubectl get --raw /api/v1/namespaces/argocd/services/argocd-metrics:metrics/proxy/metrics |
| Upgrade | kubectl apply -n argocd --server-side --force-conflicts -f install.yaml |
| Logs | kubectl -n argocd logs sts/argocd-application-controller,
deploy/argocd-repo-server |
| Neu anmelden | argocd login 172.16.0.182:30443 --username admin --insecure |
Typische Fehler und ihre Ursachen stehen in Tag 14, Drill 4.