What you will learn in this TP
- Configure a safe rolling update
- Run a canary deployment
- Roll back with kubectl
Introduction #
What you will learn in this section
- Configure a safe rolling update
- Run a canary deployment
- Roll back with kubectl
Context. The team is moving to Kubernetes and wants progressive deployments. You validate update and rollback behaviour on a local cluster.
Prerequisites: Docker, kubectl and kind installed on your machine · Estimated time: 50 min
Controlled progressive deployments and a one-command rollback.Hands-on #
Guided steps, with their solution.
1. Create the cluster and deploy v1
Why? maxUnavailable: 0 and a readiness probe ensure no request reaches a pod that is not ready.
Create a kind cluster and deploy 4 replicas ofhashicorp/http-echoshowing "v1", with a careful RollingUpdate strategy and a readiness probe, exposed by a Service.2. Zero-downtime rolling update
Why? Watch pods being replaced one by one while traffic continues.
Start a request loop from the client pod, then move to v2 with a change-cause annotation. Follow the rollout and the history.3. Block a broken version
Why? A missing image or a pod that never becomes ready halts the rolling update: old pods keep serving.
Deploy a non-existent image, see thatrollout statusfails after a timeout and that the service still answers v2.4. Roll back
Why? Kubernetes keeps previous ReplicaSets: rollback is immediate.
Undo the last revision, check all pods are ready, then explicitly go back to revision 1.5. Canary deployment
Why? Without a service mesh, a canary is approximated by splitting replicas behind the same Service.
Create aweb-canaryDeployment (1 replica, text "v3-canary", labeltrack: canary) sharing theapp: weblabel. Measure its share of traffic, then promote or delete the canary.
Difficulty level : ●●●○○ (3/5)
My progress
Sign in to track your progress and take notes. Sign in
Recommended Articles
CI/CD de bout en bout (4/5) : stratégies de déploiement et retour arrière
Déployer sans interruption et sans risque : recreate, rolling update, blue/green, canary, feature...