This challenge checks that you can, on your own, compose a Deployment whose Pods each bring together an init container, a native sidecar and a server, with volumes whose access and size are imposed. It is meant for people who have just followed the lessons on application volumes and on init containers and sidecars. It runs in a dsoxlab virtual machine, on a kubeadm cluster with Kubernetes 1.37, and takes about 40 minutes. It gives no hints and teaches nothing new: it checks what the lessons and their guided lab have already let you practice.
What you will learn
The lab reads the Deployment and its Pods, loads the page of each Pod, then looks for a request in the logs of the sidecar. It checks that you can:
- Write the home page of a Pod with an init container, from a value read in a ConfigMap.
- Start a native sidecar before the server and have it relay every access in its own logs.
- Mount a volume read-only in the server, while the init container writes it.
- Share a size-capped temporary volume between the server and the sidecar, and between them only.
- Get two ready replicas, with no restart at all.
What should you be able to do before you start?
No step-by-step guide goes with the challenge, and choosing the right fields is part of what it checks. Everything it asks is taught in four lessons:
- Kubernetes application volumes: declare a volume, mount it read-only or not, and cap its size. Its guided lab
ckad-volumes-partage-entre-conteneurslets you practice sharing a volume between two containers; - Init containers and sidecars: prepare a Pod with an init container and accompany it with a native sidecar;
- Kubernetes ConfigMaps: read a configuration value from a Pod;
- Kubernetes Deployments: run a number of replicas of the same Pod.
If one of these points feels unclear, reread the lesson before you start.
What does the statement ask for?
The photo team wants to publish its showcase on the cluster, in the photo namespace. The vitrine ConfigMap holds, under the titre key, the title of the current exhibition. Nothing else exists. You are on the control plane, with kubectl configured. The server uses the image nginx:1.30.5@sha256:9bf97bd7714f5e24c1ccd545ecb9eb5435cb6d109c97cebb15e7e455e0239edb, and the helper tasks the image busybox:1.38.0@sha256:a46257e06c82ad85242d0d38077d0a52d9896389ca60a1a59d3463db586e5fa4.
The statement says what must be true at the end, never how to get there. It asks for a galerie Deployment with two replicas, each Pod bringing together three containers:
- An init container
generer-pageruns to the end before the others start and writes the home page, which holds the title from thevitrineConfigMap, into apagevolume. Each Pod serves this page on its port 80. This requirement is blocking. - A native sidecar
relais-journauxstarts before the server, runs alongside it and shows in its own logs every access the server receives. This requirement is blocking. - The server
serveurmounts thepagevolume read-only.
The server's access log goes through a temporary journaux volume, capped at 32Mi, mounted by the server and by the sidecar, and by them only. Both replicas are ready, with no restart at all.
How do you start the challenge and get graded?
The lab prepares the cluster and draws at random the title of the exhibition, then reads the state of the cluster when you ask for your grade. You start it with dsoxlab run k8s-challenge-composer-un-pod-multi-conteneurs. The command dsoxlab check k8s-challenge-composer-un-pod-multi-conteneurs tells you where you stand, requirement by requirement, as many times as you like. The grade never looks at the commands you typed: it reads the Deployment and its Pods, loads the page of each Pod, then sends a request to a path drawn at random, which must show up in the logs of the sidecar.
Put it into practice
This lab is the challenge itself. It puts you in front of the situation described above and it is validated on the state of the cluster, as a colleague taking over your work would do.
How is the challenge graded?
The pass mark is 80%. Five criteria make up the grade: the page prepared by the init container and served by each Pod, the native sidecar that relays the accesses, the volume mounted read-only in the server, the log volume capped at 32Mi, and the two replicas ready with no restart. Requirements 1 and 2 are blocking: if either one is not met, the challenge fails, whatever the total.
If a criterion resists, reread the lesson that teaches it, in the list of the prerequisites section, 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 1 and 2 are blocking: the page written by the init container, and the native sidecar that relays the accesses.
- The title of the exhibition is drawn at random: read it in the
vitrineConfigMap instead of assuming it. dsoxlab checkshows where you stand as often as you like.