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

Place, cap and size

By updated

Improve this page

Logo Kubernetes

This challenge checks that you can, on your own, reserve a node for an application, place other applications by affinity and by spreading, cap a namespace and scale an application on its CPU load. It is meant for people who have just followed the lessons of the Scheduling and capacity module, including Advanced scheduling: Affinity, Taints, Tolerations and Topology Spread. It runs in a dsoxlab virtual machine, on a kind cluster with Kubernetes 1.37, and takes about 50 minutes. It gives no hints and teaches nothing new: it checks what the lessons of the module have already let you practice.

What you will learn

The lab reads the nodes, the Pods and the nodes where they run, the descriptions of the applications, the quota, the LimitRange and the HPA. It checks that you can:

  • Reserve a node with a taint and a label.
  • Run an application on that node through a toleration and a selector, and keep the ordinary application off it.
  • Place an application with required and preferred node affinity.
  • Spread the replicas of an application across different nodes.
  • Cap a namespace with a ResourceQuota and give its containers default values with a LimitRange.
  • Scale an application with an HPA that reads a metric and goes beyond its minimum under load.

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:

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

What does the statement ask for?

You are connected with kubectl configured on the kind cluster capacite, which has one control plane and three workers. The atelier namespace runs four applications, deployed without any placement rule or resource:

  • rendu, the render engine, which must have a node to itself;
  • accueil, the ordinary front page, which must follow its load;
  • stockage, which needs a fast disk;
  • galerie, two replicas that must survive the loss of a node.

The namespace has no ceiling and gives its containers no default value. A metrics-server answers: kubectl top pods works.

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

  1. The node capacite-worker3 is reserved: it carries the taint dedie=calcul:NoSchedule and the label dedie=calcul.
  2. rendu runs on capacite-worker3, because it tolerates the taint and selects that node. accueil runs elsewhere. This requirement is blocking.
  3. stockage asks for a required node affinity on disque=ssd and a preferred one, of weight 50, for the zone zone-b (topology.kubernetes.io/zone). The node capacite-worker2 carries the label disque=ssd, and stockage runs on it.
  4. The replicas of galerie run on different nodes, and its description guarantees it.
  5. A ResourceQuota caps atelier at 2 CPU and 2Gi of requests, 4 CPU and 4Gi of limits, and 15 Pods. A Pod that asks for more is refused, which a server-side dry run shows. This requirement is blocking.
  6. A LimitRange gives every container that declares nothing a request of 100m CPU and 128Mi, and a limit of 200m CPU and 256Mi: a Pod without requests is accepted, and comes back completed.
  7. An HPA scales accueil between 2 and 5 replicas, at 50% average CPU utilization, and it reads a value: its target is not <unknown>.
  8. Under load, the HPA takes accueil beyond its minimum.

How do you start the challenge and get graded?

The lab prepares the cluster and reads its state again when you ask for your grade. You start it with dsoxlab run k8s-challenge-placer-et-plafonner. Two commands are then used: dsoxlab check k8s-challenge-placer-et-plafonner tells you where you stand, criterion by criterion, as many times as you like, and dsoxlab submit k8s-challenge-placer-et-plafonner returns the final result. The grade never looks at the commands you typed.

The tests read where the Pods really run and what their descriptions ask, and they submit test Pods in server-side dry run, which creates nothing. For requirement 8, the test generates the load itself: it runs a computation loop in every Pod of accueil for about two minutes, and waits at most two minutes for the Deployment to grow. You have nothing to start for it, and a check can last that long.

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 70 out of 100. The eight requirements weigh the same. Requirements 2 and 5 are blocking: if one of the two is not met, the challenge fails, whatever the total. Passing the others does not make up for failing them.

The dsoxlab check output is limited to the list of unmet criteria, by their label, and the grade: no message says why. If a criterion resists, reread the lesson that teaches it, among those in the list at the start, 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 2 and 5 are blocking: the reserved application on its node, with the ordinary application elsewhere, and the ceiling of the namespace.
  • The scaling test generates its own load: a check can last about four minutes.
  • dsoxlab check shows where you stand as often as you like; dsoxlab submit returns the result.