study.

Deployments and Rolling Updates · CKA

Manage replicas and rollout history to operate applications reliably.

← CKA

Learn with progress and quizzes

First, understand the concepts.

Deployment

A Deployment manages ReplicaSets and performs a rollout when its Pod template changes. Changing only the replica count does not create a new rollout revision.

Rollback

Use rollout status to track progress and history to inspect revisions. The undo command restores the Pod template from a previous revision.

Why it matters

Replacing three web replicas at once can remove all serving backends. Rolling updates control both replacement pace and readiness.

Work through the reasoning

Follow ownership and revisions

A Deployment owns ReplicaSets, which own Pods. A Pod-template change such as an image update differs from adjusting replicas. Inspect history to identify retained templates.

Read the availability budget

maxSurge allows extra replicas during replacement; maxUnavailable limits unavailable ones. A new Pod that never becomes ready can block progress, so read rollout status alongside events.

Learn by doing.

You need kubectl and access to your own practice Kubernetes cluster. Each lab is independent. Check your current context first, then run the commands in your own terminal.

Create a Deployment, scale it to three replicas, update its image, and roll it back.

kubectl create namespace study-deploy --dry-run=client -o yaml | kubectl apply -f -
kubectl create deployment web --image=nginx:stable -n study-deploy --dry-run=client -o yaml | kubectl apply -f -
kubectl scale deployment web --replicas=3 -n study-deploy
kubectl set image deployment/web nginx=nginx:alpine -n study-deploy
kubectl rollout status deployment/web -n study-deploy --timeout=120s
kubectl rollout history deployment/web -n study-deploy
kubectl rollout undo deployment/web -n study-deploy

How to check your result

Run kubectl get deployment web -n study-deploy to check that three replicas are ready, and verify that the image has been rolled back.

Apply what you learned

New-image Pods never become Ready while old Pods still respond. What should you inspect before deleting the old ones?

Reveal the reasoning after trying

Check the new ReplicaSet’s image, readiness, events, and update settings. Preserve functioning replicas while investigating. If needed, restore a previous revision, then verify rollout completion and real application responses.

Ready to check your understanding?

Which change triggers a new Deployment rollout?

  1. Changing only replicas
  2. Changing the image in the Pod template
  3. Listing Deployments
  4. Reading logs
Reveal the reasoning after trying

Changing the image in the Pod template

A change to .spec.template triggers a rollout. Changing only replicas scales the workload up or down.

Kubernetes documentation