Blue Green Deployment - Single Service
In this example, we release a new version of an Application which has single service using the blue/green deployment strategy.
Steps to follow
version 1 is serving traffic
deploy version 2
wait until version 2 is ready
switch incoming traffic from version 1 to version 2
shutdown version 1
In practice
Step 1: Deploy the first application
kubectl apply -f app-v1.yamlTo see the deployment in action, open a new terminal and run the following
kubectl get pods --watchThen deploy version 2 of the application
kubectl apply -f app-v2.yamlWait for all the version 2 pods to be running
kubectl rollout status deploy my-app-v2 -wSide by side, 3 pods are running with version 2 but the service still send traffic to the first deployment.
If necessary, you can manually test one of the pod by port-forwarding it to your local environment.
Once your are ready, you can switch the traffic to the new version by patching the service to send traffic to all pods with label version=v2.0.0
In case you need to rollback to the previous version
If everything is working as expected, you can then delete the v1.0.0 deployment
Cleanup
Last updated
Was this helpful?