0
0
Kubernetesdevops~30 mins

Rolling update strategy in Kubernetes - Mini Project: Build & Apply

Choose your learning style9 modes available
Kubernetes Rolling Update Strategy
📖 Scenario: You manage a web application running on Kubernetes. You want to update the app to a new version without downtime. Kubernetes rolling update helps replace old app versions with new ones gradually.
🎯 Goal: Learn how to create a Deployment with an initial app version, configure the rolling update strategy, update the app version, and observe the rolling update in action.
📋 What You'll Learn
Create a Deployment YAML with app version 1
Add rolling update strategy with maxSurge and maxUnavailable
Update the Deployment to app version 2
Check the rollout status to confirm update success
💡 Why This Matters
🌍 Real World
Rolling updates let you update live applications without downtime by replacing pods gradually.
💼 Career
DevOps engineers use rolling update strategies daily to deploy new app versions safely in Kubernetes clusters.
Progress0 / 4 steps
1
Create initial Deployment YAML with app version 1
Create a file named deployment.yaml with a Kubernetes Deployment for an app called myapp. Use image nginx:1.19. Set replicas to 3. Include labels app: myapp under metadata and spec.template.metadata. Use container name nginx.
Kubernetes
Need a hint?

Use apiVersion: apps/v1 and set replicas: 3. Labels must be under both metadata and spec.template.metadata.

2
Add rolling update strategy to Deployment
Edit deployment.yaml to add a strategy section under spec. Use type: RollingUpdate. Set rollingUpdate.maxSurge to 1 and rollingUpdate.maxUnavailable to 1.
Kubernetes
Need a hint?

Place strategy under spec. Use type: RollingUpdate and set maxSurge and maxUnavailable to 1.

3
Update Deployment to use nginx version 1.21
Change the container image in deployment.yaml from nginx:1.19 to nginx:1.21 to prepare for rolling update.
Kubernetes
Need a hint?

Update the image field under containers to nginx:1.21.

4
Apply Deployment and check rollout status
Run the command kubectl apply -f deployment.yaml to update the Deployment. Then run kubectl rollout status deployment/myapp-deployment to check the rolling update status. Write the exact output you see from the rollout status command.
Kubernetes
Need a hint?

After applying, the rollout status command shows deployment "myapp-deployment" successfully rolled out when update finishes.