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

Back up, restore and put a cluster back in order

By updated

Improve this page

Logo Kubernetes

This challenge checks that you can, on your own, back up etcd, restore the cluster from an old backup, migrate a manifest repository away from removed APIs and renew certificates that are about to expire. It is meant for people who have just followed the lesson Kubernetes cluster PKI: authorities and certificates of the Administer and operate a cluster level. It runs in a dsoxlab virtual machine, on a kubeadm cluster with Kubernetes 1.37, and takes about 50 minutes. It gives no hints and teaches nothing new: it checks what the lessons and their guided labs have already let you practice.

What you will learn

The lab reads the state of etcd, of the cluster, of the manifest repository and of the certificates. It checks that you can:

  • Take a fresh etcd backup before restoring anything.
  • Restore etcd from a backup onto a new data directory, then check that the API and the nodes are healthy.
  • Get deleted objects back with their original identifiers, and notice that an object written after the backup is gone.
  • Migrate manifests to the current APIs and apply them in their namespace.
  • Renew the control plane certificates before they expire.

What should you be able to do before you start?

No step-by-step guide goes with the challenge, and choosing the right tools is part of what it checks. The steps it asks for are taught in three lessons:

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

What does the statement ask for?

Last night, someone deleted the facturation namespace and its tarifs ConfigMap. Since then, an object has been written to the cluster: intrus-apres-sauvegarde, in default. The backup from the day before is in /var/backups/etcd/etcd-veille.db. The audit finds two other debts: the manifest repository ~/depot no longer applies, and a control plane certificate is about to expire. You are on k8s-cp.lab, the control plane, with kubectl, etcdctl, etcdutl and sudo rights.

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

  1. A fresh etcd backup exists in /var/backups/etcd/etcd-fraiche.db, taken before any restore.
  2. etcd runs on a new data directory, restored from the backup of the day before, and the cluster is healthy: the API answers and both nodes are Ready.
  3. facturation and tarifs are back, identical to what they were.
  4. intrus-apres-sauvegarde no longer exists.
  5. The manifests of ~/depot use the current APIs, and their objects exist in the depot namespace, with their settings.
  6. No control plane certificate expires in less than thirty days.

How do you start the challenge and get graded?

You start the lab with dsoxlab run k8s-challenge-sauvegarder-et-restaurer: it puts you in the situation described above. When you want your grade, run dsoxlab check k8s-challenge-sauvegarder-et-restaurer: the command lists the unmet criteria and gives the grade. It never looks at the commands you typed: the lab reads the state of etcd, of the cluster, of the repository and of the certificates.

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%. Six requirements make up the grade, each with the same weight: the fresh backup, the etcd restore and the healthy cluster, the deleted objects back with their original identifiers, the disappearance of the object written after the backup, the migration of the manifest repository, and the certificates. The feedback only lists the unmet criteria, by their label, without saying why.

If a criterion is not met, reread the lesson that teaches it: Back up and restore Kubernetes, Manage Kubernetes API deprecations or Kubernetes cluster PKI: authorities and certificates. 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.
  • The fresh backup is taken before the restore, not after.
  • The pass mark is 70%, and the six requirements weigh the same.
  • dsoxlab check lists the unmet criteria.