Hands-on labs Advanced Free
Kubernetes labs
Five labs: foundations, configuration, Traefik, Helm and Argo CD on a local cluster.
- 5 labs
- 59 steps
Kubernetes foundations
Create a cluster, deploy the five services and understand how they communicate.
3h30 Foundations 12 steps
Five Deployments and Services available; an HTML page displays the API's message; the MariaDB and Mailpit tools can be viewed.
Prerequisites
- Docker Engine and k3d working
- kubectl installed
- The previous lab's Docker application
Prepare the cluster and the images
-
Step 1 : Check the tools
Check that Docker, k3d and kubectl respond; explain the role of each.
docker version && k3d version && kubectl version --clientThe three commands run without error.
-
Step 2 : Start the cluster
Run the supplied script; identify the control node and the worker node.
bash scripts/01-setup-cluster.sh && kubectl get nodesThe nodes are Ready.
-
Step 3 : Build the images
Reuse the PHP and Node/SCSS Dockerfiles from the previous project; build and load the images into k3d.
bash scripts/02-build-images.shThe images tp-lab-api:1.0 and tp-lab-app:1.0 are available on the nodes.
-
Step 4 : Create the Namespace
Read the Namespace manifest then create the tp-devops scope.
kubectl apply -f niveau-01/00-namespace.yamlThe tp-devops Namespace appears in kubectl get ns.
Deploy the Kubernetes objects
-
Step 5 : Spot the YAML objects
Read apiVersion, kind, metadata and spec; explain the link between labels and selectors.
cat niveau-01/10-app.yamlEach resource has an identified role.
-
Step 6 : Rebuild the missing Deployments
From the Services supplied, create api, app, phpmyadmin and mailpit and assign the images, ports and variables.
kubectl apply -f etudiants/niveau-01/10-app.yamlAll the Deployments exist with no InvalidImageName or inconsistent selector.
-
Step 7 : Start the five services
Apply the completed manifest. Use the get and describe commands to analyse any errors.
kubectl get deploy,pods,svc -n tp-devopsThe five Services are present and the Pods become Ready.
-
Step 8 : Understand DNS resolution
Explain why the API contacts the database via mariadb:3306, not localhost.
kubectl get svc -n tp-devopsThe internal DNS addresses match the Services' names.
Test and observe
-
Step 9 : Open the frontend
Set up a port tunnel to Service/app and visit with the browser.
kubectl port-forward -n tp-devops service/app 8080:80The HTML page responds on http://localhost:8080.
-
Step 10 : Test the API and MariaDB
Display Hello World and the message counter. If 503, wait while MariaDB initialises.
curl http://localhost:8080/api/helloA JSON response contains database_connected and messages_count.
-
Step 11 : Inspect phpMyAdmin and Mailpit
Set up two tunnels in separate terminals, then test sending a message.
kubectl port-forward -n tp-devops svc/phpmyadmin 8081:80The message appears in the database and the email in Mailpit (port 8025).
-
Step 12 : Diagnose the containers
Read the logs and describe a Pod's state; identify the lifecycle phases.
kubectl logs -n tp-devops deployment/api --tail=40The students explain a likely error and its diagnosis method.
Resources
- Pods — Kubernetes documentation — Understand what actually runs the containers
- Deployment — documentation — Deployment controller and replicas
- Service — documentation — Stable network access to Pods
- k3d — getting started guide — Local Kubernetes cluster
- kubectl port-forward — Temporarily exposing a service
Configuration and operations
Separate the configuration, keep the data and observe the services' health.
3h30 Operations 12 steps
A database that persists after the Pod is recreated, externalised configuration, working replicas and observable health probes.
Prerequisites
- Level 1 completed
- tp-devops namespace active
- Corrected L2 manifests available
Externalise the configuration
-
Step 1 : Observe the limits of level 1
Identify the hard-coded information and tell application configuration apart from passwords.
List at least three parameters to externalise.
-
Step 2 : Create a ConfigMap
Deploy the DB_HOST, DB_NAME, SMTP_HOST and other non-secret values.
kubectl apply -f niveau-02/10-config.yamlkubectl get cm tp-config -n tp-devops displays the ConfigMap.
-
Step 3 : Create a teaching Secret
Read secretKeyRef; explain that a Kubernetes Secret is not a vault and that the lab's values are fake.
kubectl get secret tp-db-auth -n tp-devopsThe secret contains the two expected keys without revealing any real data.
-
Step 4 : Reference the configuration
Link the API to envFrom ConfigMap and to secretKeyRef for DB_PASSWORD.
kubectl describe deployment api -n tp-devopsThe Pod reads the right environment variables.
Storage and state
-
Step 5 : Delete the L1 MariaDB Deployment
Avoid two competing controllers before creating the StatefulSet.
kubectl delete deployment mariadb -n tp-devops --ignore-not-foundOnly one controller manages the MariaDB Pods.
-
Step 6 : Write the StatefulSet
Rebuild the manifest with volumeClaimTemplates, serviceName and the /var/lib/mysql mount.
The YAML passes validation and specifies 1Gi of storage.
-
Step 7 : Create the PVC
Apply the manifests and examine the StatefulSet, Pod and PersistentVolumeClaim.
kubectl get sts,pod,pvc -n tp-devopsThe PVC is Bound and mariadb-0 is Ready.
-
Step 8 : Test persistence
Create a message, delete the mariadb-0 Pod and check the counter after restart.
kubectl delete pod mariadb-0 -n tp-devopsThe data is kept; the PVC remains present.
Observability and maintenance
-
Step 9 : Identify the probes
Tell readiness, liveness and startup apart. Examine the probes added in the solution.
kubectl describe pod -l app=api -n tp-devopsReadiness is visible and affects the Pod's availability.
-
Step 10 : Assess the resources
Read requests/limits and explain an out-of-memory situation.
kubectl describe deployment api -n tp-devopsThe role of each value is correctly stated.
-
Step 11 : Change the replicas
Temporarily scale the frontend to three Pods then go back to two.
kubectl scale deployment app --replicas=3 -n tp-devopsThe Service distributes across several Pods.
-
Step 12 : Analyse the updates
Observe rollout status/history then a simulated image change if available.
kubectl rollout status deployment/app -n tp-devopsThe student tells a rolling update apart from a Pod restart.
Resources
- ConfigMaps — Non-sensitive variables
- Secrets — Handling sensitive data
- StatefulSet — Identity and persistence
- PVCs and volumes — Durable storage
- Probes — Health and availability
- Resource management — Requests and limits
Traefik and network exposure
Route HTTP requests to the right services and introduce network isolation.
3h30 Network 11 steps
An HTTP entry on port 8088 correctly serves the frontend, /api, phpMyAdmin and Mailpit.
Prerequisites
- Level 2 completed
- Traefik K3s available
- Port 8088 free
Understand the path of requests
-
Step 1 : Identify the built-in Traefik
Check the controller installed with K3s; do not launch a second Traefik.
kubectl get pods -n kube-systemA K3s Traefik controller is working.
-
Step 2 : Check the published port
Understand the host publication 8088 → K3d load balancer → Traefik port 80.
curl -I http://127.0.0.1:8088The port responds, even if the HTTP code is not yet 200.
-
Step 3 : Compare port-forward and Ingress
Tell temporary access for diagnosis apart from a shared HTTP entry.
Explain the use of each mechanism.
Configure the routes
-
Step 4 : Rebuild the main Ingress
Define Host tp.localhost, path /api to Service api:8000, path / to Service app:80.
The manifest matches the networking.k8s.io/v1 schema.
-
Step 5 : Deploy the three Ingresses
Also add db.tp.localhost and mail.tp.localhost.
kubectl apply -f niveau-03/30-ingress-policy.yamlThe three Ingress objects appear in kubectl.
-
Step 6 : Test the frontend and the API
Open the browser and analyse the HTTP responses with an explicit Host header.
curl -H "Host: tp.localhost" http://127.0.0.1:8088/api/helloThe front end and the API JSON go through Traefik.
-
Step 7 : Test the tools
Check the two other domains; explain the difference between host and path.
The two dashboards respond on port 8088.
Isolate and secure
-
Step 8 : Study NetworkPolicy
Examine the rule that limits TCP 3306 ingress to MariaDB to the API and phpMyAdmin Pods.
kubectl describe networkpolicy mariadb-access -n tp-devopsThe allowed sources are identified.
-
Step 9 : Understand the limits of NetworkPolicy
Identify the need for a CNI that enforces the policies and the lab's isolation limits.
The students do not confuse NetworkPolicy with an Internet firewall.
-
Step 10 : Explain TLS
Note that a .localhost name does not automatically get a recognised public certificate.
A real certification plan is drawn up without enabling fake HTTPS.
-
Step 11 : Solve a routing scenario
Deliberately test a wrong route then identify Host, path, Service and port in the diagnosis.
kubectl describe ingress tp-web -n tp-devopsA 404 or 502 is analysed methodically.
Resources
- Kubernetes Ingress — Routing rules
- Traefik and Kubernetes Ingress — HTTP controller
- K3s networking — Traefik provided by default
- NetworkPolicies — Network filtering between Pods
- TLS and Ingress — HTTPS encryption conditions
Helm — Packaging and reuse
Turn the manifests into a parameterisable Chart and manage a release's lifecycle.
3h30 Industrialisation 12 steps
A validated Helm Chart can install, update and roll back the stack, with distinct values.
Prerequisites
- Kubernetes manifests from levels 1 to 3 mastered
- Helm installed
- Cluster ready for a clean install
Understand a Chart
-
Step 1 : Prepare the cluster without conflicts
Do not reapply the manual manifests to the same resources. Start again from a clean cluster if necessary.
No competing controller manages the same resources.
-
Step 2 : Create the demonstration Secret
The Chart references an external Secret tp-db-auth; it stores no password in values.yaml.
kubectl create secret generic tp-db-auth -n tp-devops --from-literal=DB_PASSWORD=tp_demo_password --from-literal=MARIADB_ROOT_PASSWORD=tp_root_demoThe Secret exists and stays outside the GitOps Chart.
-
Step 3 : Explore Chart.yaml and values.yaml
Identify the Chart version, the application version, the images and the replicas.
Tell appVersion and the Chart's version apart.
-
Step 4 : Read the templates
Understand .Values, .Release.Namespace, quote pipelines and if directives.
The student can explain a Helm expression.
Build and validate
-
Step 5 : Rebuild the Ingress template
Use the host variables and the ingress.enabled option to enable or disable the routes.
The template renders three valid Ingresses.
-
Step 6 : Validate the Chart
Run helm lint and display the generated manifests with helm template.
helm lint niveau-04/charts/tp-stackNo Chart errors.
-
Step 7 : Install the release
Install the Chart with values-dev.yaml in the tp-devops namespace.
helm upgrade --install tp niveau-04/charts/tp-stack -n tp-devops -f niveau-04/charts/tp-stack/values-dev.yamlThe release exists and the services respond.
-
Step 8 : Tell a template from an applied object
Compare a generated Helm template with the resources actually created.
helm template tp niveau-04/charts/tp-stack -n tp-devopsThe link between values and the final manifest is established.
Evolve and roll back
-
Step 9 : Simulate a busier environment
Use values-prod-simule.yaml to increase the frontend's replicas.
helm upgrade tp niveau-04/charts/tp-stack -n tp-devops -f niveau-04/charts/tp-stack/values-prod-simule.yamlThe number of app Pods varies.
-
Step 10 : Observe the history
List the Helm revisions and explain the notion of release.
helm history tp -n tp-devopsAt least two revisions visible.
-
Step 11 : Perform a rollback
Go back to the earlier revision and compare the number of replicas.
helm rollback tp 1 -n tp-devopsThe number of Pods returns to its previous value.
-
Step 12 : Check reusability
Change a value without rewriting the templates and explain the benefit for dev / simulated production.
Parameterisable Chart and security assumptions made explicit.
Resources
- Helm Charts — Chart.yaml / values.yaml / templates structure
- Helm templates guide — Go functions and expressions
- Helm commands — install, upgrade, history and rollback
- Helm values — Priorities and values files
Argo CD — GitOps and reconciliation
Put Git at the centre of deployment and observe Kubernetes converging automatically.
3h30 GitOps 12 steps
The Chart is deployed from an accessible Git repository, its changes are synchronised and a manual drift is corrected.
Prerequisites
- Working Helm Chart
- A Git repository genuinely accessible to Argo CD
- Cluster with images available
- No competing Helm release
Install and prepare Git
-
Step 1 : Reserve Git as the source of truth
Copy the Chart into an accessible Git repository; do not commit real passwords.
git status && git remote -vA genuine remote repository is identified.
-
Step 2 : Remove the competing tools
Remove the Helm CLI release before handing the resources over to Argo CD; keep or recreate the teaching Secret.
helm list -n tp-devopsThe same application is not controlled by two tools.
-
Step 3 : Install Argo CD
Install the official manifests, check the Pods and note availability.
kubectl apply -n argocd --server-side --force-conflicts -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yamlAll the required controllers start.
-
Step 4 : Open Argo CD locally
Use the interface's HTTPS port-forward; do not publish the interface with initial credentials.
kubectl port-forward svc/argocd-server -n argocd 8443:443The Argo CD interface is available via https://localhost:8443.
Declare the application
-
Step 5 : Build the Application manifest
Add the real repoURL, targetRevision, path, Helm values and Kubernetes destination.
The YAML no longer contains Git placeholders.
-
Step 6 : Deploy the Application
Apply the resource in the argocd namespace and check its conditions.
kubectl apply -f niveau-05/gitops/argocd/application.yamlThe Application object appears.
-
Step 7 : Observe the synchronisation
Check the Synced / Healthy state and understand the conditions that can delay Healthy.
kubectl get applications -n argocdThe application converges towards the desired state.
-
Step 8 : Check the user journey
Access the front end, send a message, check the database and Mailpit.
curl -H "Host: tp.localhost" http://127.0.0.1:8088/api/helloThe stack stays functional after the GitOps migration.
Test reconciliation and conclude
-
Step 9 : Change the replicas in Git
Change app.replicas in values-dev.yaml, push the commit and wait for Argo CD.
git add . && git commit -m "tp: augmenter replicas" && git pushThe app Deployment takes the value from Git.
-
Step 10 : Deliberately create a drift
Manually change the replicas via kubectl while selfHeal is enabled.
kubectl scale deploy app --replicas=4 -n tp-devopsArgo CD detects and corrects the drift.
-
Step 11 : Restore from Git
Go back to an earlier commit, push and check the synchronisation.
git revert <identifiant-du-commit> && git pushThe earlier desired state is restored.
-
Step 12 : Technical defence
Present the respective roles of Docker, Kubernetes, Helm and Argo CD; cite the lab's risks and limits.
A 5-minute demonstration validates autonomy.
Resources
- Getting started with Argo CD — Install and access Argo CD
- Argo CD + Helm — Helm rendering and lifecycle management
- Automated sync — Prune, self-heal, sync
- Declarative Application — The Application resource and desired state
- GitOps concepts — Basic GitOps principles
In the same series Step 2 of 2
- 1 Course Kubernetes — The course
-
2 Lab Kubernetes labs You are here
In the same category
Infrastructure · Intermediate
Docker & Docker Compose — The course
Images, containers, volumes, networks and Compose: vocabulary, essential commands and good practice.
Infrastructure · Intermediate
Kubernetes — The course
Pods, deployments, services, configuration and storage: orchestrating containers, from theory to kubectl.
Infrastructure · Intermediate
Terraform & Ansible — The course
Describe infrastructure with Terraform and configure it with Ansible: providers, playbooks, roles and idempotence.