This is code that tried blue-green deployment on k8s. it ran on masOS Sierra with minikube.
usage
-
install minikube.
-
create deployment and service
kubectl apply -f deployment-b.yaml -f deployment-g.yaml -f service-bg.yaml
- access to service port
curl 192.168.99.100:8080
> Hello Kubernetes bootcamp! | Running on: http-deploy-b-2645909527-0lh1f | v=1
- edit service.yaml and apply service.
sed -i -e "s/blue/green/" service-bg.yaml
kubectl apply -f service-bg.yaml
- check green has been deployed
curl 192.168.99.100:8080
> Hello Kubernetes bootcamp! | Running on: http-deploy-g-3904659589-s2kz2 | v=1