Cloud Native 4 min read

Understanding Kubernetes Deployment Controller and Rolling Updates

This article explains the core functions of the Kubernetes Deployment controller, describes how rolling updates and canary releases work, provides a sample Deployment YAML, and demonstrates common kubectl commands for inspecting, updating, and rolling back deployments in a cloud‑native environment.

Practical DevOps Architecture
Practical DevOps Architecture
Practical DevOps Architecture
Understanding Kubernetes Deployment Controller and Rolling Updates

The Deployment controller in Kubernetes manages stateless application services, handling pod and ReplicaSet lifecycle, providing features such as deployment, replica control, rolling updates, and rollbacks.

Rolling upgrades update instances in batches rather than all at once, reducing downtime. The controller reduces the old ReplicaSet replicas to zero while scaling the new ReplicaSet to the desired count. Two update strategies exist: Recreate (delete all old pods then create new ones) and RollingUpdate , which updates pods incrementally using maxUnavailable and maxSurge parameters.

Example Deployment manifest:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: haha-deploy
  namespace: dev
spec:
  replicas: 5
  revisionHistoryLimit: 5  # keep 5 historical versions
  strategy:
    type: RollingUpdate
  selector:
    matchLabels:
      app: haha-nginx-pod
  template:
    metadata:
      labels:
        app: haha-nginx-pod
    spec:
      containers:
      - name: haha-nginx
        image: nginx:1.23.0

To view controller parameters:

[root@master ~]# kubectl describe deploy haha-deploy -n dev

Rolling update the nginx image and record the change:

[root@master ~]# kubectl set image deployment/haha-deploy haha-nginx=nginx:1.23.0 -n dev --record=true

Monitor the upgrade process in real time:

[root@master ~]# kubectl get pods -n dev -w

Rollout commands for history, undo, pause, resume, and status:

[root@master ~]# kubectl rollout history deployment/haha-deploy -n dev
[root@master ~]# kubectl rollout undo deployment/haha-deploy -n dev --to-revision=2
[root@master ~]# kubectl rollout pause deployment/haha-deploy -n dev
[root@master ~]# kubectl rollout resume deployment/haha-deploy -n dev
[root@master ~]# kubectl rollout status deployment/haha-deploy -n dev

These commands allow operators to manage deployment versions, view change history, and safely roll back to previous releases, supporting continuous delivery in cloud‑native environments.

CloudNativedeploymentKubernetesyamlkubectlRollingUpdate
Practical DevOps Architecture
Written by

Practical DevOps Architecture

Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.