This challenge checks that you can, on your own, use Hubble to find the flow a network policy refuses, have the metrics count it and log it on the node, without allowing the refused flow. It is meant for people who have just followed the lesson Hubble: observe, measure and audit network flows. It runs in a dsoxlab virtual machine, on a Cilium cluster with Kubernetes 1.37, and takes about 45 minutes. It gives no hints and teaches nothing new: it checks what the lesson and its guided lab have already let you practice.
What you will learn
The lab reads the ConfigMap you write, reads the node's metric twice, twelve seconds apart, and reads the exported log. It checks that you can:
- Find the refused client Pod, the Pod it can no longer reach and the node whose Cilium agent sees the refusal.
- Record these findings in a ConfigMap.
- Make the
hubble_drop_totalmetric name the source Pod and the destination Pod of a refusal. - Log, in a file on the node, only the refused flows of one namespace, without mixing in other verdicts.
- Leave the network policy in place and keep the permitted flow open.
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 two lessons:
- Hubble: observe, measure and audit network flows: find a refusal with
hubble observe, read the drop metrics and export the refusals to a log on the node. The guided labk8s-auditer-les-flux-avec-hubblelets you practice that whole path. - Kubernetes NetworkPolicies: what an ingress or egress policy refuses, to understand the refusal Hubble logs.
If one of these points feels unclear, reread the lesson before you start.
What does the statement ask for?
In the livraison namespace of the Cilium cluster, four clients (preparation, expedition, facturation and retours) call two services, stock and tarif, every two seconds. The Pods are spread over net-w1.lab and net-w2.lab. Since the last deployment, one client can no longer reach one of the two services. Nobody knows which one, or towards what.
The security team does not want the network policies touched: it wants the refusal audited. Another namespace of the cluster refuses flows too, and that is not your concern. You are on the control plane net-cp.lab, with kubectl and helm. The cluster runs without kube-proxy, with Cilium 1.20.5, Hubble and its metrics enabled (port 9965 of each node). Cilium 1.20.5 declares support for Kubernetes 1.33 to 1.36, and this cluster runs 1.37.
The statement says what must be true at the end, never how to get there. The refused client, its destination and therefore the node are drawn at random during the preparation:
- A ConfigMap
refusinlivraisonholds three keys:source, the name of the refused client Pod,destination, the name of the Pod it can no longer reach, andnoeud, the node whose Cilium agent sees the refusal. This requirement is blocking. - On that node, the
hubble_drop_totalmetric carries a series that names both the source Pod and the destination Pod of the refused flow, and it keeps growing: the refusal stays in place, and the refused client still reaches the service it is allowed. This requirement is blocking. - On that same node, the refused flows of the
livraisonnamespace are logged in/var/run/cilium/hubble/refus-livraison.log, and this file holds nothing else: neither other verdicts, nor the refusals of other namespaces.
How do you start the challenge and get graded?
The refused client is drawn at random when the lab is prepared. You start it with dsoxlab run k8s-challenge-retrouver-les-flux-refuses. When you want your grade, run dsoxlab check k8s-challenge-retrouver-les-flux-refuses: the command lists the criteria that are not met and gives the grade. It never looks at the commands you typed: the lab reads your ConfigMap, reads the metric from the metrics port of the node of the refusal twelve seconds apart, then reads the log exported on that node.
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%, which means meeting all three requirements of the statement. Requirements 1 and 2 are blocking: if one of the two 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 Hubble: observe, measure and audit network flows, which teaches each of them, 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 1 and 2 are blocking: the ConfigMap that names the refused flow, and the metric that names it and keeps growing.
- The refused client, its destination and the node are drawn at random: read them in the cluster instead of assuming them.
dsoxlab checklists the criteria that are not met.