Table of Contents
In my previous three posts (Part 1, Part 2, and Part 3)we created and deployed a Micro Service using TIBCO BusinessWorks Container Edition into Kubernetes (I used Minikube), and then upgraded it using the Recreate and Rolling Update strategy.
In this post, we?re going to take the original deployment of Version 1.0 (which we rolled back to at the end of the second post) and upgrade it again to 1.1, but this time using the Blue/Green strategy.
A Blue/Green deployment strategy (sometimes also known as Red/Black) allows you to deploy upgraded services alongside your existing services and the two don?t interact in any way. The URL of the Service defined is different so it allows you to test the new deployment before switching over all the traffic.
I?ve created an example manifest file where the changes I?ve made are pretty minimal and really just add in the keywords ?version: green?. The complete version of the file is here. I?ve also removed the definitions for the Service as we?ll keep the same service as our original application, and later we?ll update the configuration to point to our new green deployment later.
In my Minikube environment, I still have my version 1.0 running ? so I?ll deploy this new ?Green? version of the deployment using the command:
When the deployment is complete, you?ll see that we now have 2 deployments ? our original deployment, plus our new Green deployment ? each with 2 Pods running.
So we have our Green deployment running ? but there?s no traffic there just yet, so we?ve got to create a new Service that points to the new deployment. You can find the service file here, and you can create the service using the following:
Executing ?minikube service list? shows the below:
Where we can see our two deployments. Our new service can be found at http://192.168.49.2:30092, so we can now do our testing using the new URL.
So at this stage ? we have both deployments up and running in parallel and our testing is going ahead.
Now ? we are ready to switch traffic fully over to our Green deployment as our ?Live? deployment and then we can remove our old deployment.
To do this, I?ve created a new manifest file for the ?Live? service and changes the selector to point to the green-greeting-app and version:green as below:
Issuing the following command modifies the existing greeting-app service to point to the new Green app:
Looking at the terminal output below ? you can see that as soon as I issue the update, Live traffic is immediately switched over to the green deployment.
It feels like these posts are getting shorter ? once you?ve got your microservice-based application deployed in K8s it really is quite easy to upgrade them using the different strategies.
As before ? I?ve created a
In the next and final post in this series, we?ll be looking at the Canary Strategy.