Creating Deployment Version 2
Create a new file dep-v2.yaml with the following content,
apiVersion: apps/v1
kind: Deployment
metadata:
name: dep-v2
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
selector:
matchLabels:
app: dep-v2
template:
metadata:
labels:
app: dep-v2
spec:
containers:
- image: guybarrette/hello-app:2.0
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
imagePullPolicy: Always
name: dep-v2
ports:
- containerPort: 8080
This is the same as the dep-v1.yaml, except that the hello app version is 2.0.
We can use below command to deploy this too,
kubectl apply -f dep-v2.yaml
At this point, we have deployed both version of the apps but we are currently forwarding our live traffic to deployment version 1 only,
What is Kubernetes Blue Green Deployment?
Blue-green deployment is a software deployment strategy that involves running two identical production environments, known as “blue” and “green.” At any given time, only one of these environments serves live traffic, while the other remains idle or serves only non-production traffic (e.g., testing or staging).