0
0
Kubernetesdevops~30 mins

Cluster upgrade strategies in Kubernetes - Mini Project: Build & Apply

Choose your learning style9 modes available
Deployment Upgrade Strategies
📖 Scenario: You are a DevOps engineer managing a Kubernetes cluster for a small company. The cluster runs several applications, and you need to upgrade the applications safely without downtime.This project will guide you through defining and simulating different application upgrade strategies using Kubernetes concepts.
🎯 Goal: Build a simple Kubernetes manifest and commands to simulate application upgrade strategies: blue-green and canary. You will create deployment configurations and update them step-by-step to understand how upgrades can be done safely.
📋 What You'll Learn
Create a Kubernetes deployment manifest with a specific version label
Add a configuration variable to select upgrade strategy
Implement the upgrade logic using kubectl commands and manifest changes
Output the final deployment status to verify upgrade success
💡 Why This Matters
🌍 Real World
Application upgrade strategies help keep applications running smoothly while updating software versions without downtime.
💼 Career
Understanding upgrade strategies is essential for DevOps engineers to maintain high availability and reliability in production Kubernetes clusters.
Progress0 / 4 steps
1
Create initial deployment manifest
Create a Kubernetes deployment manifest named app-deployment.yaml with these exact specifications: deployment name myapp, container image myapp:v1, and 3 replicas.
Kubernetes
Need a hint?

Use apiVersion: apps/v1 and kind: Deployment. Set replicas to 3 and label the pods with version: v1.

2
Add upgrade strategy variable
Create a variable named upgrade_strategy and set it to the string blue-green to select the upgrade method.
Kubernetes
Need a hint?

Use a simple assignment statement in Python style to set upgrade_strategy to "blue-green".

3
Implement blue-green upgrade logic
Write a command to simulate the blue-green upgrade by creating a new deployment named myapp-green with image myapp:v2 and 3 replicas. Use the same labels but set version: v2 for the new deployment.
Kubernetes
Need a hint?

Copy the deployment manifest structure and change metadata.name to myapp-green, image to myapp:v2, and label version to v2.

4
Output deployment status
Write a command to print the status of both deployments myapp and myapp-green using kubectl get deployments myapp myapp-green.
Kubernetes
Need a hint?

Use a print statement to show the exact command kubectl get deployments myapp myapp-green.