BM: Baca dalam Bahasa Melayu
World K4: Notes, Lockers & Packages
ConfigMaps: notes on the wall
You will learn: to keep settings in a ConfigMap and read them as env vars or as files.
Checked with Kubernetes 1.37 on 31 Oct 2026
The problem
kind-dev namespace defaultYour shop greets everyone with Selamat datang. The boss wants Jemput makan. Bake a new image for two words? There is a calmer way.
Watch
Tap the two settings on the note.
0 of 2 found
A note on the stall wall holds the settings. The cook reads it, and the recipe never changes. In Kubernetes, that note is a ConfigMap: A note on the stall wall: settings the app reads, kept outside the image..
Try it
Pin up the note from the terminal. Then open the shop.
kind-dev namespace defaultdev-control-planeOpenManagerNo trays here.
dev-workerOpenNo trays here.
dev-worker2OpenNo trays here.
Hint
--from-literal=GREETING=Hai writes one line on the note.Watch
Tap the lines that turn the note into env vars.
0 of 3 found
The tray reads the note two ways. envFrom makes each line an environment variable. The volume makes each line a file in /etc/notes.
Try it
Read the note both ways. First the env var, then the file.
kind-dev namespace defaultdev-control-planeOpenManagerNo trays here.
dev-workerOpen- shop·cprxv
dev-worker2OpenNo trays here.
Hint
Everything after-- runs inside the box.Predict
You change the note to Jemput makan. You wait two minutes. What does the tray see?
Pick one answer.
Check
kind-dev namespace defaultThe file caught up. The env var did not. Restart the trays to read it again: kubectl rollout restart deployment/shop.
Check
Sort each fact: env var or file?
Drag a card into a box. Or tap the card, then tap the box.
You did it!
You can now read settings from a ConfigMap, two ways.
Go deeper (optional)
A ConfigMap holds up to 1 MiB. It is not secret: anyone who can read ConfigMaps sees it. A file mounted with subPath never updates. immutable: true stops changes by accident.
Real rep (optional), on a practice kind cluster only:
Real mission
kubectl config current-contextkubectl create configmap settings --from-literal=GREETING=Haikubectl create deployment shop --image=nginx:1.29-alpinekubectl set env deployment/shop --from=configmap/settingskubectl exec deploy/shop -- printenv GREETINGkubectl delete deployment/shop configmap/settings
0 of 6 steps done · Your ticks are saved.
Bahasa Melayu
Kedai anda sambut semua orang dengan Selamat datang. Bos mahu Jemput makan. Perlu bakar image baharu untuk dua perkataan? Ada cara lebih tenang.
Nota di dinding gerai simpan tetapan. Tukang masak membacanya, dan resepi tak pernah berubah. Dalam Kubernetes, nota itu ialah ConfigMap.
Tampal nota dari terminal. Kemudian buka kedai.
--from-literal=GREETING=Hai tulis satu baris pada nota.Dulang baca nota dengan dua cara. envFrom jadikan setiap baris satu environment variable (pemboleh ubah persekitaran). Volume jadikan setiap baris satu fail dalam /etc/notes.
Baca nota dengan dua cara. Mula-mula env var, kemudian fail.
-- berjalan di dalam bekas.Anda tukar nota kepada Jemput makan. Anda tunggu dua minit. Apa yang dulang nampak?
Fail sudah ikut. Env var belum. Mulakan semula dulang untuk baca semula: kubectl rollout restart deployment/shop.
Asingkan setiap fakta: env var atau fail?
Kini anda boleh baca tetapan daripada ConfigMap, dengan dua cara.
You finished this before. Practice is always welcome!
Official docs: Kubernetes: ConfigMaps · Configure a Pod to use a ConfigMap · kubectl create configmap
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?