Skip to main content
In this tutorial, you’ll learn how to perform and manage rolling updates on a Google Kubernetes Engine (GKE) cluster. These concepts apply equally to upstream Kubernetes, enabling you to update container images with zero downtime and perform safe rollbacks when needed.

Prerequisites


1. Configure and Create the Cluster

First, set your Compute Engine zone and create a single-node GKE cluster named gke-deep-dive.
Cluster provisioning can take a few minutes. You can monitor progress in the Google Cloud Console under Kubernetes Engine > Clusters.

2. Deploy a Simple Nginx Application

Create a Deployment manifest gke-deep-dive-app.yaml with two replicas of Nginx:
Apply the manifest and verify the pods:

3. Perform Rolling Updates

GKE supports in-place rolling updates, ensuring that at least one replica remains available while others are replaced.

3.1 Update to Nginx 1.9.1

Verify the new pods are running:

3.2 Update to Nginx 1.21.0

Perform another image update to observe an in-progress rollout:

4. Rollback a Deployment

If a rollout introduces an issue, you can revert to a previous revision.

4.1 Rollback to the Previous Revision

4.2 Rollback to a Specific Revision

  1. View rollout history:
  2. Roll back to revision 1 (original version):
Rolling back to a previous revision may disrupt your application. Always test in a staging environment before rolling back in production.

Watch Video