This challenge checks that you can, on your own, confine Pods against the kernel, encrypt and filter their flows, isolate them in a sandbox and trigger an alert when a shell opens where it should not. It is meant for people who have just followed the lessons on confining Pods, starting from the lesson Runtime Sandboxes. It runs in a dsoxlab virtual machine, on a kubeadm cluster with Kubernetes 1.37, and takes about 75 minutes. It gives no hints and teaches nothing new: it checks what the lessons of the module and their guided labs have already let you practice.
What you will learn
The lab reads the node and the cluster. It really writes files and runs chmod in the Pods, makes real connections between Pods, compares kernels, and opens a shell itself in the protected Pod before reading Falco's alerts. It checks that you can:
- Write an AppArmor profile and a seccomp profile, load them and declare them in a Pod.
- Require mutual TLS in a namespace of the Istio mesh.
- Close a namespace by default, keeping the intended application flow and DNS resolution.
- Offer the cluster a sandbox runtime with a RuntimeClass and run a Pod in it.
- Write a Falco rule that triggers an alert for a shell opened in a namespace, and only in that one.
What should you be able to do before you start?
No step-by-step guide goes with the challenge, and choosing the right settings is part of what it checks. Everything it asks for is taught in seven lessons:
- Runtime Sandboxes: declare an alternative runtime, create a RuntimeClass and assign a Pod to it.
- AppArmor in Kubernetes: write a profile, load it on a node and declare it in a Pod.
- Kubernetes Seccomp: write a local profile and declare it in a Pod.
- Pod-to-pod mTLS: require mutual TLS in a namespace of the mesh.
- Kubernetes NetworkPolicies: close a namespace by default and reopen one precise flow.
- Falco: write a detection rule and read the alerts.
- Falco vs Tetragon: what each tool detects and how to limit a rule to one scope.
If one of these points feels unclear, reread the lesson before you start.
What does the statement ask for?
The security team took over the kubeadm cluster, and its audit is blunt: nothing is confined, nothing is required, nothing is watched.
- In the
coffrenamespace, sensitive workloads run like any container: free to write anywhere, to change permissions, and sharing the machine's kernel. The Podtresoris the protected application. The Podordinaireruns with the default runtime, and you leave it alone. - The
maillenamespace is in an Istio mesh:apiserves a page andclient-maillecalls it. Fromexterieur,client-nu, which has no sidecar, reads that page in plain text. - In the
donneesnamespace,appliis the legitimate client of the databasebase(HTTP on port 80).intrusandannuairelive there too, and everyone talks to everyone, outside the namespace included. - Falco runs on the control plane
k8s-cp.laband writes its alerts as JSON in/var/log/falco/events.json. Nobody would notice a shell opened intresor.
The AppArmor and seccomp profiles you write, the sandbox runtime runsc and Falco only exist on k8s-cp.lab. You work on that node, with kubectl configured and root rights through sudo. Install and uninstall nothing.
The statement says what must be true at the end, never how to get there. To confine against the kernel, in coffre (image busybox:1.37, Pods that stay running):
- An AppArmor profile named
k8s-coffre-sans-tmpis loaded onk8s-cp.labinenforcemode. It denies any write under/tmpand allows the rest. - A Pod
lecteurruns on the node where that profile is loaded and declares it. - From
lecteur, writing into/tmpis denied, reading the filesystem works. This requirement is blocking. - A seccomp profile
profiles/coffre-sans-chmod.json, in the kubelet's local profiles directory, refuses thechmodfamily and allows everything else by default. - A Pod
calculdeclares that local profile and runs. - In
calcul, achmodfails and creating a file works.
To encrypt and filter the flows:
- The
maillenamespace only accepts mutually authenticated traffic. client-nuno longer reachesapi,client-maillestill does. This requirement is blocking.- The
donneesnamespace refuses inbound and outbound traffic by default, for all its Pods. - Only
applireachesbase, on port 80. - Names still resolve in
donnees, without reopening the rest of the outbound traffic.
To isolate in a sandbox:
- The sandbox runtime known to
containerdis offered to the cluster under the namegvisor-coffre. - A Pod
isoleruns in that sandbox and reads a kernel other than the machine's.
To detect:
- A shell opened in a container of
coffretriggers the alert of a Falco rule namedcoffre-shell, with priorityCRITICAL. This requirement is blocking. - A shell opened in another namespace does not trigger that rule.
- The rules shipped with Falco,
/etc/falco/falco_rules.yaml, stay intact.
How do you start the challenge and get graded?
You start the lab with dsoxlab run k8s-challenge-confiner-et-detecter. It prepares a cluster where Falco, the gVisor runtime (runsc) and the mesh already exist, with no profile and no rule. Two commands are then used. dsoxlab check k8s-challenge-confiner-et-detecter tells you where you stand, criterion by criterion, as many times as you like, and dsoxlab submit k8s-challenge-confiner-et-detecter returns the final result. The grade never looks at the commands you typed or at your files: the lab reads the node and the cluster, opens a shell itself in tresor, then in a Pod of another namespace, before reading the alerts Falco wrote.
Put it into practice
This lab is the challenge itself. It puts you in front of the situation described above and it reads the state of the cluster, as a colleague taking over your work would do.
How is the challenge graded?
The pass mark is 70 points out of 100. Sixteen requirements of equal weight make up the grade, in the order of the statement. Requirements 3, 8 and 14 are blocking: if one of the three is not met, the challenge fails, whatever the total.
If a requirement is not met, dsoxlab check gives the label of the criterion without saying how to fix it. Reread the lesson that covers its subject, fix it, then run dsoxlab check again.
Key points
- The challenge is a final exercise to do alone and without hints: it explains nothing and grades the state of the cluster, not your commands.
- Requirements 3, 8 and 14 are blocking: the write into
/tmpdenied, the client without a sidecar blocked while the client of the mesh gets through, and the Falco alert for a shell incoffre. - A detection rule is checked on both sides: it triggers in the protected namespace and not in another one.
dsoxlab checkshows where you stand as often as you like;dsoxlab submitreturns the result.