BM: Baca dalam Bahasa Melayu
World K4: Notes, Lockers & Packages
Scratch space: emptyDir
You will learn: to let two containers in one pod share files, and when those files vanish.
Checked with Kubernetes 1.37 on 31 Oct 2026
The problem
kind-dev namespace defaultOne tray, two cooks. The cook chops onions. The helper fries them. Each works in a separate box. Where do they pass the onions?
Watch
Tap the line that makes the shared table.
0 of 1 found
An emptyDir: A scratch table on the tray: its containers share it, and it is wiped when the pod goes. is a scratch table on the tray. It starts empty. Both cooks mount it at /table, so they see the same files.
Predict
The tray is deleted. The Deployment makes a new one. What is on the new table?
Pick one answer.
Check
kind-dev namespace defaultls prints nothing. The new tray got a new table. Scratch space only, never your orders.
Check
Do the onions stay or go?
Drag a card into a box. Or tap the card, then tap the box.
You did it!
You can now share scratch files between containers with emptyDir.
Go deeper (optional)
emptyDir: { medium: Memory } keeps the table in RAM. Fast, but its files count toward the container’s memory limit. sizeLimit caps the table. Good uses: a cache, or files a sidecar ships to a log service.
Real rep (optional), on a practice cluster:
Real mission
kubectl apply -f prep.yamlkubectl exec deploy/prep -c cook -- touch /table/onions.txtkubectl exec deploy/prep -c helper -- ls /tablekubectl delete -f prep.yaml
0 of 5 steps done · Your ticks are saved.
Bahasa Melayu
Satu dulang, dua tukang masak. Tukang masak potong bawang. Pembantu menggorengnya. Setiap seorang kerja dalam bekas berasingan. Di mana mereka hulur bawang?
emptyDir ialah meja sementara atas dulang. Ia mula kosong. Kedua-dua tukang masak mount di /table, jadi mereka nampak fail yang sama.
Tukang masak letak bawang atas meja. Kemudian pembantu tengok.
-c cook pilih bekas mana dalam dulang yang jalankan arahan.Dulang itu dipadam. Deployment buat yang baharu. Apa yang ada atas meja baharu?
ls tak cetak apa-apa. Dulang baharu dapat meja baharu. Untuk kerja sementara sahaja, bukan untuk simpan pesanan.
Bawang kekal atau hilang?
Kini anda boleh kongsi fail sementara antara container dengan emptyDir.
You finished this before. Practice is always welcome!
Official docs: Kubernetes: Volumes (emptyDir) · Communicate between containers in the same Pod
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?