Lesson  in  Exam 1 — Cluster Basics, Storage & Scheduling

Question 1: Contexts

Extract context names, the current context, and a user's decoded client certificate out of a provided kubeconfig file.

You're asked to extract the following information out of the kubeconfig file ~/kubeconfig:

  • Write all kubeconfig context names into ~/contexts, one per line.
  • Write the name of the current context into ~/current-context.
  • Write the client-certificate-data of user ops-auditor@internal, base64-decoded, into ~/cert.
Hint 1

kubectl --kubeconfig <path> config get-contexts -o name and kubectl --kubeconfig <path> config current-context do most of the work for you.

Hint 2

For the certificate, kubectl config view --raw -o jsonpath=... gets you the still-base64-encoded value — pipe it through base64 -d.