Skip to main content
In Kubernetes, Deployments automate application updates, versioning, and rollbacks. This guide covers:
  • How rollouts create revisions
  • Deployment update strategies
  • Applying and inspecting updates
  • Undoing changes

Rollouts and Versioning

Whenever you create or modify a Deployment, Kubernetes starts a new rollout, creating a revision:
The image shows a diagram titled "Rollout and Versioning" with two revisions of Nginx versions, 1.7.0 and 1.7.1, represented by icons.
To monitor your rollout and review history:
Use kubectl rollout status to ensure a smooth update before proceeding with any dependent tasks.

Deployment Strategies

Kubernetes supports two primary update strategies:

Recreate

This strategy terminates all existing Pods before creating new ones—resulting in downtime.
The image illustrates a deployment strategy showing a transition from version 1.7.0 to 1.7.1 of nginx, with an application downtime indicated during the process.
Recreate will interrupt service during the update. Use only when downtime is acceptable.

RollingUpdate (default)

With RollingUpdate, old Pods are replaced incrementally, ensuring continuous availability.
The image illustrates two deployment strategies: "Recreate," which results in application downtime, and "Rolling Update," which maintains application availability by updating instances incrementally.
If you omit a strategy in your Deployment spec, RollingUpdate applies by default.

Applying Updates

You can update a Deployment by editing its YAML or using kubectl set image. deployment.yaml:
Apply the manifest:
Or update the image directly:
Each change creates a new revision and triggers a rollout.

Inspecting Deployment Details

To see strategy settings, ReplicaSet events, and scaling details:
Example for Recreate:
Example for RollingUpdate:
Under the hood, each Deployment manages ReplicaSets:
The image is a diagram illustrating a Kubernetes deployment with two replica sets. Replica Set 1 contains five pods, while Replica Set 2 is empty.
List ReplicaSets:

Rolling Back

To revert a faulty rollout:
After rollback, ReplicaSet counts swap:

Creating a Deployment with kubectl run

Although kubectl run nginx --image=nginx creates a Deployment by default:
Using manifest files ensures version control, repeatability, and easier collaboration.

Summary of Key Commands

References

Watch Video