1.6 KiB
Intro
This document decribes a blue-green deployment using a simple Go web app and Minikube.
To get started, you will need to:
- Install minikube
- Execute
minikube startto start the cluster
Deploying the first version of our application
Using the Dockerfile a container image is built. We pushed this image to our container registry.
First, we apply the 'blue' deployment by running kubectl apply -f deployment-blue.yaml and kubectl apply -f service.yaml.
his deploys a pod with a 3 containers running v1.0 of the application. This version contains 5 vehicles in the list.
We get the service URL by running minikube service vehicles-service --url
Use curl to make a GET request to the /vehicles endpoint. We now get the list of 5 vehicles as a response.
Updating our application
We now make a change to the application, for example by adding a new vehicle to the list. This new version is given version number 1.1. We build the container image again, now with tag 1.1.
We now apply the "green" deployment by running kubectl apply -f deployment-green.yaml. When the deployment is running without issues, we can update our service manifest to now point to our new version 1.1 of the application. This can be done by updating the values under selector. The value of app will now become the same as matchLabels.app in the deployment-green.yaml file, which is vehicles-green in this case.
After applying the updated service manifest, we can get the URL again, use curl to call the /vehicles endpoint. We can now see the newly added vehicle in the list.