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

Migrate removed APIs

By updated

Improve this page

Logo Kubernetes

This challenge checks that you can, on your own, find the manifests of a repository that use an API Kubernetes has removed, migrate them without changing what they describe and apply the repository. It is meant for people who have just followed the lesson Manage Kubernetes API deprecations. 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 lesson and its guided lab have already let you practice.

What you will learn

The lab compares your report with the files of the repository, submits each file to the API server, replays kubectl diff and compares the objects with what the original manifests described. It checks that you can:

  • Spot the manifests that use a removed API.
  • Record each of them in a report, with the removed API and the replacement API.
  • Migrate the manifests without deleting any of them.
  • Keep for each object what the original manifest described: a migration changes the API, not the intent.
  • Apply the migrated repository and check with kubectl diff that no difference remains.

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 two lessons:

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

What does the statement ask for?

The platform team is preparing the next upgrade of the cluster. Its manifest repository, ~/plateforme, is several years old: some of the files use APIs that Kubernetes has removed, and nobody knows which ones. The plateforme namespace exists, and nothing is applied in it. You are on the control plane, with kubectl configured.

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

  1. A report ~/plateforme/rapport.txt names, one line per file, each manifest that used a removed API, in the form <file>;<removed API>;<replacement API>, for example example.yaml;batch/v1beta1;batch/v1. The files that used no removed API do not appear in it. This requirement is blocking.
  2. All the manifests of the repository are still there, and the API server accepts them all. A file is migrated, never deleted. This requirement is blocking.
  3. The migrated repository is applied: kubectl diff on the repository finds no difference.
  4. The objects describe exactly what the inherited manifests described: same values, same targets. A migration changes the API, not the intent.
  5. The registre Deployment runs with its two replicas.

How do you start the challenge and get graded?

The lab prepares the cluster and the repository, then reads their state again when you ask for your grade. You start it with dsoxlab run k8s-challenge-migrer-les-api-retirees. The dsoxlab check k8s-challenge-migrer-les-api-retirees command tells you where you stand, criterion by criterion, as many times as you like. The files that use a removed API are drawn at random when the lab is prepared: do not count on those of a previous attempt. The grade never looks at the commands you typed.

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 and of the repository, as a colleague taking over your work would do.

How is the challenge graded?

The pass mark is 80%. Five requirements make up the grade: the report, the acceptance of all the manifests by the API server, the repository applied with no difference, the objects that describe what the original manifests described, and the registre Deployment with two replicas. Requirements 1 and 2 are blocking: if one of the two is not met, the challenge fails, whatever the total.

If a criterion resists, reread the lesson Manage Kubernetes API deprecations, which teaches each of them, 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 and of the repository, not your commands.
  • Requirements 1 and 2 are blocking: the report, and the acceptance of all the manifests by the API server.
  • A file is migrated, never deleted, and a migration changes the API without changing what the object describes.
  • dsoxlab check shows where you stand as often as you like.