BM: Baca dalam Bahasa Melayu
World K4: Notes, Lockers & Packages
Kustomize bases and overlays
You will learn: to run one app in two kitchens with a base and overlays, using kubectl apply -k.
Checked with Kubernetes 1.37 on 31 Oct 2026
The problem
kind-dev namespace defaultSame shop, two kitchens. Dev wants 1 tray and chatty logs. Prod wants 3 trays and quiet logs. Copy all the YAML twice? Then you fix every bug twice.
Watch
This is overlays/prod/kustomization.yaml. Tap the three lines that make prod different.
0 of 3 found
Kustomize: One base recipe plus a sticky note per kitchen. Built into kubectl (kubectl apply -k). keeps one base recipe. Each overlay: The sticky note for one kitchen: it changes the base for dev, staging or prod. is a sticky note on top, for one kitchen. The base never changes.
Try it
Preview prod first. This only prints YAML. Nothing reaches the cluster.
kind-dev namespace defaultdev-control-planeOpenManagerNo trays here.
dev-workerOpenNo trays here.
dev-worker2OpenNo trays here.
Hint
kubectl kustomize <folder> builds the overlay and prints it.Predict
You just ran kubectl kustomize overlays/prod. How many prod trays are running now?
Pick one answer.
Try it
Now open the prod kitchen for real.
kind-dev namespace defaultdev-control-planeOpenManagerNo trays here.
dev-workerOpenNo trays here.
dev-worker2OpenNo trays here.
Hint
-k means: build this folder with Kustomize, then apply it.Check
kind-dev namespace defaultOne base, two kitchens. Dev says debug, prod says warn. The patch changed one line of the note.
Check
Build the command that opens the dev kitchen.
Tap the pieces in the right order.
You did it!
You can now run one app in many kitchens with Kustomize.
Go deeper (optional)
Overlays can do more: images: swaps a tag, namePrefix: renames things, labels: adds labels. configMapGenerator adds a hash to the note’s name, so a change rolls the trays. kubectl diff -k overlays/prod shows changes first.
Real rep (optional), on a practice kind cluster:
Real mission
kubectl kustomize overlays/prodkubectl apply -k overlays/prodkubectl diff -k overlays/prodkubectl delete -k overlays/prod
0 of 5 steps done · Your ticks are saved.
Bahasa Melayu
Kedai sama, dua dapur. Dev mahu 1 dulang dan log yang banyak cakap. Prod mahu 3 dulang dan log yang senyap. Salin semua YAML dua kali? Nanti setiap pepijat perlu dibaiki dua kali.
Kustomize simpan satu resepi asas (base). Setiap overlay ialah nota lekat di atasnya, untuk satu dapur. Base tak pernah berubah.
Pratonton prod dahulu. Ini cuma cetak YAML. Tiada apa sampai ke kluster.
kubectl kustomize <folder> bina overlay dan cetaknya.Anda baru jalankan kubectl kustomize overlays/prod. Berapa dulang prod sedang berjalan sekarang?
Sekarang buka dapur prod betul-betul.
-k bermaksud: bina folder ini dengan Kustomize, kemudian apply.Satu base, dua dapur. Dev kata debug, prod kata warn. Patch itu cuma ubah satu baris nota.
Bina arahan yang buka dapur dev.
Kini anda boleh jalankan satu aplikasi di banyak dapur dengan Kustomize.
You finished this before. Practice is always welcome!
Official docs: Declarative management with Kustomize · kubectl kustomize
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?