World map

 

BM: Baca dalam Bahasa Melayu

World K2: Trays & Orders

Restart or replace?

You will learn: when a container restarts inside its pod, and when the whole pod is replaced.

Checked with Kubernetes 1.37 on 31 Oct 2026

The problem

Two trays had trouble this morning. One kept its name, and its RESTARTS column says 1. The other has a brand-new name. What is the difference?

Pick one answer.

Try it

A container crash. Press “Crash a container”, then run kubectl get pods. Watch the name and RESTARTS: How many times the kubelet started a container again inside the same pod..

You are here: cluster kind-dev namespace default
Stalls: 3. Trays: 3 (3 ready). Waiting for a stall: 0.
dev-control-planeOpenManager

No trays here.

dev-workerOpen
  • shop·7z98n
  • shop·nq25c
dev-worker2Open
  • shop·blz2l
Time: +0s (sped up)

Watch

The board wants 3 and sees 3. Delete a tray: it sees 2 and makes a new pod with a new name.

Want 3. See 3. All good.

Want3written on the order for shop
See33 ready
Do All goodGaps fixed: 0
Stalls: 3. Trays: 3 (3 ready). Waiting for a stall: 0.
dev-workerOpen
  • shop·7z98n
  • shop·nq25c
dev-worker2Open
  • shop·blz2l

Now a whole tray goes. Delete one and watch. The manager makes a new tray with a new name. Kubernetes replaces pods; it does not repair them.

Try it

Restart in place, or a new tray? Sort what happens.

Drag a card into a box. Or tap the card, then tap the box.

      Watch

      You are here: cluster kind-dev namespace default
      Before: 3 pods. After rollout restart: 3 pods with new names, made a few at a time. Terminal output: $ kubectl get pods NAME READY STATUS RESTARTS AGE shop-747bf9cf8-7z98n 1/1 Running 0 22s shop-747bf9cf8-blz2l 1/1 Running 0 22s shop-747bf9cf8-nq25c 1/1 Running 0 22s $ kubectl rollout restart deployment/shop deployment.apps/shop restarted $ kubectl rollout status deployment/shop --timeout=180s Waiting for deployment "shop" rollout to finish: 1 out of 3 new replicas have been updated... Waiting for deployment "shop" rollout to finish: 2 out of 3 new replicas have been updated... Waiting for deployment "shop" rollout to finish: 1 old replicas are pending termination... deployment "shop" successfully rolled out $ kubectl get pods NAME READY STATUS RESTARTS AGE shop-747bf9cf8-7z98n 1/1 Terminating 0 43s shop-75c486fb7d-c7tkw 1/1 Running 0 14s shop-75c486fb7d-wv4zl 1/1 Running 0 7s shop-75c486fb7d-wwmpk 1/1 Running 0 21s

      kubectl rollout restart replaces every tray, a few at a time. Same recipe, fresh trays. Compare the names before and after.

      Check

      You changed a setting the app reads only when it starts. How do all trays get it, with no downtime?

      Pick one answer.

      You did it!

      You can now tell a container restart from a pod replacement.

      Go deeper (optional)

      Restarts wait longer each time: 10 s, 20 s, 40 s, up to 5 minutes. After 10 minutes without a crash, the wait resets. A new pod also gets a new IP address. That is why Services exist (World K3).

      Real rep (optional): on a throwaway cluster, watch kubectl get pods -w during a rollout restart.