Skip to content

Latest commit

 

History

History
 
 

blue-green

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Blue Green

A blue/green deployment differs from a ramped deployment because the “green” version of the application is deployed alongside the “blue” version. After testing that the new version meets the requirements, we update the Kubernetes Service object that plays the role of load balancer to send traffic to the new version by replacing the version label in the selector field.

bluegreen

Go to the right diorectory

cd ~/Workshop-K8S/k8s/blue-green/

Create namespace

kubectl create ns blue-green

Deploy Blue v1

kubectl -n blue-green apply -f hello-world-blue.yaml
kubectl -n blue-green get pods

Test

With CURL:

curl [public ip adress load balancer]/api

And in browser you should see the blue version (1.0.0):

<http://[public ip adress load balancer]

Deploy green v2

kubectl -n blue-green apply -f hello-world-green.yaml
kubectl -n blue-green get pods -w

Stop with CONTROL-C

Test

With CURL:

curl [public ip adress load balancer]/api

And in browser you should see the blue version (1.0.0):

http://[public ip adress load balancer]

Switch to green

Check that service is pointing to blue version:

kubectl -n blue-green describe svc hello-world-service

Change to green version:

kubectl -n blue-green patch service hello-world-service -p '{"spec":{"selector":{"app":"hello-world-green"}}}'

Test

With CURL:

curl [public ip adress load balancer]/api

And in browser you should see the green version (2.0.0):

http://[public ip adress load balancer]

Clean up

kubectl delete ns blue-green