Cloud Native 18 min read

Master Kubernetes Deployment Strategies: Rolling Update, Recreate, Blue‑Green & Canary

This tutorial explains Kubernetes deployment strategies—including Rolling Update, Recreate, Blue‑Green, and Canary—by covering their concepts, configuration YAML files, kubectl commands, advantages, trade‑offs, and practical examples to help you choose the right approach for reliable application releases.

IT Architects Alliance
IT Architects Alliance
IT Architects Alliance
Master Kubernetes Deployment Strategies: Rolling Update, Recreate, Blue‑Green & Canary

Kubernetes Deployment Strategies Overview

Kubernetes provides several deployment strategies to control how new versions of containerized applications are rolled out, ensuring minimal downtime and reliable updates. The article walks through Rolling Update, Recreate, Blue‑Green, and Canary strategies, showing when each is appropriate.

Prerequisites

You should have basic experience with Kubernetes, access to a cluster, and the kubectl CLI installed. Familiarity with Linux and YAML syntax is also required.

What Is a Deployment?

A Deployment is a declarative Kubernetes resource that defines the desired state of an application, including the container image, replica count, and update behavior. The Deployment controller reconciles the actual state to match the declared state.

Benefits of Using Deployments

Deployments automate updates, handle pod health monitoring, replace failed pods, and provide a consistent way to manage application lifecycles without manual intervention.

Rolling Update Strategy

Rolling Update is the default strategy. It replaces old pods with new ones gradually, avoiding cluster downtime. Two key parameters fine‑tune the process: maxSurge: Number or percentage of extra pods that can be created during an update (default 25%). maxUnavailable: Number or percentage of pods that may be unavailable during the update (default 25%).

Example rollingupdate.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: rollingupdate-strategy
  version: nanoserver-1709
spec:
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 2
      maxUnavailable: 1
  selector:
    matchLabels:
      app: web-app-rollingupdate-strategy
      version: nanoserver-1709
  replicas: 3
  template:
    metadata:
      labels:
        app: web-app-rollingupdate-strategy
        version: nanoserver-1709
    spec:
      containers:
      - name: web-app-rollingupdate-strategy
        image: hello-world:nanoserver-1709

Apply the deployment and service:

$ kubectl apply -f rollingupdate.yaml
$ kubectl apply -f service.yaml

Monitor progress with:

$ kubectl rollout status deployment/rollingupdate-strategy
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

KuberneteskubectlRolling UpdateBlue-GreenCanaryDeployment StrategiesRecreate
IT Architects Alliance
Written by

IT Architects Alliance

Discussion and exchange on system, internet, large‑scale distributed, high‑availability, and high‑performance architectures, as well as big data, machine learning, AI, and architecture adjustments with internet technologies. Includes real‑world large‑scale architecture case studies. Open to architects who have ideas and enjoy sharing.

0 followers
Reader feedback

How this landed with the community

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.