DEV Community

Cover image for Part-88: πŸ”„ Kubernetes Deployment Updates & Rollout Verification in GCP (Google Kubernetes Engine)
Latchu@DevOps
Latchu@DevOps

Posted on

Part-88: πŸ”„ Kubernetes Deployment Updates & Rollout Verification in GCP (Google Kubernetes Engine)

In this guide, we’ll learn how to update Kubernetes Deployments in Google Kubernetes Engine (GKE) using two methods:

  1. kubectl set image (direct image update)
  2. kubectl edit deployment (manual YAML edit)

We’ll also verify rollout status, ReplicaSets, Pods, and rollout history step by step.


πŸ“Œ Step 00: Introduction

Kubernetes supports updating Deployments in two ways:

  • Set Image β†’ Quick way to update the container image directly.
  • Edit Deployment β†’ Manual way to edit deployment YAML and change the image (or other fields).

By default, updates are performed using a rolling update strategy, ensuring zero downtime.


πŸ”Ή Step 01: Update Application (V1 β†’ V2) using set image

1️⃣ Get Container Name from Deployment

kubectl get deployment my-first-deployment -o yaml
Enter fullscreen mode Exit fullscreen mode

2️⃣ Update Deployment to V2

kubectl set image deployment/my-first-deployment \
  kubenginx=ghcr.io/stacksimplify/kubenginx:2.0.0
Enter fullscreen mode Exit fullscreen mode

πŸ” Verify Rollout

# Check rollout status
kubectl rollout status deployment/my-first-deployment

# Verify deployment details
kubectl get deploy
kubectl describe deployment my-first-deployment
Enter fullscreen mode Exit fullscreen mode

d1

βœ… Kubernetes performs a rolling update, gradually replacing old Pods with new ones without downtime.


πŸ” Verify ReplicaSets & Pods

# Check ReplicaSets
kubectl get rs

# Check Pods
kubectl get po
Enter fullscreen mode Exit fullscreen mode

d2

πŸ“Œ Observation: A new ReplicaSet is created for version 2.0.0, while old ReplicaSet is scaled down.


🌍 Access Application

# Get LoadBalancer IP
kubectl get svc

# Access via browser or curl
http://<External-IP>
Enter fullscreen mode Exit fullscreen mode

d3

βœ… You should now see Application Version: V2.


πŸ“ Update Change-Cause for Rollout History

# View rollout history
kubectl rollout history deployment/my-first-deployment

# Annotate with change cause
kubectl annotate deployment/my-first-deployment \
  kubernetes.io/change-cause="Deployment UPDATE - App Version 2.0.0 - SET IMAGE OPTION"

# Verify rollout history
kubectl rollout history deployment/my-first-deployment
Enter fullscreen mode Exit fullscreen mode

d4


πŸ”Ή Step 02: Update Application (V2 β†’ V3) using edit deployment

1️⃣ Edit Deployment YAML

kubectl edit deployment/my-first-deployment
Enter fullscreen mode Exit fullscreen mode

Change the image version:

# From
image: ghcr.io/stacksimplify/kubenginx:2.0.0

# To
image: ghcr.io/stacksimplify/kubenginx:3.0.0
Enter fullscreen mode Exit fullscreen mode

d5


πŸ” Verify Rollout

# Rollout status
kubectl rollout status deployment/my-first-deployment

# Deployment details
kubectl describe deployment/my-first-deployment
Enter fullscreen mode Exit fullscreen mode

d6


πŸ” Verify ReplicaSets & Pods

kubectl get rs
kubectl get po
Enter fullscreen mode Exit fullscreen mode

πŸ“Œ Observation: Now we should see 3 ReplicaSets (V1, V2, V3).

d6


🌍 Access Application

kubectl get svc
http://<External-IP>
Enter fullscreen mode Exit fullscreen mode

βœ… Application should now display Version: V3.

d7


πŸ“ Update Change-Cause for Rollout History

# Rollout history
kubectl rollout history deployment/my-first-deployment

# Annotate with change cause
kubectl annotate deployment/my-first-deployment \
  kubernetes.io/change-cause="Deployment UPDATE - App Version 3.0.0 - EDIT DEPLOYMENT OPTION"

# Verify rollout history again
kubectl rollout history deployment/my-first-deployment
Enter fullscreen mode Exit fullscreen mode

d8


βœ… Recap

In this tutorial, we:

  • Updated a Deployment using kubectl set image
  • Updated another version using kubectl edit deployment
  • Verified rollout status, ReplicaSets, and Pods
  • Annotated rollouts for better history tracking

πŸŽ‰ With Kubernetes in GCP, updates are seamless, zero-downtime, and fully auditable.


🌟 Thanks for reading! If this post added value, a like ❀️, follow, or share would encourage me to keep creating more content.


β€” Latchu | Senior DevOps & Cloud Engineer

☁️ AWS | GCP | ☸️ Kubernetes | πŸ” Security | ⚑ Automation
πŸ“Œ Sharing hands-on guides, best practices & real-world cloud solutions

Top comments (0)