From 0212f4bd67714a7c9156a3f716794cc4e9e2511c Mon Sep 17 00:00:00 2001 From: Paul Harkink Date: Sun, 1 Mar 2026 00:32:30 +0100 Subject: [PATCH] docs: clarify command context and workshop flow --- README.md | 69 +++++++++-------- docs/01-argocd-bootstrap.md | 57 +++++++++----- docs/02-deploy-podinfo.md | 57 ++++++++------ docs/03-metallb-ingress.md | 101 +++++++++++++++++++------ docs/04-tekton-pipeline.md | 122 +++++++++++++++++------------- docs/05-app-upgrade.md | 45 ++++++----- docs/06-monitoring.md | 58 +++++++------- docs/presentation/final-talk.md | 11 +-- docs/vm-setup.md | 95 ++++++++++++----------- scripts/vm/set-git-credentials.sh | 11 ++- 10 files changed, 377 insertions(+), 249 deletions(-) diff --git a/README.md b/README.md index ab153d8..336af9f 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,10 @@ Je hebt drie dingen nodig op je laptop. Installeer ze de dag van tevoren — nie Minimaal 12 GB vrij RAM en ~15 GB schijfruimte. Snelle check: -```bash -VBoxManage --version && vagrant --version && git --version -``` +> **VM** +> ```bash +> VBoxManage --version && vagrant --version && git --version +> ``` Als één van de drie niets teruggeeft: installeren en opnieuw proberen. @@ -32,35 +33,41 @@ kun je zelf pushen zonder dat je toegang nodig hebt tot de originele repo. 1. Clone je fork op je host-machine. -```bash -git clone https://github.com/JOUW_USERNAME/ops-demo.git && cd ops-demo -``` +> **HOST** +> ```bash +> git clone https://github.com/JOUW_USERNAME/ops-demo.git && cd ops-demo +> ``` 2. Start de VM. -```bash -vagrant up -``` +> **VM** +> ```bash +> vagrant up +> ``` 3. Run bootstrap vanaf je host (script voert bootstrap in de VM uit). -```bash -./scripts/host/bootstrap-from-host.sh -``` +> **HOST** +> ```bash +> ./scripts/host/bootstrap-from-host.sh +> ``` -```powershell -./scripts/host/bootstrap-from-host.ps1 -``` +> **HOST** +> ```powershell +> ./scripts/host/bootstrap-from-host.ps1 +> ``` 4. Open ArgoCD UI via tunnel. -```bash -./scripts/host/argocd-ui-tunnel.sh -``` +> **HOST** +> ```bash +> ./scripts/host/argocd-ui-tunnel.sh +> ``` -```powershell -./scripts/host/argocd-ui-tunnel.ps1 -``` +> **HOST** +> ```powershell +> ./scripts/host/argocd-ui-tunnel.ps1 +> ``` 5. Open in je browser: @@ -111,8 +118,9 @@ Beginners: focus op 01–03 (~1u45m). De rest: probeer 01–05 te halen. ## Vastgelopen? -Elke solution branch is cumulatief — hij bevat alles t/m die oefening. Je kunt een PR openen van een solution branch -naar jouw eigen branch om precies te zien wat er mist. +Elke solution branch is standalone per oefening (niet cumulatief). +Je kunt een PR openen van een solution branch naar jouw eigen branch +om precies te zien wat er in die specifieke oefening mist. | Branch | Bevat | |--------------------------------|-------------------------------------| @@ -136,17 +144,18 @@ naar jouw eigen branch om precies te zien wat er mist. | ArgoCD UI niet bereikbaar op `http://localhost:8080` | Start de tunnel opnieuw: `./scripts/host/argocd-ui-tunnel.sh` (of `.ps1` op Windows). | | `kubectl` lijkt naar de verkeerde cluster te wijzen | Gebruik de host-scripts (`./scripts/host/bootstrap-from-host.sh` en `./scripts/host/argocd-ui-tunnel.sh`) of log in met `vagrant ssh` en werk vanuit `/vagrant`. De bootstrap heeft cluster-checks en stopt bij mismatch. | | `root` app blijft `Unknown` of `OutOfSync` | Controleer of `apps/root.yaml` naar jouw fork verwijst en of je die commit/push hebt gedaan. Daarna in ArgoCD op **Refresh** klikken. | -| Tekton pipeline kan niet pushen naar GitHub | Controleer credentials opnieuw met `./scripts/vm/set-git-credentials.sh ` en gebruik een PAT met juiste repo-rechten. | +| Tekton pipeline kan niet pushen naar GitHub | Zet credentials opnieuw: in VM `./scripts/vm/set-git-credentials.sh ` (na `vagrant ssh` + `cd /vagrant`) of vanaf host `vagrant ssh -c "/vagrant/scripts/vm/set-git-credentials.sh "`. Gebruik een PAT met juiste repo-rechten. | | MetalLB/Ingress hostnames werken niet | Wacht tot networking apps `Healthy` zijn in ArgoCD en controleer of het host-only netwerk `192.168.56.x` actief is. | Handige debug-commando's: -```bash -vagrant global-status --prune -vagrant status -kubectl get applications -n argocd -kubectl get pods -A -``` +> **VM** +> ```bash +> vagrant global-status --prune +> vagrant status +> kubectl get applications -n argocd +> kubectl get pods -A +> ``` --- diff --git a/docs/01-argocd-bootstrap.md b/docs/01-argocd-bootstrap.md index 5dce202..24b91e2 100644 --- a/docs/01-argocd-bootstrap.md +++ b/docs/01-argocd-bootstrap.md @@ -5,6 +5,7 @@ --- + ## Wat je leert - ArgoCD installeren via Helm @@ -17,13 +18,12 @@ De VM draait en je bent ingelogd: -```bash -vagrant ssh -cd /vagrant -kubectl get nodes -# NAME STATUS ROLES AGE VERSION -# ops-demo Ready control-plane,master ... -``` +> **VM** +> ```bash +> kubectl get nodes +> # NAME STATUS ROLES AGE VERSION +> # ops-demo Ready control-plane,master ... +> ``` --- @@ -37,9 +37,21 @@ Ga in dat geval direct naar stap 3. Wil je vanaf een blanke VM starten, voer dan bootstrap handmatig uit in de VM: -```bash -./scripts/vm/bootstrap.sh -``` +> **VM** +> ```bash +> ./scripts/vm/bootstrap.sh +> ``` + +> **HOST: Mac** +> ```bash +> ./scripts/host/bootstrap-from-host.sh +> ``` + +> **HOST: Windows** +> ```powershell +> ./scripts/host/bootstrap-from-host.ps1 +> ``` + Het script doet het volgende: @@ -57,9 +69,10 @@ Aan het einde zie je het admin-wachtwoord. **Kopieer het nu.** Op je laptop: -```bash -./scripts/host/argocd-ui-tunnel.sh -``` +> **HOST** +> ```bash +> ./scripts/host/argocd-ui-tunnel.sh +> ``` Open **http://localhost:8080**. Login: `admin` / het wachtwoord uit de output van het script. @@ -138,11 +151,12 @@ Gebruik hier dus `workshop` als projectwaarde. Het bootstrap-script heeft `apps/root.yaml` aangemaakt met jouw fork-URL. Dit bestand moet in je repo staan zodat ArgoCD het kan synchroniseren: -```bash -git add apps/root.yaml -git commit -m "feat: add root app-of-apps" -git push -``` +> **HOST** +> ```bash +> git add apps/root.yaml +> git commit -m "feat: add root app-of-apps" +> git push +> ``` --- @@ -155,9 +169,10 @@ In de ArgoCD UI zie je nu de **root** application verschijnen. Klik erop. Controleer ook via de CLI: -```bash -kubectl get applications -n argocd -``` +> **VM** +> ```bash +> kubectl get applications -n argocd +> ``` --- diff --git a/docs/02-deploy-podinfo.md b/docs/02-deploy-podinfo.md index 0cb1015..61478e2 100644 --- a/docs/02-deploy-podinfo.md +++ b/docs/02-deploy-podinfo.md @@ -5,6 +5,7 @@ --- + ## Wat je leert - Hoe je een ArgoCD Application toevoegt door één bestand te committen @@ -136,11 +137,12 @@ Vervang `JOUW_FORK_URL` door jouw fork-URL. ### 3. Committen en pushen -```bash -git add apps/apps/podinfo.yaml manifests/apps/podinfo/ -git commit -m "feat: deploy podinfo via GitOps" -git push -``` +> **HOST** +> ```bash +> git add apps/apps/podinfo.yaml manifests/apps/podinfo/ +> git commit -m "feat: deploy podinfo via GitOps" +> git push +> ``` Dit is de enige actie die nodig is om de applicatie te deployen. @@ -151,32 +153,36 @@ Dit is de enige actie die nodig is om de applicatie te deployen. ### 4. Wachten tot het Synced is -```bash -kubectl get application podinfo -n argocd -w -``` +> **VM** +> ```bash +> kubectl get application podinfo -n argocd -w +> ``` Wacht tot je `Synced` en `Healthy` ziet. Dan: -```bash -kubectl get pods -n podinfo -# NAME READY STATUS RESTARTS AGE -# podinfo-xxx-xxx 1/1 Running 0 30s -``` +> **VM** +> ```bash +> kubectl get pods -n podinfo +> # NAME READY STATUS RESTARTS AGE +> # podinfo-xxx-xxx 1/1 Running 0 30s +> ``` --- ### 5. Controleer dat de app werkt -```bash -kubectl port-forward svc/podinfo -n podinfo 9898:80 -``` +> **VM** +> ```bash +> kubectl port-forward svc/podinfo -n podinfo 9898:80 +> ``` In een ander terminal (of via curl): -```bash -curl http://localhost:9898 -# {"hostname":"podinfo-xxx","version":"6.6.2", ...} -``` +> **HOST** +> ```bash +> curl http://localhost:9898 +> # {"hostname":"podinfo-xxx","version":"6.6.2", ...} +> ``` Versie `6.6.2` — dat klopt met de image-tag in `deployment.yaml`. @@ -200,11 +206,12 @@ value: "#2ecc71" Commit en push: -```bash -git add manifests/apps/podinfo/deployment.yaml -git commit -m "chore: verander podinfo UI-kleur" -git push -``` +> **HOST** +> ```bash +> git add manifests/apps/podinfo/deployment.yaml +> git commit -m "chore: verander podinfo UI-kleur" +> git push +> ``` Binnen ~3 minuten (standaard poll-interval van ArgoCD) herstart de pod en zie je de nieuwe kleur. Je kunt ook op **Refresh** klikken in de UI diff --git a/docs/03-metallb-ingress.md b/docs/03-metallb-ingress.md index c9b4794..f5cf9b4 100644 --- a/docs/03-metallb-ingress.md +++ b/docs/03-metallb-ingress.md @@ -6,6 +6,7 @@ port-forward. --- + ## Wat je leert - Waarom je MetalLB nodig hebt op een bare-metal of lokaal Kubernetes-cluster @@ -39,6 +40,17 @@ Maak de volgende bestanden aan: **`manifests/networking/metallb/values.yaml`** +Wat dit doet: +- Configureert de MetalLB speaker pod. +- Met deze `toleration` mag de speaker op de control-plane node draaien. +- Dat is nodig in deze workshop, omdat je VM meestal maar 1 node heeft. + +Termen uitgelegd: +- `speaker`: de MetalLB component die op nodes draait en op het netwerk "antwoordt" voor een toegewezen + LoadBalancer-IP (in L2-modus via ARP). +- `tolerations`: een Kubernetes-mechanisme waarmee een pod tóch op een node mag landen die een `taint` heeft. + Control-plane nodes zijn vaak getaint met `NoSchedule`; zonder toleration wordt de speaker daar niet ingepland. + ```yaml speaker: tolerations: @@ -49,6 +61,11 @@ speaker: **`manifests/networking/metallb/metallb-config.yaml`** +Wat dit doet: +- `IPAddressPool` bepaalt uit welke range MetalLB IP's mag uitdelen. +- `L2Advertisement` maakt die pool zichtbaar op je host-only netwerk via ARP. +- Daardoor kan je laptop services op dat IP direct bereiken. + ```yaml apiVersion: metallb.io/v1beta1 kind: IPAddressPool @@ -71,6 +88,12 @@ spec: **`apps/networking/metallb.yaml`** +Wat dit doet: +- Installeert MetalLB via ArgoCD als aparte `Application`. +- De chart komt van de upstream Helm repo; jouw repo levert de values via `$values/...`. +- `sync-wave: "1"` zorgt dat MetalLB eerst klaar is. +- `ignoreDifferences` voorkomt bekende CRD `caBundle` drift door dynamische webhook certs. + ```yaml apiVersion: argoproj.io/v1alpha1 kind: Application @@ -110,6 +133,11 @@ spec: **`apps/networking/metallb-config.yaml`** +Wat dit doet: +- Past jouw IP-pool/L2-config toe als losse ArgoCD `Application`. +- Die split houdt "installatie" en "runtime-config" van MetalLB uit elkaar. +- `sync-wave: "2"` laat dit pas lopen nadat MetalLB zelf staat. + ```yaml apiVersion: argoproj.io/v1alpha1 kind: Application @@ -141,6 +169,11 @@ spec: **`manifests/networking/ingress-nginx/values.yaml`** +Wat dit doet: +- Zet ingress-nginx neer met een `LoadBalancer` service. +- Dat service-IP wordt vast op `192.168.56.200` gezet. +- Zo kun je stabiele hostnames gebruiken met `nip.io`. + ```yaml controller: ingressClassResource: @@ -157,6 +190,11 @@ controller: **`apps/networking/ingress-nginx.yaml`** +Wat dit doet: +- Installeert ingress-nginx via ArgoCD. +- Ook hier: chart upstream, values uit jouw repo. +- `sync-wave: "3"` laat ingress pas starten nadat MetalLB + config klaar zijn. + ```yaml apiVersion: argoproj.io/v1alpha1 kind: Application @@ -192,26 +230,29 @@ spec: ### 3. Alles committen en pushen -```bash -git add apps/networking/ manifests/networking/ -git commit -m "feat: MetalLB + Ingress-Nginx" -git push -``` +> **HOST** +> ```bash +> git add apps/networking/ manifests/networking/ +> git commit -m "feat: MetalLB + Ingress-Nginx" +> git push +> ``` Wacht tot beide applications Synced zijn, en controleer dan: -```bash -kubectl get svc -n ingress-nginx -# NAME TYPE EXTERNAL-IP PORT(S) -# ingress-nginx-controller LoadBalancer 192.168.56.200 80:xxx,443:xxx -``` +> **VM** +> ```bash +> kubectl get svc -n ingress-nginx +> # NAME TYPE EXTERNAL-IP PORT(S) +> # ingress-nginx-controller LoadBalancer 192.168.56.200 80:xxx,443:xxx +> ``` Vanuit je laptop: -```bash -curl http://192.168.56.200 -# 404 van Nginx — klopt, nog geen Ingress-regel -``` +> **HOST** +> ```bash +> curl http://192.168.56.200 +> # 404 van Nginx — klopt, nog geen Ingress-regel +> ``` --- @@ -219,6 +260,11 @@ curl http://192.168.56.200 **`manifests/apps/podinfo/ingress.yaml`** +Wat dit doet: +- Definieert de HTTP-route voor podinfo. +- `ingressClassName: nginx` bindt deze Ingress aan ingress-nginx. +- De hostnaam met `nip.io` wijst naar jouw MetalLB IP. + ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress @@ -240,11 +286,12 @@ spec: name: http ``` -```bash -git add manifests/apps/podinfo/ingress.yaml -git commit -m "feat: voeg podinfo Ingress toe" -git push -``` +> **HOST** +> ```bash +> git add manifests/apps/podinfo/ingress.yaml +> git commit -m "feat: voeg podinfo Ingress toe" +> git push +> ``` Open vanuit je laptop: **http://podinfo.192.168.56.200.nip.io** @@ -254,6 +301,11 @@ Open vanuit je laptop: **http://podinfo.192.168.56.200.nip.io** Pas `manifests/argocd/values.yaml` aan. Zoek het uitgecommentarieerde ingress-blok en verwijder de `#`-tekens: +Wat dit doet: +- Schakelt ingress in voor de ArgoCD server zelf. +- Daarna kun je ArgoCD via browser-URL gebruiken in plaats van port-forward. +- De `hostname` moet matchen met het IP dat ingress-nginx exposeert. + ```yaml ingress: enabled: true @@ -264,11 +316,12 @@ Pas `manifests/argocd/values.yaml` aan. Zoek het uitgecommentarieerde ingress-bl nginx.ingress.kubernetes.io/backend-protocol: "HTTP" ``` -```bash -git add manifests/argocd/values.yaml -git commit -m "feat: schakel ArgoCD ingress in" -git push -``` +> **HOST** +> ```bash +> git add manifests/argocd/values.yaml +> git commit -m "feat: schakel ArgoCD ingress in" +> git push +> ``` ArgoCD detecteert de wijziging, past zijn eigen Helm-release aan en maakt de Ingress aan. Open: **http://argocd.192.168.56.200.nip.io** diff --git a/docs/04-tekton-pipeline.md b/docs/04-tekton-pipeline.md index 2991371..31215f0 100644 --- a/docs/04-tekton-pipeline.md +++ b/docs/04-tekton-pipeline.md @@ -6,6 +6,7 @@ volledige GitOps CI/CD-loop. --- + ## Wat je leert - Tekton-concepten: Task, Pipeline, PipelineRun, Workspace @@ -86,19 +87,21 @@ spec: - ServerSideApply=true ``` -```bash -git add apps/ci/tekton.yaml manifests/ci/tekton/ -git commit -m "feat: installeer Tekton via ArgoCD" -git push -``` +> **HOST** +> ```bash +> git add apps/ci/tekton.yaml manifests/ci/tekton/ +> git commit -m "feat: installeer Tekton via ArgoCD" +> git push +> ``` Wacht tot Tekton draait (~3–5 minuten): -```bash -kubectl get pods -n tekton-pipelines -# tekton-pipelines-controller-xxx 1/1 Running -# tekton-pipelines-webhook-xxx 1/1 Running -``` +> **VM** +> ```bash +> kubectl get pods -n tekton-pipelines +> # tekton-pipelines-controller-xxx 1/1 Running +> # tekton-pipelines-webhook-xxx 1/1 Running +> ``` --- @@ -117,9 +120,10 @@ metadata: **`manifests/ci/pipeline/pipeline.yaml`** — zie de solution branch voor de volledige inhoud, of kopieer uit `reference-solution`: -```bash -git show origin/solution/04-tekton-pipeline:manifests/ci/pipeline/pipeline.yaml -``` +> **HOST** +> ```bash +> git show origin/solution/04-tekton-pipeline:manifests/ci/pipeline/pipeline.yaml +> ``` **`manifests/ci/pipeline/pipelinerun.yaml`** @@ -185,11 +189,12 @@ spec: - CreateNamespace=true ``` -```bash -git add apps/ci/pipeline.yaml manifests/ci/pipeline/ -git commit -m "feat: voeg pipeline-resources toe" -git push -``` +> **HOST** +> ```bash +> git add apps/ci/pipeline.yaml manifests/ci/pipeline/ +> git commit -m "feat: voeg pipeline-resources toe" +> git push +> ``` --- @@ -255,11 +260,12 @@ spec: - CreateNamespace=true ``` -```bash -git add apps/ci/tekton-dashboard.yaml manifests/ci/dashboard/ -git commit -m "feat: voeg Tekton Dashboard met ingress toe" -git push -``` +> **HOST** +> ```bash +> git add apps/ci/tekton-dashboard.yaml manifests/ci/dashboard/ +> git commit -m "feat: voeg Tekton Dashboard met ingress toe" +> git push +> ``` Open daarna: **http://tekton.192.168.56.200.nip.io** @@ -271,13 +277,14 @@ Dit is een verplichte stap vóór je de PipelineRun triggert. Zonder `git-credentials` secret faalt de `clone` task direct. De pipeline moet kunnen pushen naar jouw fork. -Maak een GitHub PAT aan met `repo`-scope en voer dan uit: +Maak een GitHub PAT aan met `repo`-scope en voer daarna een van deze opties uit: -```bash -./scripts/vm/set-git-credentials.sh -``` +> **VM** +> ```bash +> /vagrant/scripts/vm/set-git-credentials.sh +> ``` -Dit maakt een Kubernetes Secret aan in de cluster — **het PAT komt niet in Git**. +Dit maakt een Kubernetes Secret aan in het cluster — **het PAT komt niet in Git**. --- @@ -286,21 +293,24 @@ Dit maakt een Kubernetes Secret aan in de cluster — **het PAT komt niet in Git Controleer eerst dat stap 3 gelukt is. Pas daarna de PipelineRun starten: -```bash -kubectl apply -f manifests/ci/pipeline/pipelinerun.yaml -``` +> **VM** +> ```bash +> kubectl apply -f manifests/ci/pipeline/pipelinerun.yaml +> ``` Volg de voortgang: -```bash -kubectl get pipelinerun -n tekton-pipelines -w -``` +> **VM** +> ```bash +> kubectl get pipelinerun -n tekton-pipelines -w +> ``` Of per pod: -```bash -kubectl get pods -n tekton-pipelines -w -``` +> **VM** +> ```bash +> kubectl get pods -n tekton-pipelines -w +> ``` De PipelineRun duurt ~2–3 minuten. @@ -308,11 +318,12 @@ De PipelineRun duurt ~2–3 minuten. ### 6. Controleer de commit -```bash -git fetch origin -git log origin/main --oneline -3 -# Je ziet: chore(pipeline): bump podinfo to 6.7.0 -``` +> **HOST** +> ```bash +> git fetch origin +> git log origin/main --oneline -3 +> # Je ziet: chore(pipeline): bump podinfo to 6.7.0 +> ``` --- @@ -320,9 +331,10 @@ git log origin/main --oneline -3 Klik **Refresh** op de **podinfo** application in ArgoCD, of wacht op het automatische poll-interval. -```bash -kubectl rollout status deployment/podinfo -n podinfo -``` +> **VM** +> ```bash +> kubectl rollout status deployment/podinfo -n podinfo +> ``` --- @@ -330,10 +342,11 @@ kubectl rollout status deployment/podinfo -n podinfo Open **http://podinfo.192.168.56.200.nip.io** — je ziet nu versie **6.7.0**. -```bash -curl http://podinfo.192.168.56.200.nip.io | jq .version -# "6.7.0" -``` +> **HOST** +> ```bash +> curl http://podinfo.192.168.56.200.nip.io | jq .version +> # "6.7.0" +> ``` --- @@ -341,10 +354,11 @@ curl http://podinfo.192.168.56.200.nip.io | jq .version De naam van een PipelineRun moet uniek zijn: -```bash -kubectl delete pipelinerun bump-podinfo-to-670 -n tekton-pipelines -kubectl apply -f manifests/ci/pipeline/pipelinerun.yaml -``` +> **VM** +> ```bash +> kubectl delete pipelinerun bump-podinfo-to-670 -n tekton-pipelines +> kubectl apply -f manifests/ci/pipeline/pipelinerun.yaml +> ``` --- @@ -353,7 +367,7 @@ kubectl apply -f manifests/ci/pipeline/pipelinerun.yaml | Symptoom | Oplossing | |-----------------------------------------|--------------------------------------------------------------------------------------------------------| | PipelineRun blijft "Running" | `kubectl describe pipelinerun -n tekton-pipelines bump-podinfo-to-670` | -| Secret `git-credentials` niet gevonden | Voer `./scripts/vm/set-git-credentials.sh` uit | +| Secret `git-credentials` niet gevonden | Run in VM: `./scripts/vm/set-git-credentials.sh ...` (na `vagrant ssh` + `cd /vagrant`) of vanaf host: `vagrant ssh -c \"/vagrant/scripts/vm/set-git-credentials.sh ...\"` | | Push mislukt: 403 Forbidden | PAT heeft onvoldoende rechten — `repo`-scope vereist | | ArgoCD synchroniseert niet | Klik **Refresh** in de UI | | `root` blijft OutOfSync op app `tekton` | Verwijder de lege `kustomize: {}` uit `apps/ci/tekton.yaml` (Argo normaliseert deze weg in live state) | diff --git a/docs/05-app-upgrade.md b/docs/05-app-upgrade.md index 31da7c0..a24ea3a 100644 --- a/docs/05-app-upgrade.md +++ b/docs/05-app-upgrade.md @@ -5,6 +5,7 @@ --- + ## Wat je gebouwd hebt ``` @@ -53,28 +54,31 @@ Tekton PipelineRun Als de pipeline podinfo al naar `6.7.0` heeft gebracht, probeer dan een handmatige downgrade: -```bash -# Pas de image-tag terug aan naar 6.6.2 -vim manifests/apps/podinfo/deployment.yaml - -git add manifests/apps/podinfo/deployment.yaml -git commit -m "chore: downgrade podinfo naar 6.6.2" -git push -``` +> **HOST** +> ```bash +> # Pas de image-tag terug aan naar 6.6.2 +> vim manifests/apps/podinfo/deployment.yaml +> +> git add manifests/apps/podinfo/deployment.yaml +> git commit -m "chore: downgrade podinfo naar 6.6.2" +> git push +> ``` Kijk hoe ArgoCD synchroniseert, en verifieer: -```bash -curl http://podinfo.192.168.56.200.nip.io | jq .version -# "6.6.2" -``` +> **HOST** +> ```bash +> curl http://podinfo.192.168.56.200.nip.io | jq .version +> # "6.6.2" +> ``` En upgrade dan weer via de pipeline: -```bash -kubectl delete pipelinerun bump-podinfo-to-670 -n tekton-pipelines -kubectl apply -f manifests/ci/pipeline/pipelinerun.yaml -``` +> **VM** +> ```bash +> kubectl delete pipelinerun bump-podinfo-to-670 -n tekton-pipelines +> kubectl apply -f manifests/ci/pipeline/pipelinerun.yaml +> ``` --- @@ -82,10 +86,11 @@ kubectl apply -f manifests/ci/pipeline/pipelinerun.yaml ArgoCD heeft `selfHeal: true` — hij draait handmatige cluster-wijzigingen automatisch terug. -```bash -# Wijzig de image-tag direct in de cluster (buiten Git om) -kubectl set image deployment/podinfo podinfo=ghcr.io/stefanprodan/podinfo:6.5.0 -n podinfo -``` +> **VM** +> ```bash +> # Wijzig de image-tag direct in de cluster (buiten Git om) +> kubectl set image deployment/podinfo podinfo=ghcr.io/stefanprodan/podinfo:6.5.0 -n podinfo +> ``` Kijk in de ArgoCD UI — binnen seconden gaat de podinfo-app op **OutOfSync**, en daarna zet ArgoCD hem terug naar wat er in Git staat. diff --git a/docs/06-monitoring.md b/docs/06-monitoring.md index cdc6373..1dd56e0 100644 --- a/docs/06-monitoring.md +++ b/docs/06-monitoring.md @@ -5,6 +5,7 @@ --- + ## Wat je leert - Hoe je een complexe multi-component stack (kube-prometheus-stack) puur via GitOps deployet @@ -109,11 +110,12 @@ spec: - ServerSideApply=true ``` -```bash -git add apps/monitoring/ manifests/monitoring/ -git commit -m "feat: Prometheus + Grafana via kube-prometheus-stack" -git push -``` +> **HOST** +> ```bash +> git add apps/monitoring/ manifests/monitoring/ +> git commit -m "feat: Prometheus + Grafana via kube-prometheus-stack" +> git push +> ``` De initiële sync duurt 5–8 minuten — de chart is groot en installeert veel CRDs. @@ -121,17 +123,19 @@ De initiële sync duurt 5–8 minuten — de chart is groot en installeert veel ### 2. Wachten tot de stack klaar is -```bash -kubectl get pods -n monitoring -w -``` +> **VM** +> ```bash +> kubectl get pods -n monitoring -w +> ``` Zodra alles Running is: -```bash -kubectl get ingress -n monitoring -# NAME HOSTS ADDRESS -# grafana grafana.192.168.56.200.nip.io 192.168.56.200 -``` +> **VM** +> ```bash +> kubectl get ingress -n monitoring +> # NAME HOSTS ADDRESS +> # grafana grafana.192.168.56.200.nip.io 192.168.56.200 +> ``` --- @@ -159,10 +163,11 @@ Interessant voor deze workshop: ### 5. Load genereren op podinfo -```bash -# In de VM -while true; do curl -s http://podinfo.192.168.56.200.nip.io > /dev/null; sleep 0.2; done -``` +> **VM** +> ```bash +> # In de VM +> while true; do curl -s http://podinfo.192.168.56.200.nip.io > /dev/null; sleep 0.2; done +> ``` Open in Grafana: **Kubernetes / Compute Resources / Namespace (Pods)** → namespace `podinfo`. Je ziet het CPU-gebruik stijgen. @@ -173,15 +178,16 @@ Je ziet het CPU-gebruik stijgen. Probeer het Grafana-wachtwoord aan te passen: -```bash -vim manifests/monitoring/values.yaml -# Verander: adminPassword: workshop123 -# Naar: adminPassword: nieuwwachtwoord - -git add manifests/monitoring/values.yaml -git commit -m "chore: pas Grafana-wachtwoord aan" -git push -``` +> **HOST** +> ```bash +> vim manifests/monitoring/values.yaml +> # Verander: adminPassword: workshop123 +> # Naar: adminPassword: nieuwwachtwoord +> +> git add manifests/monitoring/values.yaml +> git commit -m "chore: pas Grafana-wachtwoord aan" +> git push +> ``` ArgoCD synchroniseert de Helm-release en Grafana herstart. Log daarna in met het nieuwe wachtwoord. diff --git a/docs/presentation/final-talk.md b/docs/presentation/final-talk.md index ce6014e..f513900 100644 --- a/docs/presentation/final-talk.md +++ b/docs/presentation/final-talk.md @@ -66,11 +66,12 @@ ### De oude manier: imperatieve deploys -```bash -# Iemand draait dit op vrijdagmiddag -kubectl set image deployment/api api=company/api:v2.3.1-hotfix -# Geen review. Geen audit trail. Niemand weet wie dit om 16:47 deed. -``` +> **VM** +> ```bash +> # Iemand draait dit op vrijdagmiddag +> kubectl set image deployment/api api=company/api:v2.3.1-hotfix +> # Geen review. Geen audit trail. Niemand weet wie dit om 16:47 deed. +> ``` ### De GitOps manier diff --git a/docs/vm-setup.md b/docs/vm-setup.md index ca4d648..eb2c3eb 100644 --- a/docs/vm-setup.md +++ b/docs/vm-setup.md @@ -21,9 +21,10 @@ een reboot. Snelle check — alle drie moeten een versie tonen: -```bash -VBoxManage --version && vagrant --version && git --version -``` +> **VM** +> ```bash +> VBoxManage --version && vagrant --version && git --version +> ``` --- @@ -31,18 +32,20 @@ VBoxManage --version && vagrant --version && git --version Fork de repo naar je eigen GitHub-account via https://github.com/paulharkink/ops-demo → **Fork**. -```bash -git clone https://github.com/JOUW_USERNAME/ops-demo.git -cd ops-demo -``` +> **HOST** +> ```bash +> git clone https://github.com/JOUW_USERNAME/ops-demo.git +> cd ops-demo +> ``` --- ## Stap 2 — VM opstarten -```bash -vagrant up -``` +> **VM** +> ```bash +> vagrant up +> ``` De eerste keer duurt dit 10–15 minuten. Vagrant downloadt de Ubuntu 24.04 box, installeert k3s, Helm en yq, en haalt de workshop-images alvast op. Daarna start de VM in een paar seconden. @@ -59,10 +62,11 @@ Aan het einde zie je: ## Stap 3 — Inloggen -```bash -vagrant ssh -cd /vagrant -``` +> **HOST** +> ```bash +> vagrant ssh +> cd /vagrant +> ``` Alle workshop-commando's voer je vanaf hier uit, tenzij anders aangegeven. @@ -70,17 +74,18 @@ Alle workshop-commando's voer je vanaf hier uit, tenzij anders aangegeven. ## Stap 4 — Controleer de setup -```bash -kubectl get nodes -# NAME STATUS ROLES AGE VERSION -# ops-demo Ready control-plane,master Xm v1.31.x+k3s1 - -helm version -# version.BuildInfo{Version:"v3.16.x", ...} - -ls /vagrant -# Vagrantfile README.md apps/ docs/ manifests/ scripts/ -``` +> **VM** +> ```bash +> kubectl get nodes +> # NAME STATUS ROLES AGE VERSION +> # ops-demo Ready control-plane,master Xm v1.31.x+k3s1 +> +> helm version +> # version.BuildInfo{Version:"v3.16.x", ...} +> +> ls /vagrant +> # Vagrantfile README.md apps/ docs/ manifests/ scripts/ +> ``` --- @@ -88,23 +93,26 @@ ls /vagrant Vanuit je laptop (niet de VM): -```bash -ping 192.168.56.10 -``` +> **VM** +> ```bash +> ping 192.168.56.10 +> ``` Werkt dit niet, controleer dan of de VirtualBox host-only adapter bestaat: -```bash -VBoxManage list hostonlyifs -# Verwacht: vboxnet0 met IP 192.168.56.1 -``` +> **VM** +> ```bash +> VBoxManage list hostonlyifs +> # Verwacht: vboxnet0 met IP 192.168.56.1 +> ``` Bestaat hij niet: -```bash -VBoxManage hostonlyif create -VBoxManage hostonlyif ipconfig vboxnet0 --ip 192.168.56.1 --netmask 255.255.255.0 -``` +> **VM** +> ```bash +> VBoxManage hostonlyif create +> VBoxManage hostonlyif ipconfig vboxnet0 --ip 192.168.56.1 --netmask 255.255.255.0 +> ``` Dan `vagrant up` opnieuw. @@ -112,13 +120,14 @@ Dan `vagrant up` opnieuw. ## Handige Vagrant-commando's -```bash -vagrant halt # afsluiten -vagrant up # opstarten -vagrant suspend # pauzeren -vagrant resume # hervatten -vagrant destroy # VM volledig verwijderen -``` +> **VM** +> ```bash +> vagrant halt # afsluiten +> vagrant up # opstarten +> vagrant suspend # pauzeren +> vagrant resume # hervatten +> vagrant destroy # VM volledig verwijderen +> ``` --- diff --git a/scripts/vm/set-git-credentials.sh b/scripts/vm/set-git-credentials.sh index 847e53c..1442b4d 100755 --- a/scripts/vm/set-git-credentials.sh +++ b/scripts/vm/set-git-credentials.sh @@ -19,6 +19,15 @@ fi GITHUB_USER="$1" GITHUB_PAT="$2" NAMESPACE="tekton-pipelines" +PIPELINERUN_REL="manifests/ci/pipeline/pipelinerun.yaml" +if [[ -f "${PIPELINERUN_REL}" ]]; then + PIPELINERUN_PATH="${PIPELINERUN_REL}" +elif [[ -f "/vagrant/${PIPELINERUN_REL}" ]]; then + PIPELINERUN_PATH="/vagrant/${PIPELINERUN_REL}" +else + # Fallback if workshop repo is in a custom location. + PIPELINERUN_PATH="${PIPELINERUN_REL}" +fi echo "→ Creating git-credentials Secret in namespace ${NAMESPACE}" @@ -31,7 +40,7 @@ kubectl create secret generic git-credentials \ echo "✓ Secret created. The pipeline is ready to run." echo "" echo " Trigger the pipeline:" -echo " kubectl apply -f manifests/ci/pipeline/pipelinerun.yaml" +echo " kubectl apply -f ${PIPELINERUN_PATH}" echo "" echo " Watch progress:" echo " kubectl get pipelinerun -n tekton-pipelines -w"