Day 2: The First Application
Goal: notes-api comes from the fleet repo into the cluster. You see the diff, sync by hand, and roll back a version. · Duration: approx. 45 min · Prerequisite: Day 1
Briefing
- An Application is a Kubernetes object in the
argocdnamespace. It connects a source (repo, revision, path) with a destination (cluster, namespace). - Argo CD renders the source and compares it with the destination. The
result is two states: Sync (
SyncedorOutOfSync) tells you whether Git and the cluster are the same. Health (Healthy,Progressing,Degraded,Missing) tells you whether the objects are running. - Today you sync by hand. From Day 3 on, Argo CD does it by itself.
argocd-fleet/apps/notes ──► repo-server renders ──► desired
│ compare
Namespace notes in the cluster ─────────────────► live
▼
Synced/OutOfSync · Healthy/Missing/…
Drill 1: The Manifests into the Repo
The files from Day 0 go into the fleet repo, this time without a
Namespace object and without namespace: in the metadata.
The Application determines the namespace.
cd ~/argo-lab/argocd-fleet
mkdir -p apps/notes
cat > apps/notes/secret.yaml <<'EOF'
apiVersion: v1
kind: Secret
metadata:
name: notes-api
stringData:
apiKey: lab-api-key-123
EOF
cat > apps/notes/deployment.yaml <<'EOF'
apiVersion: apps/v1
kind: Deployment
metadata:
name: notes
spec:
replicas: 1
selector:
matchLabels:
app: notes
template:
metadata:
labels:
app: notes
spec:
containers:
- name: api
image: ghcr.io/thomaszachmann/notes-api:0.5.1
ports:
- containerPort: 8080
env:
- name: NOTES_API_KEY
valueFrom:
secretKeyRef:
name: notes-api
key: apiKey
readinessProbe:
httpGet:
path: /healthz
port: 8080
EOF
cat > apps/notes/service.yaml <<'EOF'
apiVersion: v1
kind: Service
metadata:
name: notes
spec:
type: NodePort
selector:
app: notes
ports:
- port: 80
targetPort: 8080
nodePort: 30080
EOFThe API key is in plain text in Git. It must not stay that way; Day 10 cleans this up.
git add .
git commit -m "notes-api 0.5.1"
git push -u origin mainExpected (abridged):
[main (root-commit) 6135e30] notes-api 0.5.1
3 files changed, 47 insertions(+)
…
branch 'main' set up to track 'origin/main'.
Save your progress? Sign up for free
Drill 2: Register the Repo with Argo CD
The repo is private. Argo CD needs the same deploy key as you:
argocd repo add [email protected]:<du>/argocd-fleet.git \
--ssh-private-key-path ~/.ssh/argocd-fleet
argocd repo listExpected:
Repository '[email protected]:<du>/argocd-fleet.git' added
TYPE NAME REPO INSECURE OCI LFS CREDS STATUS MESSAGE PROJECT
git [email protected]:<du>/argocd-fleet.git false false false false Successful
Successful means: Argo CD connected with the key and
read the repo. Argo CD already knows GitHub’s host key from
argocd-ssh-known-hosts-cm.
The repo is stored as a Secret with a special label:
kubectl -n argocd get secret -l argocd.argoproj.io/secret-type=repositoryExpected (name will differ):
NAME TYPE DATA AGE
repo-3993372767 Opaque 3 2s
Save your progress? Sign up for free
Drill 3: The Application
You write the Application as a file. Today it still lives outside the fleet repo; on Day 7 it moves in there.
mkdir -p ~/argo-lab/tag02
cd ~/argo-lab/tag02
cat > notes-app.yaml <<'EOF'
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: notes
namespace: argocd
spec:
project: default
source:
repoURL: [email protected]:<du>/argocd-fleet.git
targetRevision: main
path: apps/notes
destination:
server: https://kubernetes.default.svc
namespace: notes
syncPolicy:
syncOptions:
- CreateNamespace=true
EOF
kubectl apply -f notes-app.yamlExpected:
application.argoproj.io/notes created
project: defaultis the project that every installation comes with. It allows everything. Your own projects with boundaries come on Day 9.targetRevision: mainfollows the branch. A tag or a commit hash would also work.CreateNamespace=truecreatesnotesif it is missing.
argocd app get notesExpected (abridged):
Name: argocd/notes
Project: default
Server: https://kubernetes.default.svc
Namespace: notes
URL: https://172.16.0.182:30443/applications/notes
…
Sync Policy: Manual
Sync Status: OutOfSync from main (6135e30)
Health Status: Missing
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE
Secret notes notes-api OutOfSync Missing
Service notes notes OutOfSync Missing
apps Deployment notes notes OutOfSync Missing
Argo CD has read the repo and knows what is missing. It has not
created anything yet, because the sync policy is
Manual.
Save your progress? Sign up for free
Drill 4: Diff and Sync
argocd app diff notesExpected (abridged):
===== /Secret notes/notes-api ======
0a1,9
> apiVersion: v1
> data:
> apiKey: ++++++++
> kind: Secret
> metadata:
> annotations:
> argocd.argoproj.io/tracking-id: notes:/Secret:notes/notes-api
…
- Argo CD never shows the value of the Secret, only
++++++++. - Argo CD sets the annotation
argocd.argoproj.io/tracking-idon every object. That is how it later recognizes which objects belong to which Application.
argocd app sync notesExpected (abridged):
…
Phase: Succeeded
…
Message: successfully synced (all tasks run)
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE
Namespace notes Running Synced namespace/notes created
Secret notes notes-api Synced secret/notes-api created
Service notes notes Synced Healthy service/notes created
apps Deployment notes notes Synced Healthy deployment.apps/notes created
argocd app list
curl -s localhost:30080/versionExpected (abridged):
NAME CLUSTER NAMESPACE PROJECT STATUS HEALTH SYNCPOLICY …
argocd/notes https://kubernetes.default.svc notes default Synced Healthy Manual …
0.5.1
In the browser you see the same thing as a tree: the Application, below it the Deployment, ReplicaSet, and Pod.
Save your progress? Sign up for free
Drill 5: A Change Through Git
The new version no longer comes via kubectl set image,
but via a commit:
cd ~/argo-lab/argocd-fleet
sed -i "s/notes-api:0.5.1/notes-api:0.5.3/" apps/notes/deployment.yaml
git commit -am "notes-api 0.5.3"
git pushExpected (abridged):
[main 23d84d9] notes-api 0.5.3
1 file changed, 1 insertion(+), 1 deletion(-)
Argo CD polls Git on its own every 120 seconds, plus a small random
delay. With --refresh you do not have to wait:
argocd app get notes --refresh | grep -E "Sync Status|Health Status"
argocd app diff notesExpected:
Sync Status: OutOfSync from main (23d84d9)
Health Status: Healthy
===== apps/Deployment notes/notes ======
141c141
< image: ghcr.io/thomaszachmann/notes-api:0.5.1
---
> image: ghcr.io/thomaszachmann/notes-api:0.5.3
Health stays Healthy, because a version is still
running. Only Git and the cluster no longer match.
argocd app sync notes
argocd app wait notes --health
curl -s localhost:30080/versionExpected (abridged):
…
0.5.3
Save your progress? Sign up for free
Drill 6: History and Rollback
argocd app history notesExpected:
SOURCE [email protected]:<du>/argocd-fleet.git
ID DATE REVISION
0 2026-11-14 08:28:44 +0000 UTC main (6135e30)
1 2026-11-14 08:29:05 +0000 UTC main (23d84d9)
Every sync is listed here with its commit. A rollback syncs an old entry:
argocd app rollback notes 0
curl -s localhost:30080/version
argocd app get notes | grep -E "Sync Status|Health Status"Expected (abridged):
…
Message: successfully synced (all tasks run)
…
apps Deployment notes notes OutOfSync Healthy deployment.apps/notes configured
0.5.1
Sync Status: OutOfSync from main (23d84d9)
Health Status: Healthy
The cluster is running 0.5.1 again, but Git still says 0.5.3. A rollback is an emergency brake, not a solution. The real fix is a commit. For today, you bring back the state from Git:
argocd app sync notes
argocd app get notes | grep -E "Sync Status|Health Status"Expected (abridged):
…
Sync Status: Synced to main (23d84d9)
Health Status: Healthy
Save your progress? Sign up for free
Checkpoint
argocd app listExpected: argocd/notes with Synced and
Healthy.
curl -s localhost:30080/versionExpected: 0.5.3.
kubectl -n notes get deploy notes -o yaml | grep tracking-idExpected: two lines, the first one reads
argocd.argoproj.io/tracking-id: notes:apps/Deployment:notes/notes.
Challenge
notes-api should run with two pods. Change this only through Git and sync.
Hint: replicas in the Deployment, then
commit, push, --refresh,
sync.
Solution
cd ~/argo-lab/argocd-fleet
sed -i "s/replicas: 1/replicas: 2/" apps/notes/deployment.yaml
git commit -am "notes: zwei Replikate"
git push
argocd app get notes --refresh
argocd app sync notes
argocd app wait notes --health
kubectl -n notes get deploy notesExpected (abridged):
NAME READY UP-TO-DATE AVAILABLE AGE
notes 2/2 2 2 75s
Save your progress? Sign up for free
Enterprise Note
- Applications themselves belong in Git, not in individual files on a laptop. Day 7 shows the pattern for this.
- Instead of polling every three minutes, GitHub can notify Argo CD
via webhook (
/api/webhookon the argocd-server). That saves waiting time and load. - Pinning
targetRevisionto a tag or commit is common for production. A release is then a commit that changes this line.