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.
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-1709Apply the deployment and service:
$ kubectl apply -f rollingupdate.yaml $ kubectl apply -f service.yamlMonitor progress with:
$ kubectl rollout status deployment/rollingupdate-strategySigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
