Preparation: The factory – two VMs, one cluster and the first product
Goal: set up access to two VMs, run your own container registry, build a Kubernetes cluster with two nodes, and build, ship and use for the first time the product of this course – the Bewerbungslotse with a small language model · Duration: about 120 min · Prerequisite: two fresh VMs with Ubuntu 24.04, a computer with SSH
State before this chapter
You need two VMs with Ubuntu 24.04 that you can log in to over SSH with a user name and password, and your own computer with a terminal. The first VM needs at least 4 vCPUs, 8 GB of memory and 40 GB of free disk, because the language model runs and the images are stored there; the second one gets by with 2 vCPUs and 4 GB. Both must be able to reach each other on the network and be allowed to access the internet. You set up everything else today.
Introduction
Two EU regulations are currently changing how software is built and operated. The Cyber Resilience Act (CRA) requires anyone who sells a product with software in the EU to know its components, find and fix vulnerabilities, ship security updates, and report a vulnerability that is already being exploited within hours. The AI Act requires anyone who provides or uses an AI system for sensitive purposes – such as pre-sorting job applications – to make sure it is logged, overseen by humans, tested for accuracy and documented.
Most texts about this are written by lawyers. This course is not. Here you are the manufacturer of a small product, and you implement every obligation the way an engineering team has to: with commands, files and measurements that show it works. Wherever the law requires something, the reference is given so that you can look it up.
Important: This course is not legal advice. It shows technical implementations. Whether and how an obligation applies to your product is decided by the texts of the regulations in the Official Journal of the EU and, in the end, by authorities and courts. Real products need a legal review.
Today you build the factory: two VMs, your own registry for container images, a small Kubernetes cluster and the product itself. The product is called Bewerbungslotse (German for “application pilot”). It accepts a job application, asks a language model how well it fits the position, and stores the result. It is deliberately built the way many real products look at the start: it works, but it is neither evaluated nor secured nor documented. That is exactly what you work on over the next 16 days.
Today you will learn:
- to create your own SSH key for the lab and give the VMs names,
- to verify downloaded programs by their checksum before you install them,
- to run your own container registry as a service with zot,
- to install k3s as a Kubernetes server and join a second node,
- to build a container image with Podman and push it to your own registry,
- to ship a product with your own Helm chart and bring a language model into the cluster.
Every chapter is structured like this: first you read in words what you do and why, then comes exactly one command, then every option is explained, then the real output from the lab and what it means. At the end of each drill, a Remember box sums up the core in one sentence, and before the interview note you test yourself with a few questions.
Background
The picture of the day: a car factory
Imagine the whole course as a car factory. You build vehicles and sell them. A vehicle consists of hundreds of parts from suppliers, and if one of them has a design defect, you have to know which vehicles it is in, whether the defect affects your model and how you recall it. That is exactly what the CRA requires of software: your product is the vehicle, the open-source libraries are the suppliers’ parts.
Today the factory is built:
- werk1 is the production hall. This is where things are built (Podman), where the parts warehouse stands (the registry zot), and where factory management sits (the Kubernetes server). The language model also runs here, because werk1 has the most cores.
- werk2 is the second hall. It belongs to the same factory and takes over work. Today the Bewerbungslotse itself runs here.
- The container image is the finished vehicle. It
leaves the hall with a type designation
(
bewerbungslotse:1.0.0) and is then ready in the parts warehouse. - The Helm chart is the assembly instructions at the customer’s site. It describes how the vehicle is set up – and everything that is preset in it, every customer gets exactly like that.
- The language model is a bought-in driver-assistance system. It suggests something; whether you may trust it is the subject of the AI Act days.
The terms
| Term | Meaning | In the picture |
|---|---|---|
| werk1 | VM with k3s server, Podman, registry and language model | production hall with parts warehouse |
| werk2 | VM with the k3s agent, second node | second hall |
| k3s | lightweight Kubernetes distribution in a single file | factory management |
| registry | server that stores and serves container images | parts warehouse |
| zot | lightweight registry following the OCI standard | the actual warehouse building |
| image | built package of a program and all its dependencies | finished vehicle |
| Helm chart | package of templates and default settings for Kubernetes | assembly instructions with factory settings |
| Ollama | runtime for language models | driver-assistance system from a supplier |
| product with digital elements | CRA term for hardware or software that is sold | the vehicle you are liable for |
Remember: Whoever builds a product from other people’s parts is liable for the whole. Today you build the vehicle – from tomorrow on you look at everything that is inside it.
What the two regulations require – at a glance
| Cyber Resilience Act | AI Act | |
|---|---|---|
| Reference | Regulation (EU) 2024/2847 | Regulation (EU) 2024/1689, amended by (EU) 2026/1744 |
| applies to you as | manufacturer of a product with digital elements | provider (you build the AI system) and deployer (you use it) |
| key dates | reporting obligation for exploited vulnerabilities since 11 September 2026, main obligations from 11 December 2027 | transparency obligations since 2 August 2026, high-risk under Annex III from 2 December 2027 |
| in the course | Days 1–9 | Days 10–15 |
The deadlines reflect the state of December 2026. The high-risk obligations of the AI Act were postponed from August 2026 to December 2027 by Regulation (EU) 2026/1744, the so-called Digital Omnibus. Before making a real decision, check whether anything has changed since.
Why your own product
The CRA is addressed to the manufacturer. Anyone who only operates other people’s software has different obligations. So that you can work through all manufacturer obligations yourself, you need a product that you build, version and ship yourself – and that you also operate yourself, as many small companies do. The Bewerbungslotse is small enough to understand completely: a Python program of a little over 80 lines, a container image and a Helm chart with two templates.
It pre-sorts job applications. That is no accident: an AI system that helps select applicants is explicitly on the AI Act’s list of high-risk applications (Annex III, point 4). So from Day 10 on, the strictest obligations of the AI Act apply to you as well.
Why k3s and your own registry
k3s is a complete, certified Kubernetes that comes as a single file. What counts for this course: everything you do with the product works the same way on any other Kubernetes.
Your own registry has a reason that has to do with the course: from Day 2 you attach parts lists to your images, and from Day 6 signatures. These are stored in the registry next to the image. With your own registry you see exactly what arrives there, and you don’t need an account with a third-party service.
The tools
| Tool | Source | What for in the course |
|---|---|---|
kubectl |
comes with k3s | operate the cluster |
jq |
package jq |
read JSON and extract fields |
podman |
package podman |
build images and push them to the registry, without a Docker daemon |
helm |
release from helm.sh | install and update the product in the cluster |
zot |
release from GitHub | the factory’s registry |
curl |
preinstalled | HTTP requests to the registry and the product |
The tools for parts lists, vulnerabilities and signatures – Syft, Grype, Trivy, Cosign, vexctl – you install on the day you need them for the first time.
The site
| VM | IP in the lab | Role | Size |
|---|---|---|---|
| werk1 | 172.16.0.126 | k3s server, Podman, registry, language model | 4 vCPU, 11 GB, 77 GB |
| werk2 | 172.16.0.228 | k3s agent, second node | 2 vCPU, 7.8 GB, 29 GB |
Your addresses are different. Wherever the course says
172.16.0.…, use your own. If a command block starts with
# on werk1, you run it on werk1;
# on your computer means the computer you are sitting at.
The author’s VMs have a little more memory than required.
Drill 1: Access to the two VMs
Where you are: on your own computer, in a terminal.
What you have afterwards: your own SSH key and short names with which
ssh werk1works without a password, and VMs named werk1 and werk2 that know each other by name.
Throughout the course you work on the VMs over SSH. A separate key just for this lab keeps it apart from your other access; you can simply delete it at the end.
Step 1 – create a key.
# on your computer
ssh-keygen -t ed25519 -f ~/.ssh/werk -C werk-laborssh-keygen creates a key pair consisting of a private
and a public key.
-t ed25519selects the key type Ed25519 – short, fast and the standard today.-f ~/.ssh/werksets the file name: the private key goes to~/.ssh/werk, the public key to~/.ssh/werk.pub.-C werk-laboris a comment. It later appears in theauthorized_keysfile on the VMs so that you can recognise the key there.
The program asks for a passphrase. For a lab you may leave it empty by pressing Enter.
Expected (excerpt):
Generating public/private ed25519 key pair.
The key fingerprint is:
SHA256:Y3vIWmDrgP84hDwWatNcRukNoeo8rtiyUEW6+qVI2n8 werk-labor
What you see: The key pair has been created. The fingerprint is a short checksum of the public key – yours looks different.
Step 2 – copy the public key to werk1.
# on your computer
ssh-copy-id -i ~/.ssh/werk.pub [email protected]ssh-copy-id logs in once with a password and appends the
public key to the user’s ~/.ssh/authorized_keys file on the
VM.
-i ~/.ssh/werk.pubsays which public key is transferred.[email protected]is the user and address of the VM. If your user has a different name, replaceubuntu.
Expected (excerpt, after the password prompt):
Number of key(s) added: 1
Step 3 – the same for werk2.
# on your computer
ssh-copy-id -i ~/.ssh/werk.pub [email protected]Here too, Number of key(s) added: 1 appears after the
password.
Step 4 – create short names. So that you don’t have to type key, user and address every time, you add the VMs to the SSH configuration. Open the file in the nano editor:
# on your computer
nano ~/.ssh/confignano <file> opens the file in the terminal. If it
doesn’t exist yet, nano creates it when you save. nano is the editor you
use throughout the course:
- You move the cursor with the arrow keys; you simply type text.
- You paste text from the clipboard into the terminal with a right-click, on the Mac with Cmd+V, on Linux with Ctrl+Shift+V.
- Ctrl+O saves, Enter confirms the file name. Ctrl+X exits nano.
- Files under
/etcbelong to root. You open them withsudo nano <file>.
Go to the end of the file and append these lines. If there is already something in the file, it stays unchanged; what you add is marked in green:
Host werk1
HostName 172.16.0.126
Host werk2
HostName 172.16.0.228
Host werk1 werk2
User ubuntu
IdentityFile ~/.ssh/werkEach Host section applies to the short names it lists.
HostName is the real address, User the user on
the VM and IdentityFile the private key. The last section
names both hosts so that you only have to write user and key once.
Step 5 – give the VMs their names. Many outputs in
the course contain the node name – Kubernetes uses it as the name of the
node, and the parts warehouse is called werk1:5000
throughout the course. So that your outputs match those in the book, the
VMs are called werk1 and werk2. Log in to werk1:
# on your computer
ssh werk1# on werk1
sudo hostnamectl set-hostname werk1hostnamectl set-hostname werk1 sets the host name
permanently; sudo is needed because this is a system
setting. The command prints nothing.
Ubuntu cloud images sometimes reset the name at boot to the value from the hypervisor configuration. A small file for cloud-init, the program that sets up these images at boot, prevents this:
# on werk1
sudo nano /etc/cloud/cloud.cfg.d/99-hostname.cfgpreserve_hostname: truepreserve_hostname: true tells cloud-init: don’t touch
the name the system already has.
Step 6 – know the neighbours by name. werk1 and
werk2 should reach each other by name – the cluster will later also pull
images under the name werk1:5000. There is no DNS server
for this in your lab, so you add the names to the hosts file. On cloud
images, cloud-init rewrites /etc/hosts from a template at
every boot – that is why you change the template:
# on werk1
sudo nano /etc/cloud/templates/hosts.debian.tmplGo to the end of the template and append two lines (your addresses):
172.16.0.126 werk1
172.16.0.228 werk2So that this takes effect right away and not only at the next boot,
you also append the same two lines to /etc/hosts:
# on werk1
sudo nano /etc/hosts172.16.0.126 werk1
172.16.0.228 werk2Log out with exit and do steps 5 and 6 the same way on
werk2 – there with sudo hostnamectl set-hostname werk2 and
the same two lines.
Step 7 – check the names.
# on werk1
getent hosts werk2getent hosts <name> queries the system’s name
resolution – exactly what k3s, Podman and every other program use, not
just DNS.
Expected:
172.16.0.228 werk2
From werk2 you check the other way round:
# on werk2
getent hosts werk1Expected:
172.16.0.126 werk1
Remember: The factory needs names before it ships parts: from now on the parts warehouse is called
werk1in every file, not an IP address that can change.
If it doesn’t work
If ssh werk1 still asks for a password, usually the path
after IdentityFile doesn’t match the key from step 1, or
ssh-copy-id ran against a different address.
ssh -v werk1 shows which keys ssh offers and which one is
rejected.
Save your progress? Sign up for free
Drill 2: Install the tools
Where you are: on werk1.
What you have afterwards:
jq,podmanandhelmon werk1 – Helm after a verified checksum.
Step 1 – update the package lists.
# on werk1
sudo apt-get updateapt-get update downloads the current package lists from
the Ubuntu mirrors. Only then does apt install the newest versions.
Expected (last lines):
Fetched 6002 kB in 3s (2177 kB/s)
Reading package lists...
Step 2 – install jq and Podman.
# on werk1
sudo apt-get install -y jq podmaninstall jq podmaninstalls the two packages along with everything they need.-yanswers the question “Do you want to continue?” with yes.
Expected (excerpt):
The following NEW packages will be installed:
aardvark-dns buildah catatonit conmon containernetworking-plugins crun
fuse-overlayfs golang-github-containers-common
golang-github-containers-image jq libjq1 libonig5 libslirp0 libsubid4
libyajl2 netavark passt podman slirp4netns uidmap
0 upgraded, 20 newly installed, 0 to remove and 1 not upgraded.
What you see: Two programs bring 20 packages. Podman
brings its container runtime crun, the network stack
netavark and tools for containers without root privileges.
The theme of the course already shows here: what you “install” is always
a whole tree of parts.
Step 3 – check the versions.
# on werk1
jq --versionExpected:
jq-1.7
# on werk1
podman --versionExpected:
podman version 4.9.3
Step 4 – determine the architecture. Helm comes as a separate archive for each processor architecture. dpkg tells you which one your VM has:
# on werk1
dpkg --print-architectureExpected:
amd64
If yours says arm64 (for example on a Mac with an Apple
chip), replace amd64 with arm64 in the next
steps.
Step 5 – download Helm.
# on werk1
curl -fsSLO https://get.helm.sh/helm-v4.3.2-linux-amd64.tar.gz| Option | Meaning |
|---|---|
-f |
abort on an HTTP error instead of saving the error page |
-s |
no progress bar |
-S |
still show errors |
-L |
follow redirects |
-O |
save under the file name from the URL |
The command prints nothing if all goes well.
Step 6 – download the checksum. Next to every archive, the Helm project publishes a file with its SHA-256 checksum:
# on werk1
curl -fsSLO https://get.helm.sh/helm-v4.3.2-linux-amd64.tar.gz.sha256sum# on werk1
cat helm-v4.3.2-linux-amd64.tar.gz.sha256sumExpected:
d1c0278d46beab79582d7e50f5b3dc206944ba8e577cde618513fd07daa53983 helm-v4.3.2-linux-amd64.tar.gz
Step 7 – verify the checksum.
# on werk1
sha256sum -c helm-v4.3.2-linux-amd64.tar.gz.sha256sumsha256sum -c <list> recalculates the checksum of
every file in the list and compares it.
Expected:
helm-v4.3.2-linux-amd64.tar.gz: OK
What you see: OK – the file on your
disk is exactly the one the project published. If it differs, it says
FAILED, and you install nothing.
Step 8 – unpack and install.
# on werk1
tar -xzf helm-v4.3.2-linux-amd64.tar.gz-xextracts,-zdecompresses gzip along the way,-fnames the archive.
The archive contains a folder linux-amd64 with the
program helm. install copies it into place and
sets the permissions in one step:
# on werk1
sudo install -m 755 linux-amd64/helm /usr/local/bin/helm-m 755means: everyone may run the program, only root may change it.
# on werk1
helm versionExpected:
version.BuildInfo{Version:"v4.3.2", GitCommit:"8346aaa55e7161f7c547212d0a87f01367976727", GitTreeState:"clean", GoVersion:"go1.27.4", KubeClientVersion:"v1.37"}
Remember: No part enters the hall unchecked: first the checksum against the manufacturer’s value, then
install. From Day 6 on you will expect the same from your own customers.
Save your progress? Sign up for free
Drill 3: The parts warehouse – your own registry with zot
Where you are: on werk1.
What you have afterwards: the registry zot as a systemd service on port 5000 that accepts and serves images under
werk1:5000/….
A registry is a web server with a defined interface, the OCI Distribution Specification. Podman pushes images into it, Kubernetes pulls them out. zot is a registry that implements only this standard, comes as a single file and can store parts lists and signatures next to the image – exactly what you need from Day 2 on.
Step 1 – download zot and the checksum list.
# on werk1
curl -fsSLO https://github.com/project-zot/zot/releases/download/v2.1.23/zot-linux-amd64# on werk1
curl -fsSLO https://github.com/project-zot/zot/releases/download/v2.1.23/checksums.sha256.txtThe list contains the checksums of all files of the release. The three for Linux on amd64:
# on werk1
grep zot-linux-amd64 checksums.sha256.txtExpected:
9df0bf8c3e65a249f6fb15bcc023246885b1526b216b62837f9d547b26253fa5 *zot-linux-amd64-debug
1f6bab0b9eee426d0785de701ff510df5c02bdb8d7287494a582634abfc5d638 *zot-linux-amd64
8a6e77686bc0e7751766c49828cff6c66b115c854d350c9d936b855463f6c973 *zot-linux-amd64-minimal
What you see: zot comes as a full, a debug and a minimal build. You take the full build; it contains the extensions for search and signatures.
Step 2 – verify and install.
# on werk1
sha256sum --ignore-missing -c checksums.sha256.txt--ignore-missing skips files in the list that you have
not downloaded.
Expected:
zot-linux-amd64: OK
# on werk1
sudo install -m 755 zot-linux-amd64 /usr/local/bin/zot# on werk1
zot --versionExpected (one long JSON line, wrapped and shortened here):
{"time":"2026-12-03T10:36:49.036144644Z","level":"info","message":"version",
"distribution-spec":"1.1.1","commit":"v2.1.23-0-gd7915e8",
"binary-type":"-events-imagetrust-lint-metrics-mgmt-profile-scrub-search-sync-ui-userprefs", …}
What you see: zot 2.1.23 speaks Distribution
Specification 1.1.1. Under binary-type you find the
built-in extensions – you need imagetrust and
search later for signatures and parts lists.
Step 3 – a separate account for the service. The registry should not run as root. A system account without login is enough:
# on werk1
sudo useradd --system --no-create-home --shell /usr/sbin/nologin zot| Option | Meaning |
|---|---|
--system |
system account with a low user ID, doesn’t appear on the login screen |
--no-create-home |
don’t create a home directory |
--shell /usr/sbin/nologin |
logging in with this account is not possible |
zot |
name of the account |
Step 4 – create the storage location. The images go
to the second disk under /daten. If you don’t have a second
disk, simply create /daten as a folder.
# on werk1
sudo mkdir -p /daten/zot# on werk1
sudo chown zot:zot /daten/zotchown zot:zot makes the account zot the
owner so that the service may write there.
Step 5 – the configuration. First the folder for the file:
# on werk1
sudo mkdir -p /etc/zot# on werk1
sudo nano /etc/zot/config.json{
"distSpecVersion": "1.1.1",
"storage": {
"rootDirectory": "/daten/zot"
},
"http": {
"address": "0.0.0.0",
"port": "5000"
},
"log": {
"level": "info"
}
}| Field | Value | Meaning |
|---|---|---|
distSpecVersion |
1.1.1 |
version of the Distribution Specification that zot offers |
storage.rootDirectory |
/daten/zot |
this is where zot stores all images |
http.address |
0.0.0.0 |
listen on all network addresses – werk2 must reach the warehouse |
http.port |
5000 |
the usual port for registries |
log.level |
info |
normal messages to the journal |
Without credentials and without TLS, this registry is suitable for the lab only. What that means for your product is the subject of Days 5 and 6; the enterprise note at the end of the chapter says what it looks like in production.
zot can check the file before you start the service:
# on werk1
sudo zot verify /etc/zot/config.jsonExpected (excerpt from the JSON line):
{"time":"2026-12-03T10:37:06.667311909Z","level":"info","message":"config file is valid", …}
Step 6 – the service.
# on werk1
sudo nano /etc/systemd/system/zot.service[Unit]
Description=zot – OCI-Registry des Werks
After=network-online.target
Wants=network-online.target
[Service]
User=zot
Group=zot
ExecStart=/usr/local/bin/zot serve /etc/zot/config.json
Restart=on-failure
[Install]
WantedBy=multi-user.target| Line | Meaning |
|---|---|
After= / Wants=network-online.target |
start only once the network is up |
User=zot / Group=zot |
the service runs with the account from step 3 |
ExecStart= |
starts zot with the configuration from step 5 |
Restart=on-failure |
restart after a crash |
WantedBy=multi-user.target |
start along with normal boot |
# on werk1
sudo systemctl daemon-reloaddaemon-reload rereads the unit files so that systemd
knows the new file.
# on werk1
sudo systemctl enable --now zotenablesets up the start at boot,--nowalso starts the service right away.
Expected:
Created symlink /etc/systemd/system/multi-user.target.wants/zot.service → /etc/systemd/system/zot.service.
Step 7 – the empty warehouse. The registry answers
the question “Which images do you have?” under
/v2/_catalog:
# on werk1
curl -s http://werk1:5000/v2/_catalogExpected:
{"repositories":[]}
What you see: The registry is running and is empty.
The path prefix /v2/ belongs to the Distribution
Specification – every registry, whether zot, Harbor or Docker Hub,
answers there.
Remember: The parts warehouse is a web server with a fixed interface under
/v2/. Whatever you put there, every customer fetches later – that is why from Day 2 on the parts list and the seal go there too.
Save your progress? Sign up for free
Drill 4: Factory management – k3s server on werk1
Where you are: on werk1.
What you have afterwards: a running Kubernetes server that can pull images from
werk1:5000, andkubectlwith a credentials file that only you can read.
By default, Kubernetes pulls images only over HTTPS. Your registry
speaks HTTP. So that k3s still pulls from it, you tell it
before the installation that werk1:5000 is
reachable over HTTP. k3s reads the file
/etc/rancher/k3s/registries.yaml for this at startup.
Step 1 – register the registry for k3s.
# on werk1
sudo mkdir -p /etc/rancher/k3s# on werk1
sudo nano /etc/rancher/k3s/registries.yamlmirrors:
"werk1:5000":
endpoint:
- "http://werk1:5000"mirrorsmaps a registry name to the addresses under which it can be reached."werk1:5000"is the name as it appears in image names (werk1:5000/bewerbungslotse:1.0.0).endpointgives the address – here explicitly withhttp://.
Step 2 – the same for Podman. Podman also wants HTTPS when pushing. For Podman you create a small extra file:
# on werk1
sudo nano /etc/containers/registries.conf.d/werk1.conf[[registry]]
location = "werk1:5000"
insecure = trueinsecure = true allows HTTP instead of HTTPS for exactly
this registry. All other registries stay on HTTPS.
Step 3 – download and inspect the installation
script. k3s is installed with a shell script. Many guides pipe
it straight from curl into a shell. You do it in two steps:
first download and inspect it, then run it.
# on werk1
curl -sfL https://get.k3s.io -o k3s-install.sh-o k3s-install.sh saves it under this name; you know the
other options from Drill 2.
# on werk1
head -3 k3s-install.shExpected:
#!/bin/sh
set -e
set -o noglob
# on werk1
wc -l k3s-install.shExpected:
1218 k3s-install.sh
What you see: a POSIX shell script of a little over
1200 lines. set -e aborts at the first error. If you like,
read all of it with less k3s-install.sh.
Step 4 – install k3s.
# on werk1
sudo INSTALL_K3S_VERSION=v1.37.2+k3s1 sh k3s-install.sh --disable traefik| Option | Value | Meaning |
|---|---|---|
sudo |
the script sets up services and needs root privileges | |
INSTALL_K3S_VERSION= |
v1.37.2+k3s1 |
install exactly this version instead of the newest – so your outputs match the book |
sh k3s-install.sh |
runs the script | |
--disable traefik |
don’t start the bundled ingress controller; it isn’t needed in the course |
Without further options, the script installs a server, that is, a node with API server, scheduler and built-in database.
Expected:
[INFO] Using v1.37.2+k3s1 as release
[INFO] Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.37.2%2Bk3s1/sha256sum-amd64.txt
[INFO] Downloading binary https://github.com/k3s-io/k3s/releases/download/v1.37.2%2Bk3s1/k3s
[INFO] Verifying binary download
[INFO] Installing k3s to /usr/local/bin/k3s
[INFO] Skipping installation of SELinux RPM
[INFO] Creating /usr/local/bin/kubectl symlink to k3s
[INFO] Creating /usr/local/bin/crictl symlink to k3s
[INFO] Creating /usr/local/bin/ctr symlink to k3s
[INFO] Creating killall script /usr/local/bin/k3s-killall.sh
[INFO] Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO] env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO] systemd: Creating service file /etc/systemd/system/k3s.service
[INFO] systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
[INFO] systemd: Starting k3s
What you see: The script itself checks the
downloaded file against a checksum
(Verifying binary download) – just as you did by hand in
Drill 2. kubectl, crictl and ctr
are not separate programs but links to the single file
k3s.
Step 5 – check the service.
# on werk1
systemctl status k3s --no-pager--no-pager prints the output directly instead of opening
it in less.
Expected (excerpt, first lines):
● k3s.service - Lightweight Kubernetes
Loaded: loaded (/etc/systemd/system/k3s.service; enabled; preset: enabled)
Active: active (running) since Thu 2026-12-03 10:37:57 UTC; 21min ago
Docs: https://k3s.io
What you see: active (running) – the
server is running. enabled means it also starts after a
reboot of the VM.
Step 6 – your own credentials file. k3s writes the administrator’s credentials to a file that only root may read:
# on werk1
sudo ls -l /etc/rancher/k3s/k3s.yamlExpected:
-rw------- 1 root root 2941 Dec 3 10:37 /etc/rancher/k3s/k3s.yaml
What you see: rw------- – root only.
That is correct: whoever has this file is administrator of the whole
cluster. You create your own copy that belongs only to you.
# on werk1
mkdir -p ~/.kube# on werk1
sudo install -m 600 -o ubuntu -g ubuntu /etc/rancher/k3s/k3s.yaml ~/.kube/config| Option | Value | Meaning |
|---|---|---|
-m |
600 |
permissions: only the owner may read and write |
-o / -g |
ubuntu |
owner and group of the copy |
| source | /etc/rancher/k3s/k3s.yaml |
the file from k3s |
| target | ~/.kube/config |
the place where kubectl usually looks |
# on werk1
ls -l ~/.kube/configExpected:
-rw------- 1 ubuntu ubuntu 2941 Dec 3 10:38 /home/ubuntu/.kube/config
Step 7 – show kubectl the file. The
kubectl of k3s first looks for its credentials file in
/etc/rancher/k3s/k3s.yaml – which you may not read. The
environment variable KUBECONFIG tells it which file to use.
So that it is set in every session, you add it to
~/.bashrc:
# on werk1
nano ~/.bashrcGo to the end of the file and append:
export KUBECONFIG=~/.kube/configSo that the change applies in the current session, you reread the file:
# on werk1
source ~/.bashrcStep 8 – ask the cluster.
# on werk1
kubectl get nodes -o wide-o wide shows additional columns such as IP address,
operating system and container runtime.
Expected (cut off on the right):
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE
werk1 Ready control-plane 23s v1.37.2+k3s1 172.16.0.126 <none> Ubuntu 24.04.5 LTS
| Column | Value | Meaning |
|---|---|---|
STATUS |
Ready |
the node reports in and can start pods |
ROLES |
control-plane |
the API server runs on this node |
VERSION |
v1.37.2+k3s1 |
Kubernetes 1.37.2 in the first k3s build |
INTERNAL-IP |
172.16.0.126 |
address at which the other nodes reach it |
Remember: The administrator’s credentials file is the factory’s master key. You copy it with
install -m 600to a place that belongs only to you – you never make it readable for everyone.
If it doesn’t work
If you forget step 7 or don’t reread ~/.bashrc,
kubectl finds no file at all and tries its default. In the
lab it looked like this:
E1203 10:38:08.074240 361579 memcache.go:381] "Couldn't get current server API group list" err="Get \"http://localhost:8080/api?timeout=32s\": dial tcp [::1]:8080: connect: connection refused"
The connection to the server localhost:8080 was refused - did you specify the right host or port?
localhost:8080 is the address that kubectl
tries without any credentials file. If it appears in an error message,
KUBECONFIG is almost always not set.
echo $KUBECONFIG shows it.
Save your progress? Sign up for free
Drill 5: The second hall – join werk2
Where you are: first on werk1, then on werk2.
What you have afterwards: a cluster with two nodes that can both pull images from
werk1:5000.
A new node has to prove to the server that it may join. By default, k3s does this with a shared secret, the join token.
Step 1 – find the token.
# on werk1
sudo ls -l /var/lib/rancher/k3s/server/node-tokenExpected:
lrwxrwxrwx 1 root root 33 Dec 3 10:37 /var/lib/rancher/k3s/server/node-token -> /var/lib/rancher/k3s/server/token
What you see: node-token is a link
(l at the very front) to the file token in a
folder that only root may read.
Step 2 – show the token.
# on werk1
sudo cat /var/lib/rancher/k3s/server/node-tokenExpected (shortened – yours is one long line
starting with K10):
K100c3663415…
Copy the whole line. It is a secret: whoever has it may attach nodes to your cluster.
Step 3 – register the registry on werk2 too. The
agent on werk2 pulls images itself. It needs the same file as werk1 from
Drill 4, step 1. Log in to werk2 (ssh werk2):
# on werk2
sudo mkdir -p /etc/rancher/k3s# on werk2
sudo nano /etc/rancher/k3s/registries.yamlmirrors:
"werk1:5000":
endpoint:
- "http://werk1:5000"Step 4 – install k3s as an agent.
# on werk2
curl -sfL https://get.k3s.io -o k3s-install.shInsert the copied line for <token>:
# on werk2
sudo INSTALL_K3S_VERSION=v1.37.2+k3s1 K3S_URL=https://werk1:6443 K3S_TOKEN=<token> sh k3s-install.sh| Option | Value | Meaning |
|---|---|---|
INSTALL_K3S_VERSION= |
v1.37.2+k3s1 |
the same version as the server |
K3S_URL= |
https://werk1:6443 |
address of the API server; if it is set, the script installs an agent |
K3S_TOKEN= |
your token | the shared secret for joining |
Expected (last lines):
[INFO] env: Creating environment file /etc/systemd/system/k3s-agent.service.env
[INFO] systemd: Creating service file /etc/systemd/system/k3s-agent.service
[INFO] systemd: Enabling k3s-agent unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s-agent.service → /etc/systemd/system/k3s-agent.service.
[INFO] systemd: Starting k3s-agent
Step 5 – wait until werk2 is ready. Back on werk1:
# on werk1
kubectl wait --for=condition=Ready node/werk2 --timeout=120s--for=condition=Readywaits until the node reports the conditionReady.node/werk2is the object being waited for.--timeout=120sgives up after two minutes instead of waiting forever.
Expected:
node/werk2 condition met
Step 6 – both nodes and what runs in the cluster.
# on werk1
kubectl get nodesExpected:
NAME STATUS ROLES AGE VERSION
werk1 Ready control-plane 75s v1.37.2+k3s1
werk2 Ready <none> 11s v1.37.2+k3s1
# on werk1
kubectl get pods -A-A shows the pods of all namespaces.
Expected:
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-577d995dff-785gx 1/1 Running 0 70s
kube-system helm-install-gateway-api-crd-nwkjv 0/1 Completed 0 70s
kube-system local-path-provisioner-56c6584955-b5pp7 1/1 Running 0 70s
kube-system metrics-server-778c4649b4-mcqjt 1/1 Running 0 70s
What you see: k3s brings a DNS service
(coredns), a storage provider that creates volumes as
folders on the node (local-path-provisioner), and the
metrics server. The job helm-install-gateway-api-crd
installed resource definitions once and is finished.
Remember: Every hall fetches its own parts from the warehouse. That is why every node needs the registry setting – not just the one you build on.
Save your progress? Sign up for free
Drill 6: Build the first vehicle
Where you are: on werk1.
What you have afterwards: the source code of the Bewerbungslotse in
~/lotseand the imagewerk1:5000/bewerbungslotse:1.0.0in your own registry.
The product consists of three files: the program, the list of its dependencies and the build instructions for the image. You create them in a folder of their own. All three files are also in the course’s companion repository; typing them in is still worthwhile, because you will see every line again over the next days.
Step 1 – create folders.
# on werk1
mkdir -p ~/lotse/chart/templates-p also creates all missing folders along the way:
lotse, lotse/chart and
lotse/chart/templates (you need the last one in Drill
7).
Step 2 – the program.
# on werk1
nano ~/lotse/app.py"""Bewerbungslotse – sortiert Bewerbungen mit einem Sprachmodell vor."""
import json
import os
import uuid
from pathlib import Path
import requests
from flask import Flask, abort, jsonify, request, send_file
VERSION = "1.0.0"
OLLAMA = os.environ.get("OLLAMA_URL", "http://ollama:11434")
MODELL = os.environ.get("MODELL", "qwen3:4b-instruct")
ABLAGE = Path(os.environ.get("ABLAGE", "/daten"))
ADMIN_PASSWORT = os.environ.get("ADMIN_PASSWORT", "lotse")
ANWEISUNG = (
"Du hilfst einer Personalabteilung. Bewerte, wie gut die Bewerbung zur Stelle passt. "
'Antworte nur mit JSON: {"passung": <Zahl von 1 bis 5>, "begruendung": "<ein Satz>"}'
)
app = Flask(__name__)
@app.get("/gesund")
def gesund():
return {"status": "ok", "version": VERSION}
@app.post("/api/bewerbungen")
def bewerbung_anlegen():
daten = request.get_json(force=True)
frage = f"Stelle: {daten['stelle']}\n\nBewerbung:\n{daten['text']}"
antwort = requests.post(
f"{OLLAMA}/api/chat",
json={
"model": MODELL,
"stream": False,
"format": "json",
"options": {"temperature": 0},
"messages": [
{"role": "system", "content": ANWEISUNG},
{"role": "user", "content": frage},
],
},
timeout=300,
)
antwort.raise_for_status()
bewertung = json.loads(antwort.json()["message"]["content"])
akte = {
"nummer": uuid.uuid4().hex[:8],
"name": daten["name"],
"stelle": daten["stelle"],
"bewertung": bewertung,
}
(ABLAGE / f"{akte['nummer']}.json").write_text(json.dumps(akte, ensure_ascii=False))
return jsonify(akte), 201
@app.get("/api/bewerbungen/<nummer>")
def bewerbung_lesen(nummer):
akte = ABLAGE / f"{nummer}.json"
if not nummer.isalnum() or not akte.exists():
abort(404)
return json.loads(akte.read_text())
@app.post("/api/bewerbungen/<nummer>/anlagen")
def anlage_hochladen(nummer):
datei = request.files["datei"]
ordner = ABLAGE / "anlagen" / nummer
ordner.mkdir(parents=True, exist_ok=True)
datei.save(ordner / Path(datei.filename).name)
return {"gespeichert": f"{nummer}/{Path(datei.filename).name}"}, 201
@app.get("/api/anlagen/<path:name>")
def anlage_herunterladen(name):
return send_file(ABLAGE / "anlagen" / name)
@app.get("/api/admin/export")
def export():
zugang = request.authorization
if zugang is None or zugang.password != ADMIN_PASSWORT:
abort(401)
return [json.loads(p.read_text()) for p in sorted(ABLAGE.glob("*.json"))]What the program does, section by section:
| Part | What it does |
|---|---|
| lines 11–15 | settings from environment variables, each with a default: Ollama address, model, storage folder, admin password |
ANWEISUNG |
the system instruction to the model: fit from 1 to 5 and one sentence of reasoning, as JSON only |
/gesund |
sign of life with version number |
POST /api/bewerbungen |
sends position and application text to Ollama, reads the rating, stores an application file as a JSON file |
GET /api/bewerbungen/<nummer> |
reads an application file |
POST …/anlagen |
accepts a file (CV, reference letter) for an application |
GET /api/anlagen/<name> |
serves an attachment back |
/api/admin/export |
outputs all application files, protected by a password |
Two settings in the request to Ollama are important:
"format": "json" forces the model to return valid JSON, and
"temperature": 0 makes the answer for the same input as
consistent as possible. You need both on Day 13 when you measure
accuracy.
While reading, you may already notice things that shouldn’t be shipped like this. Make a note of them – but don’t change anything yet. Finding, assessing and fixing them is the subject of the next days.
Step 3 – the dependencies.
# on werk1
nano ~/lotse/requirements.txtflask==3.0.3
werkzeug==3.0.3
jinja2==3.1.4
markupsafe==2.1.5
itsdangerous==2.2.0
click==8.1.7
blinker==1.8.2
requests==2.31.0
urllib3==2.2.1
idna==3.6
certifi==2024.2.2
charset-normalizer==3.3.2
gunicorn==22.0.0
packaging==24.0Each line names a Python package and exactly one
version (==). The program uses only two of them directly –
Flask and Requests – plus Gunicorn as the web server in the container.
The other eleven are dependencies of these three. There is a reason they
are still listed individually with a fixed version: this way every run
builds the same image, and you know exactly which parts are in which
vehicle. The versions date from spring 2024. What that means, you will
see on Day 3.
Step 4 – the build instructions.
# on werk1
nano ~/lotse/ContainerfileFROM docker.io/library/python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app.py .
RUN mkdir /daten
EXPOSE 8080
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--timeout", "300", "app:app"]| Line | Meaning |
|---|---|
FROM …python:3.12-slim |
the base is the official Debian-based Python image in its slim variant |
WORKDIR /app |
all following commands work in /app |
COPY requirements.txt . |
the list of dependencies into the image |
RUN pip install --no-cache-dir -r … |
install packages without leaving the download cache in the image |
COPY app.py . |
the program into the image |
RUN mkdir /daten |
create the storage folder |
EXPOSE 8080 |
documents the port the service listens on |
CMD [...] |
starts Gunicorn on port 8080 with the Flask object app
from app.py; --timeout 300 gives the model
five minutes |
Docker calls this file Dockerfile; Podman understands
both names. Containerfile is the neutral name from the Open
Container Initiative.
Step 5 – build the image.
# on werk1
cd ~/lotse# on werk1
podman build -t werk1:5000/bewerbungslotse:1.0.0 .buildbuilds an image from theContainerfilein the given folder.-t werk1:5000/bewerbungslotse:1.0.0gives the image its name. The first part is the registry, then the name of the repository, and after the colon the version (the tag)..is the folder with theContainerfileand the files that are copied.
Expected (excerpt – beginning, pip result and end):
STEP 1/8: FROM docker.io/library/python:3.12-slim
Trying to pull docker.io/library/python:3.12-slim...
Getting image source signatures
Copying blob sha256:286d8c291daa64125703b22c3d009462bcae0b630eaa16ad5b934502c4917233
…
STEP 4/8: RUN pip install --no-cache-dir -r requirements.txt
…
Successfully installed blinker-1.8.2 certifi-2024.2.2 charset-normalizer-3.3.2 click-8.1.7 flask-3.0.3 gunicorn-22.0.0 idna-3.6 itsdangerous-2.2.0 jinja2-3.1.4 markupsafe-2.1.5 packaging-24.0 requests-2.31.0 urllib3-2.2.1 werkzeug-3.0.3
…
STEP 8/8: CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--timeout", "300", "app:app"]
COMMIT werk1:5000/bewerbungslotse:1.0.0
--> 59cc89c32dee
Successfully tagged werk1:5000/bewerbungslotse:1.0.0
59cc89c32dee57a9e79fe210cd093c88a3378a8064acb9a43d49513c847fbb25
What you see: Podman first pulls the base image from
Docker Hub, then it executes the eight lines of the build instructions.
pip reports exactly the 14 packages from requirements.txt.
The long string at the end is the ID of the image – the checksum of its
configuration.
Step 6 – look at the image.
# on werk1
podman imagesExpected (your IDs and times differ):
REPOSITORY TAG IMAGE ID CREATED SIZE
werk1:5000/bewerbungslotse 1.0.0 59cc89c32dee 7 seconds ago 141 MB
docker.io/library/python 3.12-slim d497f3e5689c 9 days ago 124 MB
What you see: Your product is 141 MB in size, 124 MB of which come from the base image. Your own code and the 14 Python packages make up the small rest. So by far the largest part of your vehicle doesn’t come from you – and yet for the manufacturer the whole is what counts.
Step 7 – bring it to the warehouse.
# on werk1
podman push werk1:5000/bewerbungslotse:1.0.0push uploads the image to the registry named in the
image name.
Expected (last lines):
Copying blob sha256:1f30a5c15decfdd98e43442cc4d582e06f895ffc5bf0bf2a8b1e8735ee12772a
Copying config sha256:59cc89c32dee57a9e79fe210cd093c88a3378a8064acb9a43d49513c847fbb25
Writing manifest to image destination
# on werk1
curl -s http://werk1:5000/v2/_catalogExpected:
{"repositories":["bewerbungslotse"]}
# on werk1
curl -s http://werk1:5000/v2/bewerbungslotse/tags/listExpected:
{"name":"bewerbungslotse","tags":["1.0.0"]}
What you see: The warehouse now knows one repository with one tag. The manifest that Podman wrote last is the image’s table of contents: which layers belong to it in which order, each with a checksum.
Remember: An image is a vehicle made of many third-party parts with your type plate on it. The name
werk1:5000/bewerbungslotse:1.0.0says which warehouse it comes from and which model series it is.
Save your progress? Sign up for free
Drill 7: Shipping with Helm
Where you are: on werk1.
What you have afterwards: the Bewerbungslotse and Ollama in the namespace
lotse, the language modelqwen3:4b-instructin Ollama’s storage and the service on port 30080 on every node.
Customers get from you not only the image but also the instructions for running it in Kubernetes: a Helm chart. It consists of a description, the default values and templates for the Kubernetes objects. Everything in the default values is what every customer gets who changes nothing – that will matter too.
Step 1 – the chart description.
# on werk1
nano ~/lotse/chart/Chart.yamlapiVersion: v2
name: bewerbungslotse
description: Sortiert Bewerbungen mit einem Sprachmodell vor
type: application
version: 1.0.0
appVersion: "1.0.0"| Field | Meaning |
|---|---|
apiVersion: v2 |
format for Helm 3 and 4 |
name |
name of the chart |
type: application |
a chart that installs something (instead of a library for other charts) |
version |
version of the chart – it goes up with every change to the templates |
appVersion |
version of the application that the chart ships |
Step 2 – the default values.
# on werk1
nano ~/lotse/chart/values.yamllotse:
image: werk1:5000/bewerbungslotse:1.0.0
nodePort: 30080
adminPasswort: lotse
ollama:
image: docker.io/ollama/ollama:0.40.19
modell: qwen3:4b-instruct
knoten: werk1
speicher: 10Gi| Value | Meaning |
|---|---|
lotse.image |
the image from Drill 6 |
lotse.nodePort |
port at which the service is reachable on every node |
lotse.adminPasswort |
password for exporting all application files |
ollama.image |
the official Ollama image in a fixed version |
ollama.modell |
the language model the Lotse uses |
ollama.knoten |
Ollama runs on werk1 because four cores compute there |
ollama.speicher |
size of the volume for the model files |
Step 3 – the template for the Lotse.
# on werk1
nano ~/lotse/chart/templates/lotse.yamlapiVersion: apps/v1
kind: Deployment
metadata:
name: lotse
spec:
replicas: 1
selector:
matchLabels:
app: lotse
template:
metadata:
labels:
app: lotse
spec:
containers:
- name: lotse
image: {{ .Values.lotse.image }}
ports:
- containerPort: 8080
env:
- name: OLLAMA_URL
value: http://ollama:11434
- name: MODELL
value: {{ .Values.ollama.modell }}
- name: ADMIN_PASSWORT
value: {{ .Values.lotse.adminPasswort | quote }}
volumeMounts:
- name: daten
mountPath: /daten
volumes:
- name: daten
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: lotse
spec:
type: NodePort
selector:
app: lotse
ports:
- port: 8080
targetPort: 8080
nodePort: {{ .Values.lotse.nodePort }}The file contains two objects, separated by ---:
- The Deployment starts a pod with the Lotse. In
{{ .Values.… }}, Helm inserts the values fromvalues.yamlat install time;| quoteputs quotation marks around the value. The application files go into anemptyDir– an empty folder that is created with the pod and disappears with it. - The Service of type
NodePortmakes the pod reachable on port 30080 of every node.
Step 4 – the template for Ollama.
# on werk1
nano ~/lotse/chart/templates/ollama.yamlapiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ollama-modelle
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.ollama.speicher }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ollama
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: ollama
template:
metadata:
labels:
app: ollama
spec:
nodeSelector:
kubernetes.io/hostname: {{ .Values.ollama.knoten }}
containers:
- name: ollama
image: {{ .Values.ollama.image }}
ports:
- containerPort: 11434
volumeMounts:
- name: modelle
mountPath: /root/.ollama
volumes:
- name: modelle
persistentVolumeClaim:
claimName: ollama-modelle
---
apiVersion: v1
kind: Service
metadata:
name: ollama
spec:
selector:
app: ollama
ports:
- port: 11434
targetPort: 11434Three objects:
- The PersistentVolumeClaim requests 10 GiB of
storage for the model files. The
local-path-provisionerof k3s creates a folder on the node for it. Unlike the Lotse’semptyDir, the model is kept when the pod restarts. - The Deployment starts Ollama.
nodeSelectorkeeps the pod on werk1.strategy: Recreatefirst stops the old pod during an update and then starts the new one – two pods must not share the volume. - The Service gives Ollama the name
ollamaon port 11434 in the cluster. Exactly this address is in the Lotse’s Deployment.
Step 5 – check the chart.
# on werk1
helm lint ~/lotse/charthelm lint checks the structure and templates of a chart
without installing anything.
Expected:
==> Linting /home/ubuntu/lotse/chart
[INFO] Chart.yaml: icon is recommended
1 chart(s) linted, 0 chart(s) failed
What you see: no errors. The note about a missing icon is only a recommendation.
Step 6 – install.
# on werk1
kubectl create namespace lotseExpected:
namespace/lotse created
# on werk1
helm install lotse ~/lotse/chart --namespace lotseinstall lotsecreates a release namedlotse– that is the name of this one installation of the chart.~/lotse/chartis the folder with the chart.--namespace lotseinstalls into the namespace you just created.
Expected:
NAME: lotse
LAST DEPLOYED: Thu Dec 3 10:41:46 2026
NAMESPACE: lotse
STATUS: deployed
REVISION: 1
DESCRIPTION: Install complete
TEST SUITE: None
Step 7 – wait until Ollama is running. The Ollama image is large. Give it time:
# on werk1
kubectl -n lotse rollout status deployment/ollama --timeout=900s-n lotseworks in the namespacelotse.rollout status deployment/ollamawaits until all pods of the Deployment are ready.--timeout=900sgives up after 15 minutes.
Expected:
Waiting for deployment "ollama" rollout to finish: 0 of 1 updated replicas are available...
deployment "ollama" successfully rolled out
The pod’s events show how long it took. Insert the name of your
Ollama pod; kubectl -n lotse get pods shows it:
# on werk1
kubectl -n lotse events --for pod/ollama-584ffb5bb8-qp595Expected (excerpt):
6m24s Normal Pulling Pod/ollama-584ffb5bb8-qp595 Pulling image "docker.io/ollama/ollama:0.40.19"
7s Normal Pulled Pod/ollama-584ffb5bb8-qp595 Successfully pulled image "docker.io/ollama/ollama:0.40.19" in 6m17.539s (6m17.539s including waiting). Image size: 3434975454 bytes.
What you see: The Ollama image is 3.4 GB in size – 24 times as large as your own product – and took a good six minutes to pull in the lab. It contains libraries for graphics cards that are never used on werk1. These, too, are parts of your vehicle.
Step 8 – fetch the model. Ollama starts without a model. You have it downloaded in the running pod:
# on werk1
kubectl -n lotse exec deploy/ollama -- ollama pull qwen3:4b-instructexec deploy/ollamaruns a command in a pod of the Deploymentollama.- Everything after
--is the command in the container:ollama pulldownloads the model from Ollama’s library.
Expected (end – before that, a progress bar runs):
verifying sha256 digest
writing manifest
success
# on werk1
kubectl -n lotse exec deploy/ollama -- ollama listExpected:
NAME ID SIZE MODIFIED
qwen3:4b-instruct 0edcdef34593 2.5 GB 7 seconds ago
What you see: The model is also verified by a
checksum (verifying sha256 digest). It has four billion
parameters and takes up 2.5 GB. It lives in the volume and survives pod
restarts.
Step 9 – what runs where?
# on werk1
kubectl -n lotse get pods,svc,pvc -o wideExpected (pods and services, cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
pod/lotse-f45b4fd95-6fxrd 1/1 Running 0 38s 10.42.1.3 werk2
pod/ollama-584ffb5bb8-qp595 1/1 Running 0 13m 10.42.0.7 werk1
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/lotse NodePort 10.43.146.193 <none> 8080:30080/TCP 13m
service/ollama ClusterIP 10.43.238.68 <none> 11434/TCP 13m
What you see: The Lotse runs on werk2, Ollama on
werk1, as required. The Lotse is reachable from outside on port 30080;
Ollama only has an address inside the cluster
(ClusterIP).
Remember: The Helm chart is the assembly instructions including the factory settings. Whatever is in
values.yaml, every customer gets who changes nothing – including a password likelotse.
If it doesn’t work
If step 7 aborts with
error: timed out waiting for the condition, the image has
usually not finished pulling yet – in the lab, the first attempt with
five minutes was not enough. The pod is then in
ContainerCreating. Simply run the command again; the pull
continues in the background.
Save your progress? Sign up for free
Drill 8: The first application
Where you are: on werk1.
What you have afterwards: two rated applications, one attachment and an idea of how long the model computes on the CPU.
The applications in this course are made up. Real application data never belongs in a practice lab.
Step 1 – the sign of life.
# on werk1
curl -s http://werk1:30080/gesundExpected:
{"status":"ok","version":"1.0.0"}
Step 2 – an application as a file.
# on werk1
mkdir -p ~/kurs/00# on werk1
nano ~/kurs/00/bewerbung-mara.json{
"name": "Mara Klein",
"stelle": "Linux-Administratorin (m/w/d) mit Kubernetes-Erfahrung",
"text": "Seit sechs Jahren betreibe ich Linux-Server, seit drei Jahren mehrere Kubernetes-Cluster mit k3s und RKE2. Ich automatisiere mit Ansible und schreibe Helm-Charts."
}Step 3 – send the application. It is preceded by
time so that you see how long the answer takes:
# on werk1
time curl -s -X POST -H "Content-Type: application/json" --data @kurs/00/bewerbung-mara.json http://werk1:30080/api/bewerbungen| Option | Meaning |
|---|---|
time |
measures the run time of the following command |
-X POST |
HTTP method POST – create a new application |
-H "Content-Type: application/json" |
tells the service that JSON is coming |
--data @kurs/00/bewerbung-mara.json |
sends the content of the file; @ means “read from
file” |
| address | the service on port 30080 |
Expected:
{"bewertung":{"begruendung":"Die Bewerbung zeigt klare, relevante Erfahrung in Linux-Administration und Kubernetes mit konkreten Tools wie k3s, RKE2, Ansible und Helm-Charts, was die Stelle sehr gut passt.","passung":5},"name":"Mara Klein","nummer":"e114401a","stelle":"Linux-Administratorin (m/w/d) mit Kubernetes-Erfahrung"}
real 0m12.925s
user 0m0.010s
sys 0m0.030s
What you see: The model gives a fit of 5 and one
sentence of reasoning. The application file has the number
e114401a – yours is a different one. The answer came after
13 seconds; real is the elapsed time. If the model is not
yet in memory, the first answer takes longer – in the lab it was 48
seconds.
Step 4 – a second application.
# on werk1
nano ~/kurs/00/bewerbung-jonas.json{
"name": "Jonas Berg",
"stelle": "Linux-Administratorin (m/w/d) mit Kubernetes-Erfahrung",
"text": "Ich bin gelernter Koch und arbeite seit zehn Jahren in der Gastronomie. Computer nutze ich privat."
}# on werk1
time curl -s -X POST -H "Content-Type: application/json" --data @kurs/00/bewerbung-jonas.json http://werk1:30080/api/bewerbungenExpected:
{"bewertung":{"begruendung":"Die Bewerbung zeigt keine relevante Erfahrung f\u00fcr die Stelle eines Linux-Administratorin mit Kubernetes-Erfahrung und passt daher nur sehr schlecht zur Stelle.","passung":1},"name":"Jonas Berg","nummer":"b48bdf9a","stelle":"Linux-Administratorin (m/w/d) mit Kubernetes-Erfahrung"}
real 0m9.475s
user 0m0.013s
sys 0m0.018s
What you see: Fit 1. \u00fc is a
ü in JSON notation. The reasoning has a small grammatical
error (“eines Linux-Administratorin”) – the model is small. Whether its
ratings are any good, you measure on Day 13.
Step 5 – upload an attachment and fetch it again.
# on werk1
nano ~/kurs/00/lebenslauf-mara.txtMara Klein
Lebenslauf
2020-2026 Linux-Administratorin, Stadtwerke MusterstadtInsert the number of your application file for Mara:
# on werk1
curl -s -F datei=@kurs/00/lebenslauf-mara.txt http://werk1:30080/api/bewerbungen/e114401a/anlagen-F datei=@…sends the file as the form fielddatei, the way a browser does a file upload.
Expected:
{"gespeichert":"e114401a/lebenslauf-mara.txt"}
# on werk1
curl -s http://werk1:30080/api/anlagen/e114401a/lebenslauf-mara.txtExpected:
Mara Klein
Lebenslauf
2020-2026 Linux-Administratorin, Stadtwerke Musterstadt
Step 6 – what the service logs.
# on werk1
kubectl -n lotse logs deploy/lotseExpected:
[2026-12-03 10:54:20 +0000] [1] [INFO] Starting gunicorn 22.0.0
[2026-12-03 10:54:20 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2026-12-03 10:54:20 +0000] [1] [INFO] Using worker: sync
[2026-12-03 10:54:20 +0000] [7] [INFO] Booting worker with pid: 7
What you see: Four lines from the start – and not a single one about the two applications, the attachment or the model’s ratings. Who requested what and when, and what the model answered, is recorded nowhere. Remember this empty output; on Day 8 and Day 11 you will miss it.
Remember: The product works – and leaves no trace. For a manufacturer under the CRA and a provider under the AI Act, both matter: that it runs and that you can prove what it did.
Save your progress? Sign up for free
Diagnosis task
A colleague set up werk2 again and forgot Drill 5, step 3. Afterwards the Lotse’s pod lands on werk2 and doesn’t start. To reproduce this, you take the registry setting away from werk2, delete the cached image and force the pod onto werk2:
# on werk2
sudo mv /etc/rancher/k3s/registries.yaml /etc/rancher/k3s/registries.yaml.weg# on werk2
sudo systemctl restart k3s-agent# on werk2
sudo k3s crictl rmi werk1:5000/bewerbungslotse:1.0.0Expected:
Deleted: werk1:5000/bewerbungslotse:1.0.0
# on werk1
kubectl cordon werk1cordon marks werk1 as “no new pods” so that the new pod
is sure to land on werk2.
# on werk1
kubectl -n lotse delete pod -l app=lotseThe Deployment immediately starts a new pod. After half a minute:
# on werk1
kubectl -n lotse get pods -l app=lotse -o wideExpected (cut off on the right):
NAME READY STATUS RESTARTS AGE IP NODE
lotse-f45b4fd95-7cpjd 0/1 ErrImagePull 0 32s 10.42.1.4 werk2
Find the cause before you read the solution path.
Solution path:
The pod’s events tell you where it is stuck:
# on werk1 kubectl -n lotse describe pod -l app=lotseExpected (excerpt from
Events:):Warning Failed 19s (x2 over 32s) kubelet spec.containers{lotse}: Failed to pull image "werk1:5000/bewerbungslotse:1.0.0": failed to pull and unpack image "werk1:5000/bewerbungslotse:1.0.0": failed to resolve reference "werk1:5000/bewerbungslotse:1.0.0": failed to do request: Head "https://werk1:5000/v2/bewerbungslotse/manifests/1.0.0": http: server gave HTTP response to HTTPS clientThe message is clear: werk2 asks
https://werk1:5000, and the registry answers with HTTP. The agent is missing the setting thatwerk1:5000is reachable over HTTP.Check on werk2 whether the file is there:
# on werk2 ls /etc/rancher/k3s/Expected:
registries.yaml.wegPut the file back in its place and restart the agent – k3s reads it only at startup:
# on werk2 sudo mv /etc/rancher/k3s/registries.yaml.weg /etc/rancher/k3s/registries.yaml# on werk2 sudo systemctl restart k3s-agentHave the pod restarted, check, and release werk1 again:
# on werk1 kubectl -n lotse delete pod -l app=lotse# on werk1 kubectl -n lotse rollout status deploy/lotse --timeout=120sExpected:
deployment "lotse" successfully rolled out# on werk1 kubectl uncordon werk1Expected:
node/werk1 uncordoned
Note: with the new pod, its emptyDir is new too. The
application files of Mara and Jonas are gone. That is not a fault of the
diagnosis but a property of the product that you should remember.
Challenge
How long does the Bewerbungslotse take for the first answer when
Ollama has just been restarted – and how long for the second? Restart
Ollama, measure both requests with time and find out what
causes the difference. Write down the commands before you read the
solution.
Solution:
# on werk1
kubectl -n lotse rollout restart deploy/ollama# on werk1
kubectl -n lotse rollout status deploy/ollama --timeout=300sThen the same application twice in a row:
# on werk1
time curl -s -X POST -H "Content-Type: application/json" --data @kurs/00/bewerbung-mara.json http://werk1:30080/api/bewerbungenIn the lab, the first request showed real 0m57.667s, the
second real 0m13.299s. Ollama itself shows the reason:
# on werk1
kubectl -n lotse exec deploy/ollama -- ollama psExpected:
NAME ID SIZE PROCESSOR CONTEXT RUNNER UNTIL
qwen3:4b-instruct 0edcdef34593 3.2 GB 100% CPU 4096 llamacpp 4 minutes from now
After the restart, Ollama first has to load the model from disk into
memory – in the lab that takes around 45 seconds. After that it stays
loaded, here for another four minutes (UNTIL), and each
request only needs the compute time. 100% CPU confirms: no
graphics card, everything computes on the cores. By the way, both
answers were identical word for word – that is the effect of
"temperature": 0.
Save your progress? Sign up for free
Checkpoint
Check at the end of the chapter:
# on werk1
kubectl get nodesExpected (age differs):
NAME STATUS ROLES AGE VERSION
werk1 Ready control-plane 20m v1.37.2+k3s1
werk2 Ready <none> 19m v1.37.2+k3s1
# on werk1
helm list -n lotseExpected (column UPDATED
shortened):
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
lotse lotse 1 2026-12-03 deployed bewerbungslotse-1.0.0 1.0.0
# on werk1
curl -s http://werk1:5000/v2/bewerbungslotse/tags/listExpected:
{"name":"bewerbungslotse","tags":["1.0.0"]}
# on werk1
curl -s http://werk1:30080/gesundExpected:
{"status":"ok","version":"1.0.0"}
# on werk1
systemctl is-active zot k3sExpected:
active
active
If everything matches, the factory is ready.
Test yourself
- Why do you verify the checksum of Helm and zot before you install them? What does that protect against, and what not?
- Why does werk2 also need the file
registries.yaml, even though you never build an image there? - How many Python packages are in the image, and how many of them does
app.pyitself use? - Which part of your product is the largest in the lab, and what follows from that for the question “What actually is my product?”
- Why are the application files gone after a restart of the Lotse’s pod, but the model is not gone after a restart of Ollama?
- What is missing from the Lotse’s logs when you think of an attack or a complaint from an applicant?
Answers:
- The checksum shows that the file on your disk is exactly the one the project published – against transmission errors and a tampered download server. It doesn’t help against an attacker who replaces the file and the checksum list together; that needs a signature (Day 6).
- Every node pulls the images for its pods from the registry itself.
Without the setting, werk2 asks over HTTPS and fails with
server gave HTTP response to HTTPS client. - 14 packages, all with a fixed version in
requirements.txt. Flask and Requests are used directly, Gunicorn starts the service; the other eleven are dependencies of these three. - The Ollama image with 3.4 GB, followed by the base image
python:3.12-slim(124 MB); your own code is tiny. Everything you ship belongs to the product – including the parts you didn’t write. - The Lotse stores the application files in an
emptyDir, which is created and disappears with the pod. Ollama stores the model in a PersistentVolumeClaim, which persists independently of the pod. - Everything: who created which application or fetched which file and when, and what the model answered. The logs only show the start of Gunicorn.
Interview note
“What is a product within the meaning of the Cyber Resilience Act to you?” – Good answer: everything I place on the market with software as a manufacturer – not just my own code, but the whole package: container image including the base image, libraries, Helm chart with its default values, and bought-in components such as a model runtime. As the manufacturer, I am responsible for vulnerabilities in these parts. To go further: that is why every CRA implementation starts with an inventory, that is, a parts list (SBOM).
Enterprise note
In production, a registry is never on the network without TLS and authentication. Common choices are Harbor, an Artifactory or Nexus instance, or zot with TLS, user management through an identity provider and read and write permissions per repository. Kubernetes nodes pull images with their own read-only credentials; the build pipeline is the only one with write permissions. In production, the k3s join token isn’t on the command line either but comes from a provisioning tool or a vault. And the base image isn’t pulled fresh from Docker Hub at every build but from your own mirror with a fixed digest – you will see why on Days 2 and 3.
Summary
- You have your own SSH key, and the VMs are called werk1 and werk2 and know each other by name.
- Helm and zot are installed after a verified checksum; zot runs as a
service with its own account and is the parts warehouse at
werk1:5000. - k3s runs as a server on werk1 and as an agent on werk2; both nodes pull images over HTTP from your own registry.
- The Bewerbungslotse is built (141 MB, 14 Python packages with fixed
versions), stored in the registry and runs with Ollama and the model
qwen3:4b-instructfrom your own Helm chart. - A rating takes around 10 to 13 seconds on the CPU, almost a minute after a restart of Ollama.
- The product leaves no trace in the logs, loses its application files at every restart and comes with a preset admin password – material for the next days.
Commands at a glance
| Command | Purpose |
|---|---|
ssh-keygen -t ed25519 -f ~/.ssh/werk -C werk-labor |
create a key pair for the lab |
ssh-copy-id -i ~/.ssh/werk.pub ubuntu@<ip> |
put the public key on the VM |
sudo hostnamectl set-hostname <name> |
set the host name permanently |
getent hosts <name> |
check name resolution |
dpkg --print-architecture |
processor architecture for downloads |
sha256sum -c <list> |
check a download against a checksum list |
sudo install -m 755 <file> /usr/local/bin/<name> |
install a program with permissions |
sudo useradd --system --no-create-home --shell /usr/sbin/nologin <name> |
create a service account |
sudo systemctl enable --now <service> |
enable and start a service |
curl -s http://werk1:5000/v2/_catalog |
list the registry’s repositories |
sudo INSTALL_K3S_VERSION=… sh k3s-install.sh --disable traefik |
install the k3s server |
sudo INSTALL_K3S_VERSION=… K3S_URL=… K3S_TOKEN=… sh k3s-install.sh |
install the k3s agent |
kubectl wait --for=condition=Ready node/<name> --timeout=120s |
wait for a condition |
podman build -t <registry>/<name>:<tag> . |
build an image |
podman push <registry>/<name>:<tag> |
push an image to the registry |
helm lint <chart> |
check a chart |
helm install <release> <chart> --namespace <ns> |
install a chart |
kubectl -n <ns> rollout status deployment/<name> --timeout=… |
wait until a Deployment is ready |
kubectl -n <ns> exec deploy/<name> -- <command> |
run a command in a pod |
kubectl -n <ns> events --for pod/<name> |
events of a pod |
kubectl -n <ns> logs deploy/<name> |
logs of a pod |
time <command> |
measure run time |