Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

Make admission refuse non-compliant Pods

By updated

Improve this page

Logo Kubernetes

This challenge checks that you can, on your own, make the cluster refuse what breaks a rule: apply the restricted standard to a namespace, rebuild a privileged Pod without its flaws and set a native admission policy. It is meant for people who have just followed the module on confining and admitting Pods, starting from the lesson Pod Security Standards. It runs in a dsoxlab virtual machine, on a kubeadm cluster with Kubernetes 1.37, and takes about 45 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 namespaces, the admitted Pods and the admission policy, and submits real Pods to the cluster. It checks that you can:

  • Make a namespace apply the restricted standard in its three modes.
  • Write a Pod that meets the requirements of that standard.
  • Rebuild a Pod that accumulates flaws, under another name, then remove the original.
  • Bind a native admission policy in deny mode, not in mere warning mode.
  • Refuse the images named by a tag in a namespace, accept those pinned by digest, and leave the other namespaces alone.

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 four lessons of the module:

If one of these points feels unclear, reread the lesson before you start.

What does the statement ask for?

The kubeadm cluster admits everything. The security team wants it to refuse what breaks its rules, at creation time, rather than rely on everyone's discipline. Four namespaces are ready. You are on the control plane, with kubectl configured.

  • vitrine applies no security standard. A Pod named catalogue must run there: busybox:1.37, running sleep.
  • paiement runs caisse, a Pod that nobody reported and that accumulates flaws. It must be rebuilt cleanly under the name caisse-durcie, so that it does the same thing.
  • production accepts any image, including one named by a plain tag. A Pod conforme already runs there, pinned by its digest: do not touch it.
  • recette is a test namespace. Nothing is asked of it, and nothing must change there.

The statement says what must be true at the end, never how to get there:

  1. vitrine declares the restricted standard in all three modes: enforce, warn and audit.
  2. The Pod catalogue runs in vitrine.
  3. catalogue meets the four requirements of the standard: it runs as non root, cannot escalate its privileges, has dropped its capabilities and declares a seccomp profile.
  4. Admission in vitrine refuses a Pod that breaks the standard and accepts a compliant Pod. This requirement is blocking.
  5. caisse-durcie runs in paiement.
  6. caisse-durcie keeps none of the flaws you find in caisse.
  7. The original Pod caisse no longer exists.
  8. The container of caisse-durcie no longer sees the host's processes and does not run as root.
  9. A native admission policy, evaluated by the API server itself, is bound in deny mode, and not only in warning mode.
  10. In production, a Pod whose image is named by a tag is refused, a Pod whose image is pinned by its digest is accepted, and the other namespaces, recette first, are not affected. This requirement is blocking.

How do you start the challenge and get graded?

The lab prepares the cluster and the four namespaces, then reads the state of the cluster when you ask for the grade. You start it with dsoxlab run k8s-challenge-faire-refuser-par-admission. Two commands are then used: dsoxlab check k8s-challenge-faire-refuser-par-admission tells you where you stand, criterion by criterion, as many times as you like, and dsoxlab submit k8s-challenge-faire-refuser-par-admission returns the final result. The lab never looks at the commands you typed: it reads the admitted Pods, enters the new Pod to count what it sees, and submits real Pods. In vitrine, it creates nothing. In production and recette, it creates a Pod then removes it at once.

Put it into practice

This lab is the challenge itself. It puts you in front of the situation described above and it is graded on 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. Ten requirements of equal weight make up the grade, in the order of the statement. Requirements 4 and 10 are blocking: if one of the two is not met, the challenge fails, whatever the total.

If a criterion resists, dsoxlab check gives its label without saying how to fix it. Reread the lesson that covers its subject, Pod Security Standards or ValidatingAdmissionPolicy, 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 4 and 10 are blocking: the refusal of the non-compliant Pod in vitrine, and the refusal of images named by a tag in production.
  • A refusal is checked by submitting a Pod, not by reading a configuration: the lab does it for you.
  • dsoxlab check lists the criteria that are not met; dsoxlab submit returns the result.