
From Compose to Kubernetes
RES509 - Virtualisation avancée
Close out RES507 (10 minutes)
- Take five minutes for 32 - Course Feedback
- If your Lab 30 review is outstanding, let me know
- Have your fork, failed/recovered CI runs, and extension evidence ready
- We will finish those reviews during lab work after Kubernetes setup
Lab 30 keeps the agreed 6 / 6 / 4 / 4 rubric.
Where we left off
Your app now has Git, Docker Compose, and CI.
Recall before we build on it:
- What does Compose start, and where does database data live?
- What does a successful
/health request leave untested?
Today: we go from one machine to cluster thinking.
Goals for today
By the end of this four-hour session, you should be able to:
- Explain why Kubernetes exists
- Deploy our app to a local cluster
- Scale it
- Break it (on purpose) and recover
- Debug using the right signals: status, events, logs
RES509 starts here
Day 1 — session 4 overall
- Today: operate an app with Kubernetes (40/42)
- Next: databases, VMs, and isolation (50/52)
- Then: production changes and architecture (60/62)
Lab 30 belongs to RES507. Lab 42 belongs to RES509.
Our four hours
- 10 min: closeout and course introduction
- 30 min: mental model and prediction questions
- 55 min: setup, image import, first Pod
- 15 min: break and setup buffer
- 80 min: Service, scaling, failure and recovery
- 50 min: extensions, check-ins, and evidence
Docker Compose is great
Compose manages services on one Docker host:
- Define services together in YAML
- Restart containers using restart policies
- Scale compatible services with
up --scale
- Keep a simple local development environment
Compose limits
Compose does not give you:
- Scheduling across machines
- Rescheduling workloads onto another host
- A consistent model for rolling updates
- A control plane that watches and reconciles state
Pets vs Cattle
Pets
- Unique
- Named
- Manually cared for
Cattle
- Replaceable
- Disposable
- Recreated automatically
Kubernetes treats Pods like cattle.
Persistent data needs storage that survives Pod replacement.
So what is Kubernetes?
Kubernetes is a system that:
- Keeps your apps running
- Tries to match desired state to actual state
- Continuously reconciles the difference
You describe what you want.
Kubernetes does the repetitive work.
The control loop idea
Desired state:
- “I want 3 copies of this app running”
Actual state:
- “Only 2 are running right now”
Controller loop:
This loop never stops.
Core objects we will use
Keep it simple:
- Pod: the smallest unit that runs
- Deployment: manages replicas and updates
- Service: stable networking to reach the app
We will ignore the rest for now.
Pod: the unit of execution
A Pod is:
- One or more containers that run together
- Shared networking inside the Pod
- Usually short-lived, replaceable
Key idea:
- You do not manage Pods manually in production
Deployment: desired state for Pods
A Deployment lets you say:
- Which image to run
- How many replicas you want
- How updates should roll out
It creates and replaces Pods for you.
Controller hierarchy
- You interact with the Deployment.
- The Deployment manages ReplicaSets.
- The ReplicaSet ensures the right number of Pods exist.
If a Pod disappears, the ReplicaSet creates a new one.
Service: stable access
Pods come and go.
IPs change.
A Service gives you:
- A stable name
- A stable virtual IP
- Routing to eligible, Ready Pods
Today we will use a simple local Service.
Everything is “configuration as code”
Kubernetes is declarative.
You apply YAML, for example:
- deployment.yaml
- service.yaml
You can version it in git, review it, and automate it in CI.
Commands and manifests
- Imperative: request a change with a command
- Declarative: apply desired state from saved YAML
- A Deployment reconciles replicas with either approach
- A bare Pod has no ReplicaSet to replace it after deletion
Keep the desired state in Git; use apply to reproduce it.
Our cluster today
kubectl sends requests to the API server
- The control plane schedules and reconciles work
- A node runs Pods through its container runtime
- k3s runs both roles on our single Ubuntu VM
- A namespace groups resources inside the cluster
Three replicas on one VM do not survive losing that VM.
Read the manifest
- Deployment: desired replica count and Pod template
- Pod label:
app: quote-app
- Service selector: the same
app: quote-app
- Service port
80 forwards to app port 3000
Find those fields in Lab 42 before applying the YAML.
Ready versus alive
- Readiness: should normal Service traffic reach this Pod?
- Liveness: should this container be restarted?
- Readiness failure alone does not restart a container
- Our
/health checks HTTP, not database operations
A healthy probe proves only what its endpoint checks.
You will mostly use:
kubectl get ...
kubectl describe ...
kubectl logs ...
kubectl apply -f ...
kubectl delete ...
kubectl rollout status ...
Use status → events → logs to explain a failure.
How to observe what is happening
When something is wrong, check in this order:
- Status:
kubectl get
- Details and events:
kubectl describe
- Application output:
kubectl logs
This is your debugging loop, just as docker compose ps and logs were in RES507.
Lab setup
Use your existing course Ubuntu VM.
- Keep your own fork and completed application
- Run k3s with its default containerd runtime
- Build with Docker, then import the image into k3s
- Run the lab commands inside the VM
- Follow Lab 42’s setup checks before continuing
Docker and k3s have separate image stores.
Lab tasks
In the lab, you will:
- Apply the Deployment YAML
- Apply the Service YAML
- Confirm
/health responds
- Set three replicas in the saved manifest
- Delete a Pod and watch its replacement become Ready
Intentional failure
You will intentionally create a failure:
- Change the readiness path to
/does-not-exist
- Observe a new Pod running but not Ready
- Find the probe’s HTTP 404 in its events
Restore /health, re-apply, and verify recovery.
Old healthy replicas may remain available during the failed rollout.
Today’s check-ins
- A working deployment with Ready Pods
- The Service configuration and a successful health request
- Three replicas and an observed Pod replacement
- A deliberate failure, its cause, and verified recovery
Save failure evidence before fixing it. Keep short excerpts and a symptom/cause/fix note.
Check-ins provide feedback; the final Lab 42 assessment is later.
Lab 42 assessment
- Deployment and runtime validation: /6
- Failure diagnosis and recovery: /6
- One meaningful, verified extension: /4
- Oral understanding: /4
Start an extension when ready; you do not need to finish it today.
The final assessment timing will be announced in class.
A completed checklist alone does not demonstrate understanding.
What runs Kubernetes?
- Kubernetes is not the bottom of the stack.
- In most real environments:
- Nodes are virtual machines
- VMs run on a hypervisor
- The hypervisor isolates workloads
- Virtualization still matters:
- Cloud and data centers
- Embedded systems
- Automotive and mixed-criticality platforms
- We will explore this layer next session in lessons 50/52.
Quick check-in
Before the lab:
- Have you used Kubernetes before?
- If yes: what did you use it for?
- If no: what do you expect it to do?
We will keep it practical.
Let’s start the lab
When the core work is verified:
- Start an extension lane
- Keep your evidence ready for a check-in
- Help a neighbor when useful