-
Create app.py file
-
Create requirements.txt file
-
Create and push docker image docker build -t pkw0301/app:1.0 . docker login docker push pkw0301/app:1.0
-
Create manifest file for blue environments vi blue-1.yml
-
Create service manifest file for blue deployment vi service-1.yaml
-
Deploy blue environment manifest file kubectl apply -f blue-1.yml kubectl get deployments kubectl get pods
-
Create services for blue enviroments kubectl apply -f service-1.yaml kubectl get svc
access from browser: http://:/ping
-
Now Let’s change in the code (consider new feature) in our app.py file, change the response from: Hi, This code is develop by Prakash Kumar: 1 to Hi, This code is develop by Prakash Kumar: 2
-
Now it’s time to build docker image with new tag docker build -t pkw0301/app:2.0 . docker login docker push pkw0301/app:2.0
-
Create manifest file for Green environments vi green-2.yml
-
Deploy Green environment manifest file kubectl apply -f green-2.yml --force kubectl get deployments kubectl get pods
-
In order to point to Green Environment update service manifest file and update version from 1.0 to 2.0 kubectl apply -f service-1.yaml
-
Reload application URL, now it should point to Green environment.
-
If there is a new change your can repeat the process. Done!!!