BM: Baca dalam Bahasa Melayu
World K2: Trays & Orders
Rolling updates and rollout undo
You will learn: to ship a new version with no downtime, and to undo a bad one fast.
Checked with Kubernetes 1.37 on 31 Oct 2026
The problem
Lunch rush. The new menu, nginx 1.30, is ready. If you close the stall to swap trays, hungry customers walk away. What do you want?
Pick one answer.
Watch
kind-dev namespace defaultkubectl set image writes a new image into the order. A rolling update: Swap the copies one at a time, like changing cooks one by one. The stall never closes. starts. One new tray comes in, one old tray leaves, again and again.
Try it
Your turn. Ship nginx 1.30 to the shop. Then wait for the rollout to finish.
kind-dev namespace defaultWant 3. See 3. All good.
dev-control-planeOpenManagerNo trays here.
dev-workerOpen- shop·55jjq
- shop·z89h7
dev-worker2Open- shop·5kcvh
Hint
kubectl set image deployment/shop web=nginx:1.30-alpine, then kubectl rollout status deployment/shop.Watch
kind-dev namespace defaultEach new template gets a revision: A numbered version of a Deployment's pod template. rollout undo goes back to one. number. The old ReplicaSet stays, empty, so going back is quick.
Predict
A teammate ships nginx:1.299. That tag does not exist. What happens to the 3 old trays?
Pick one answer.
Try it
It happened. The new tray shows ErrImagePull, then ImagePullBackOff. Plain words: that image cannot be fetched. Undo the rollout.
kind-dev namespace defaultWant 3. See 4. Remove 1.
dev-control-planeOpenManagerNo trays here.
dev-workerOpen- shop·2g4l2
- shop·v62jm
dev-worker2Open- shop·fxdpqImagePullBackOff
- shop·57nrg
Hint
kubectl rollout undo deployment/shop goes back one revision.Check
Build the command that goes back to revision 1 exactly.
Tap the pieces in the right order.
You did it!
You can now ship a new version with no downtime, and undo a bad one.
Go deeper (optional)
After rollout undo, kubectl prints a Warning: the cluster changed, but your file did not. Fix the file in Git too, or the next apply brings the bug back. By default, a rollout adds up to 25% extra trays. It takes away at most 25%.
Real rep (optional): on a throwaway cluster, set a bad image, then undo it.
Bahasa Melayu
Waktu puncak tengah hari. Menu baharu, nginx 1.30, sudah siap. Kalau anda tutup gerai untuk tukar dulang, pelanggan lapar akan pergi. Apa yang anda mahu?
kubectl set image tulis image baharu dalam pesanan. Rolling update bermula: satu dulang baharu masuk, satu dulang lama keluar, berulang-ulang.
Giliran anda. Hantar nginx 1.30 ke kedai. Kemudian tunggu rollout tamat.
kubectl set image deployment/shop web=nginx:1.30-alpine, kemudian kubectl rollout status deployment/shop.Setiap templat baharu dapat nombor revision (semakan). ReplicaSet lama kekal, kosong, supaya mudah untuk kembali.
Rakan sepasukan hantar nginx:1.299. Tag itu tak wujud. Apa jadi pada 3 dulang lama?
Ia berlaku. Dulang baharu tunjuk ErrImagePull, kemudian ImagePullBackOff. Maksudnya: image itu tak boleh diambil. Undur rollout.
kubectl rollout undo deployment/shop kembali satu revision.Bina arahan yang kembali tepat ke revision 1.
Kini anda boleh hantar versi baharu tanpa henti, dan undur versi yang rosak.
You finished this before. Practice is always welcome!
Official docs: Kubernetes: Updating a Deployment · kubectl rollout · kubectl set image
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?