0
0
Kubernetesdevops~30 mins

Blue-green deployments in Kubernetes - Mini Project: Build & Apply

Choose your learning style9 modes available
Blue-green deployments
📖 Scenario: You are managing a web application running on Kubernetes. You want to deploy a new version of your app without downtime by using blue-green deployment strategy.
🎯 Goal: Build a simple blue-green deployment setup in Kubernetes using two deployments and a service that switches traffic between them.
📋 What You'll Learn
Create two deployments named blue-deployment and green-deployment with different app versions
Create a service named app-service that routes traffic to the active deployment
Switch the service selector from blue to green to simulate deployment switch
💡 Why This Matters
🌍 Real World
Blue-green deployments are used in production environments to update applications without downtime by running two identical environments and switching traffic.
💼 Career
Understanding blue-green deployments is essential for DevOps engineers and site reliability engineers to manage safe application rollouts.
Progress0 / 4 steps
1
Create the blue deployment
Create a Kubernetes deployment named blue-deployment with label app: blue and container image nginx:1.19.
Kubernetes
Need a hint?

Use kind: Deployment and set metadata.name to blue-deployment. Use label app: blue in spec.template.metadata.labels. Use container image nginx:1.19.

2
Create the green deployment
Create a Kubernetes deployment named green-deployment with label app: green and container image nginx:1.20.
Kubernetes
Need a hint?

Similar to blue deployment, but name it green-deployment, label app: green, and use image nginx:1.20.

3
Create the service routing to blue deployment
Create a Kubernetes service named app-service that routes traffic to pods with label app: blue on port 80.
Kubernetes
Need a hint?

Create a Service with metadata.name as app-service. Set spec.selector.app to blue and expose port 80.

4
Switch service to green deployment
Change the app-service selector from app: blue to app: green to route traffic to the green deployment. Then print the selector line to confirm.
Kubernetes
Need a hint?

Update the spec.selector.app in the service to green. Then print a confirmation message.