Simple blue-green deployment in kubernetes using minikube, Capstone project, Cloud DevOps Nanodegree

Alvaro Andres Pinzon Cortes
2 min readSep 10, 2019

--

Repository

https://github.com/andresaaap/tutorial-green-blue-deploy-minikube

Objetive

  • Redirect traffic from the blue container to the green container

Prerequisites

Instructions

  1. Build the blue image from the blue folder. Adjust the name of the image to your own.
./run_docker.sh

2. Push the image to docker hub from the blue folder. Adjust the name of the image to your own.

./upload_docker.sh

3. Build the green image from the green folder. Adjust the name of the image to your own.

./run_docker.sh

4. Push the image to docker hub from the green folder. Adjust the name of the image to your own.

./upload_docker.sh

5. Start minikube to create the cluster

minikube start

How to deploy your microservices to kubernetes and access them with a Load Balancer External IP?

6. Create a replication controller blue pod

kubectl apply -f ./blue-controller.json

6. Create a replication controller green pod

kubectl apply -f ./green-controller.json

7. Create the service, redirect to blue and make it externally visible, we specify "type": "LoadBalancer"

kubectl apply -f ./blue-green-service.json

8. Get the URL of the service by running

minikube service bluegreenlb --url

9. You can now open the website blue in your browser by using the URL in the previous step

10. Update the service to redirect to green by changing the selector to app=green

11. Implement the changes

kubectl apply -f ./blue-green-service.json

12. Get the URL of the service by running

minikube service bluegreenlb --url

13. You can now open the website green in your browser by using the URL in the previous step

--

--

No responses yet