Certified Kubernetes Administrator (CKA) · Section 2 · 15% of the exam
Use ConfigMaps and Secrets to configure applications
One of the objectives of the Certified Kubernetes Administrator (CKA) exam, in the section “Workloads and Scheduling”. Here is what it covers, the points to remember and a question to try.
What it covers
ConfigMaps and Secrets keep configuration out of container images. This lesson shows how to create them, inject them as environment variables or files, what updates automatically and what does not, and the limits of Secret protection.
Points to remember
- ConfigMap = non-confidential configuration; Secret = confidential, base64-encoded, not encrypted by default.
- Both are namespaced, limited to 1 MiB, and usable only by Pods in the same namespace.
--from-literal,--from-file(key = file name) and--from-env-filebuild ConfigMaps;create secret generic|tls|docker-registrybuilds Secrets.- Environment variables are read once at container start and never refresh.
- Volume-mounted keys update eventually;
subPathmounts never update.
Try a question
A Deployment cannot pull an image from a private registry, and the Pods show ErrImagePull. Which solution follows Kubernetes practice?
- ACreate an Opaque Secret with the registry password and expose it as an environment variable in the Pod
- BPut the registry password into a ConfigMap and mount it as a file into every container
- CCreate a tls Secret from the registry certificate and mount it into the Pod as a volume
- DCreate a docker-registry Secret and list it in imagePullSecrets of the Pod or ServiceAccount
Show the answer
D. Image pull credentials come from a kubernetes.io/dockerconfigjson Secret, created with kubectl create secret docker-registry and listed under imagePullSecrets.
Written for practice in the style of the exam: never a question from the real exam.
In the course
The lesson ConfigMaps and Secrets teaches this objective (about 40 minutes), and 8 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.