liveBook · Manning

Rolling update

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

An application rollout is the controlled, versioned progression of deploying a new workload or application version through successive revisions.

A rolling update replaces the pods of a Deployment as a changed application version is rolled out. It helps minimize downtime: the Deployment creates new pods for the updated version rather than requiring an administrator to replace every pod manually. This is an operational task for keeping a running application current while maintaining availability. section 5.1.1 section 5.0

A Deployment manages pods through ReplicaSets. Each ReplicaSet maintains the desired number of pods for a particular version. Changing a Deployment’s image creates a new ReplicaSet and new pods; the old ReplicaSet can remain visible with zero desired pods after the transition. A RollingUpdate strategy can set max surge and max unavailable values to control how many replicas may be added or unavailable during the update. section 5.1.2

Update an image and verify the rollout

Run `kubectl set image deploy apache httpd=httpd:alpine` to change the `httpd` container’s image. Then run `kubectl get po` to see the new pods and `kubectl get rs` to compare the new ReplicaSet with the old one. Check the Deployment’s `READY`, `UP-TO-DATE`, and `AVAILABLE` columns with `kubectl get deploy`; use `kubectl rollout status deploy apache` to check whether the rollout finishes. section 5.1.1 section 5.1.2 section 5.1.3

root@kind-control-plane:/# kubectl get rs
NAME                DESIRED   CURRENT   READY   AGE
apache-698b8cccbd   5         5         5       28m
apache-74f79bcc68   0         0         0       45m

Compare the ReplicaSets after an update: the new one has five ready pods, while the earlier one has zero desired pods. section 5.1.2

Use revision history when a change needs explanation or recovery:

  • Run `kubectl rollout history deploy apache` to list recorded revisions. Add a change note with `kubectl annotate deploy apache kubernetes.io/change-cause="updated image tag"`. section 5.1.3
  • If the new version introduces a bug, run `kubectl rollout undo deploy apache` to revert. The rollback creates a new revision; revision numbers do not move backward. section 5.1.3
  • For an update that must wait, use `kubectl rollout pause deploy apache`, then `kubectl rollout resume deploy apache` and check its status. section 5.1.3

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Works through image changes, ReplicaSet transitions, revision history, rollback, and status commands; illustrates rollout limits without exploring controller internals.
Examples
Uses an Apache Deployment image change, old and new ReplicaSet listings, and kubectl commands for history, status, pause, resume, and undo.
What it assumes
Assumes a running Kubernetes Deployment; explains its relationship to ReplicaSets and shows how to inspect their state.
What you can do after
Operate/configure it with kubectl to update a Deployment, verify its rollout, inspect revisions, and revert a problematic change.
How it connects
Connects Deployments and ReplicaSets to pod replicas, rollout strategies, revision history, rollback, and high availability.

Also explained in

Compare how 8 books explain rolling update →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.