teluzia.Cloud Engineer · Day 118
CHAPTER 17 · KUBERNETES FUNDAMENTALS

Rolling updates, rollbacks and troubleshooting

4–5 hours including independent practice3 topics
LET’S MAKE THIS SIMPLE

What you’re learning today

A rolling update replaces workers gradually; a rollback selects an earlier staffing plan, but neither automatically restores changed business data. Deployments update Pod templates through ReplicaSets. maxSurge controls temporary extra replicas and maxUnavailable limits reduced available capacity. Available capacity still depends on readiness and resource supply. A new image that cannot start can stall the rollout while some old replicas remain. Rollout history records Deployment revisions, subject to retention. Undo restores a previous Pod template rather than reverse all external effects, database migrations, or ConfigMap changes. Capture immutable image identity and configuration dependencies for reliable release reproduction.

Think of it this way

A rolling update replaces workers gradually; a rollback selects an earlier staffing plan, but neither automatically restores changed business data.

TOPIC 01 / 03Step by step

Rolling update strategy

Deployments update Pod templates through ReplicaSets. maxSurge controls temporary extra replicas and maxUnavailable limits reduced available capacity. Available capacity still depends on readiness and resource supply. A new image that cannot start can stall the rollout while some old replicas remain. For example, a two-replica app with maxUnavailable 0 needs enough spare capacity to add a new ready replica before removing an old one.

WORKED EXAMPLE
A two-replica app with maxUnavailable 0 needs enough spare capacity to add a new ready replica before removing an old one.

A Deployment changes its Pod template to a new image. A new ReplicaSet creates Pods while old replicas are reduced according to the rolling strategy. maxSurge allows additional replicas, and maxUnavailable limits unavailable capacity. New Pods must become suitably ready before the rollout can meet availability goals; sufficient node resources and image access are prerequisites.

A rollout advances to a new template. Surge is temporary extra replica capacity. Availability depends on observed readiness and relevant timing. A strategy requesting zero unavailable replicas can stall when there is no room for a replacement. Conversely, allowing too many unavailable replicas can interrupt users. Rolling behavior cannot guarantee application compatibility, database consistency, or successful external effects. Observe updated and available counts, bounded rollout status, events, and actual requests. A valid image string and accepted template merely begin the process; they do not establish a completed release.

Why this matters

A two-replica app with maxUnavailable 0 needs enough spare capacity to add a new ready replica before removing an old one.

A common trap

Do not overlook this operational distinction: A new image that cannot start can stall the rollout while some old replicas remain.

MAKE IT VISIBLE

Rehearse a release decision

A RELEASE IS A SERIES OF DECISIONS

Can you ship without losing the old version?

This browser simulation shows why tests, plan review, health validation and rollback belong in a pipeline.

1Tests
2Plan review
3Deploy
4Health check
Currently serving: v1

Ready to run

Read all topics in this lesson

A complete reference to revisit alongside the guided steps above.

Rolling update strategy

Deployments update Pod templates through ReplicaSets. maxSurge controls temporary extra replicas and maxUnavailable limits reduced available capacity. Available capacity still depends on readiness and resource supply. A new image that cannot start can stall the rollout while some old replicas remain. For example, a two-replica app with maxUnavailable 0 needs enough spare capacity to add a new ready replica before removing an old one.

WORKED EXAMPLE
A two-replica app with maxUnavailable 0 needs enough spare capacity to add a new ready replica before removing an old one.

A Deployment changes its Pod template to a new image. A new ReplicaSet creates Pods while old replicas are reduced according to the rolling strategy. maxSurge allows additional replicas, and maxUnavailable limits unavailable capacity. New Pods must become suitably ready before the rollout can meet availability goals; sufficient node resources and image access are prerequisites.

A rollout advances to a new template. Surge is temporary extra replica capacity. Availability depends on observed readiness and relevant timing. A strategy requesting zero unavailable replicas can stall when there is no room for a replacement. Conversely, allowing too many unavailable replicas can interrupt users. Rolling behavior cannot guarantee application compatibility, database consistency, or successful external effects. Observe updated and available counts, bounded rollout status, events, and actual requests. A valid image string and accepted template merely begin the process; they do not establish a completed release.

Why this matters

A two-replica app with maxUnavailable 0 needs enough spare capacity to add a new ready replica before removing an old one.

A common trap

Do not overlook this operational distinction: A new image that cannot start can stall the rollout while some old replicas remain.

History and rollback

Rollout history records Deployment revisions, subject to retention. Undo restores a previous Pod template rather than reverse all external effects, database migrations, or ConfigMap changes. Capture immutable image identity and configuration dependencies for reliable release reproduction. For example, kubectl rollout undo deployment/web restores a prior template, but a separately edited Secret remains changed.

WORKED EXAMPLE
kubectl rollout undo deployment/web restores a prior template, but a separately edited Secret remains changed.

After a new template fails, inspect rollout history and select the known prior revision. Deployment undo restores that previous template, causing reconciliation toward its replica configuration. It does not automatically restore a separately changed Secret, external API behavior, or database schema. The old image may therefore remain incompatible with current data even when its Pods start successfully.

A revision records a Deployment template history entry. Rollback selects an earlier desired template. Compatibility determines whether it can operate against remaining dependencies and state. History retention limits which templates are available. Record image digests and relevant configuration versions, not merely a mutable tag whose content may have moved. Validate the recovered request path and data behavior after undo. Stateful changes require their own recovery or forward-fix procedure. A rollback command completing successfully is useful orchestration evidence, but service recovery requires observed healthy behavior under the actual current environment.

Why this matters

kubectl rollout undo deployment/web restores a prior template, but a separately edited Secret remains changed.

A common trap

Do not overlook this operational distinction: Capture immutable image identity and configuration dependencies for reliable release reproduction.

Troubleshooting from events

Investigate rollout status, Pod status, events, logs, and ready endpoints in a deliberate sequence. Image pull errors, scheduling failures, crash loops, and failed probes indicate different boundaries. Use bounded rollout timeouts and preserve evidence before blindly retrying deployment actions. For example, a nonexistent image tag yields image-pull events, while a process exiting repeatedly produces restart evidence and possibly CrashLoopBackOff.

WORKED EXAMPLE
A nonexistent image tag yields image-pull events, while a process exiting repeatedly produces restart evidence and possibly CrashLoopBackOff.

A rollout timeout occurs. First inspect whether new Pods were scheduled. If not, events may show insufficient capacity or constraints. If scheduled but not started, inspect image-pull evidence. If running then exiting, inspect current and previous logs and restart counts. If stable but unready, inspect probe results and endpoint membership.

Pending indicates an incomplete Pod lifecycle stage, not one universal cause. ImagePullBackOff reflects repeated retrieval failure behavior. CrashLoopBackOff reflects repeated container failure and restart backoff. Those labels guide investigation but do not replace the detailed reason. Preserve evidence before deleting every failed Pod, since deletion can remove useful context. Bound rollout waiting and escalate with the observed boundary. Opening network access or increasing replicas blindly can fail to address a misspelled image tag or broken command. A disciplined sequence narrows the problem and makes the eventual correction explainable rather than accidental.

Why this matters

A nonexistent image tag yields image-pull events, while a process exiting repeatedly produces restart evidence and possibly CrashLoopBackOff.

A common trap

Do not overlook this operational distinction: Use bounded rollout timeouts and preserve evidence before blindly retrying deployment actions.

KEEP THESE WITH YOU

Today’s takeaways

Rolling update strategy: Deployments update Pod templates through ReplicaSets. maxSurge controls temporary extra replicas and maxUnavailable limits reduced available capacity. Available capacity still depends on readiness and resource supply. A new image that cannot start can stall the rollout while some old replicas remain.

History and rollback: Rollout history records Deployment revisions, subject to retention. Undo restores a previous Pod template rather than reverse all external effects, database migrations, or ConfigMap changes. Capture immutable image identity and configuration dependencies for reliable release reproduction.

Troubleshooting from events: Investigate rollout status, Pod status, events, logs, and ready endpoints in a deliberate sequence. Image pull errors, scheduling failures, crash loops, and failed probes indicate different boundaries. Use bounded rollout timeouts and preserve evidence before blindly retrying deployment actions.

CLOSE THE LOOP

Ready to complete this day?

Verify the practical steps and pass the knowledge check (at least two thirds correct).

Lab steps verifiedKnowledge check passed