Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
site-blue Final Oct 29, 2018
site-green Final Oct 29, 2018
Dockerfile-blue Final Oct 29, 2018
Dockerfile-green Final Oct 29, 2018
Makefile 4Developers_Warsaw Apr 8, 2019
README.rst 4Developers_Warsaw Apr 8, 2019
kube-nginx-blue.yaml Final Oct 29, 2018


Green Blue with Kubernetes


Get the images to docker hub:

make docker_deploy

Notice: You need to change DOCKER_PROJECT_ID in Makefile.


minikube start
kubectl config use-context minikube

# let's get our service running
kubectl apply -f kube-service-status.yaml

# our first version: blue
kubectl apply -f kube-nginx-blue.yaml

# let's connect to our blue

# get the IP
minikube ip

# get the port
export SVC_PORT=$(kubectl get service api-status --output='jsonpath="{.spec.ports[0].nodePort}"' | tr -d '"')

curl $(minikube ip):${SVC_PORT}

# let's get the green running
kubectl apply -f kube-nginx-green.yaml

# in another terminal window
watch -n0.3 -x kubectl get po

watch -n0.3 -x curl -s $(minikube ip):${SVC_PORT}

# let's make the switch
kubectl patch service api-status -p '{"spec":{"selector": {"label": "green"} }}'

Notice: we could also accomplish this strategy using Ingress instead of Service.

You can’t perform that action at this time.