DarDevLab ·DarDev Team · 5 min read

GitOps lab: deploy your first app

Hands-on DarDevLab module: push a manifest to git, let Flux reconcile, verify the app URL. Step-by-step for students who already completed container basics and want a first GitOps win on kind or k3s.

Terminal showing Flux reconciliation success for lab deployment

This DarDevLab module assumes you completed container basics—you can docker run an app and kubectl get pods without panic. Goal: push a manifest to git, watch Flux reconcile, curl the Service URL, and rollback with git revert. Total lab time: one focused afternoon on kind or k3s.

Prerequisites

  • kind or k3d cluster running locally
  • kubectl configured to cluster context
  • GitLab or GitHub repo you control
  • Sample app container image in a registry (GHCR fine)

Step 1 — Install Flux CLI and bootstrap

Install flux CLI matching cluster version. Run flux install in flux-system namespace—or flux bootstrap gitlab if using hosted bootstrap wizard with deploy key. Verify pods: kubectl get pods -n flux-system all Running.

Step 2 — Repository structure

Create clusters/lab/ with deployment.yaml, service.yaml, kustomization.yaml listing resources. Image should be public or pull secret documented in README—not committed secret.

  1. Deployment

    Two replicas, liveness HTTP /health, resource requests set.

  2. Service

    ClusterIP or NodePort for lab access via port-forward.

  3. Kustomize

    resources list both manifests; commonLabels app=lab-gitops-demo.

Step 3 — Flux GitRepository and Kustomization

Apply GitRepository CR pointing at your repo main branch with interval 1m. Apply Kustomization CR pointing path./clusters/lab with sourceRef GitRepository. flux get kustomizations shows Ready True when sync succeeds.

Step 4 — Verify deployment

kubectl get deploy,svc in target namespace. Port-forward Service and curl /health. Change replica count in git, commit push, watch Flux apply within interval—no manual kubectl apply.

Step 5 — Break and fix exercise

Introduce invalid image tag in git. Observe Kustomization health false and Deployment ImagePullBackOff. Revert commit; confirm recovery. Write three sentences in lab journal explaining what Flux did versus what kubectl would have shown.

Step 6 — Rollback story

Deploy v2 with broken readiness probe. Roll back via git revert merge commit. Document rollback time from revert push to Ready True—this metric matters in client runbooks.

Flux lab first deploy workflow
First GitOps win: cluster matches git, rollback is a revert.

Submission checklist for mentors

  1. Repo link with clusters/lab manifests
  2. Screenshot flux get kustomizations Ready
  3. Lab journal with break/fix narrative
  4. README: how classmate reproduces from scratch

Passing this lab unlocks GitOps module credit toward DarDevLab certification—see dardevlab-certification-tracks for full rubric.

Advanced stretch: add HelmRelease instead of raw Deployment—optional, not required for first pass.

Read gitops-flux-lessons for production lessons before suggesting Flux on client VPS without staging.

kind delete cluster cleans lab; keep git repo as portfolio artifact for internships.

Common student mistakes

  • Wrong path in Kustomization—points at repo root not clusters/lab
  • Forgot namespace in manifests—Flux creates in default unexpectedly
  • Manual kubectl apply same objects—fight with reconciler
  • Interval too long—waits ten minutes thinking lab broken

Mentors grade journal quality over speed—honest failure narrative beats copied README.

Pair with container-basics-tn-students if kubectl context confusion appears—fix foundations before blaming Flux.

Lab completion typically same week as GitOps lecture—schedule cluster time before deadline crunch.

Extending the lab

Add NetworkPolicy denying all ingress except ingress controller—observe need to update policy when debugging. Add ConfigMap change via git only—no kubectl edit. Optional: wire GitLab CI to build new image tag on each main commit.

Document cluster creation command in README so mentor reproduces your environment—kind create cluster with explicit name.

Students presenting capstone should demo live reconcile—slides optional, terminal required.

Failure to complete lab blocks GitOps certification module—foundations retake available.

Ask mentor for flux trace command when debugging slow sync—shows reconcile latency breakdown.

Screenshot flux events during lab submission—proves you observed controller not just applied YAML once manually.

Group lab pairs encouraged—pair programming mirrors DarDev client standups; individual journal still required.

After lab, read gitops-flux-lessons before recommending GitOps on family business VPS without staging.

Lab rubric weights reproducibility forty percent—README quality matters as much as working URL.

Office hours cover Git SSH key setup once per cohort—saves repeated mentor tickets.

Celebrate first successful git revert rollback in class channel—team culture starts in lab.

Time expectations

Average student completes lab in three to four hours spread over two sessions—cluster setup first day, Flux and journal second. Block calendar time; context switching doubles duration.

Mentors respond to stuck tickets within one business day—include flux get all output paste not screenshot alone.

Successful lab repos become templates for next cohort—your README helps future students.

If reconcile never succeeds after four hours debugging, post GitRepository and Kustomization YAML in mentor ticket—do not guess silently.

GitOps lab is prerequisite for platform capstone certification track.

Keep lab cluster running until mentor marks pass—delete only after confirmation email.

Flux teaches patience; reconciliation interval is feature not bug for learning.

Lab alumni interview tip: demo git revert rollback live—it impresses more than listing Flux on CV bullet.

Passing students add lab repo link to LinkedIn projects section same week—visibility matters for hiring.

Flux bootstrap failed?

Check GitLab deploy key permissions and HTTPS versus SSH URL in GitRepository.

No Ready on Kustomization?

flux logs and kubectl describe kustomization for path typos or CRD missing.

Can I use Argo CD instead?

Lab standardized on Flux; concepts transfer—stick to Flux for grading.

Private registry?

Create imagePullSecret via kubectl; document in README—not plain secret in git.

Next lab?

GitLab CI building image then Flux ImageUpdateAutomation—ask mentor for advanced track.

Get company news

Releases and announcements — confirm from your inbox.

Subscribe to updates