Use the templates and manifests to perform bluegreen and canary deployments.
- Kubernetes cluster (EKS Workshop - https://www.eksworkshop.com/)
- AWS Load Balancer Controller (https://www.eksworkshop.com/beginner/180_fargate/prerequisites-for-alb/)
- Argo rollouts setup in the EKS cluster(https://argoproj.github.io/argo-rollouts/) and argo rollouts kubectl plugin installed in a Unix host.
- Digital.ai Release with xlr-argo-rollouts-integration and xlr-kubernetes-integration plugins installed
Download the initial setup template from here and run the template to set up Canary namespace and deployment.
Alternatively follow the steps to set up the deployment
-
kubectl create namespace guestbook-canary
→ creates a namespace 'guestbook-canary' -
kubectl apply -f https://raw.githubusercontent.com/xebialabs-community/howto/master/argoRollouts/manifests/guestbook-canary-service.yaml -n guestbook-canary
→ creates two services 'guestbook-stable' and 'guestbook-canary' -
kubectl apply -f https://raw.githubusercontent.com/xebialabs-community/howto/master/argoRollouts/manifests/guestbook-canary-rollout.yaml -n guestbook-canary
→ creates a rollout with canary strategy, replica set of 5 pods with image guestbook:blue -
kubectl apply -f https://raw.githubusercontent.com/xebialabs-community/howto/master/argoRollouts/manifests/redis.yaml -n guestbook-canary
→ creates a redis pod and service -
kubectl get service guestbook-stable -n guestbook-canary
→ to view the application in browser :8080/index.html- Add custom dashboard from the Dashboards menu.
- Click Configure > Add tile > ArgoRollouts Canary details.
- Click the gear icon to configure the added tile.
- In the Title field, enter the name for the tile.
- In the Rollouts Config field, select the existing argo rollout configuration.
- In the Namespace field, enter the name of the namespace - 'guestbook-canary'.
- In the Rollout Name field, enter the name of the rollout - 'guestbook-canary-rollout'.
- kubectl argo rollouts set image guestbook-canary-rollout guestbook-container=xldevdocker/guestbook:green -n guestbook-canary
→ updates 20% of pods in guestbook-canary-rollout with new image - kubectl argo rollouts promote guestbook-canary-rollout -n guestbook-canary
→ executes the rest of the update steps - kubectl argo rollouts promote guestbook-canary-rollout -n guestbook-canary
→ updates the final set of pods with the new image
- In Release, create Unix host connection. Specify a host which has the following
- kubectl installed and confiured to connect to the desired cluster
- kubectl argo rollouts plugin installed
- Create Kubectl Argo Rollouts connection and specify the kubectl path, namespace as guestbook-canary and other fields or if required.
System defaults from the unix host will be picked where not specified. - Import the template for Canary deployment from here
- Create the following global variables in Release
- canary.rollout-name - guestbook-canary-rollout
- canary.container-name- guestbook-container
- canary.current-image - xldevdocker/guestbook:blue
- Make sure that the rollout tasks in the template have the 'Rollout Config' and 'Host' selected.
- To update a new image, create New Release, specify the new image xldevdocker/guestbook:green and start it.
- Assign and complete manual tasks where required. Choose to promote or abort rollout as desired.
Download Initial setup template from here and run the template to setup Blue Green namespace and deployment.
Alternatively follow the steps to setup the deployment
-
kubectl create namespace guestbook-bluegreen
→ creates a namespace 'guestbook-bluegreen' -
kubectl apply -f https://raw.githubusercontent.com/xebialabs-community/howto/master/argoRollouts/manifests/guestbook-bluegreen-service.yaml -n guestbook-bluegreen
→ creates two services 'guestbook-bluegreen-active' and 'guestbook-bluegreen-preview' -
kubectl apply -f https://raw.githubusercontent.com/xebialabs-community/howto/master/argoRollouts/manifests/guestbook-bluegreen-rollout.yaml -n guestbook-bluegreen
→ creates a rollout with bluegreen strategy, replica set of 2 pods with image guestbook:blue -
kubectl apply -f https://raw.githubusercontent.com/xebialabs-community/howto/master/argoRollouts/manifests/redis.yaml -n guestbook-bluegreen
→ creates a redis pod and service -
kubectl get service guestbook-bluegreen-active -n guestbook-bluegreen
→ to view the application in browser :8080/index.html- Add custom dashboard from the Dashboards menu.
- Click Configure > Add tile > ArgoRollouts Blue Green details.
- Click the gear icon to configure the added tile.
- In the Title field, enter the name for the tile.
- In the Rollouts Config field, select an existing argo rollout configuration.
- In the Namespace field, enter the name of the namespace - 'guestbook-bluegreen'.
- In the Rollout Name field, enter the name of the rollout - 'guestbook-bluegreen-rollout'.
kubectl argo rollouts set image guestbook-bluegreen-rollout guestbook-container=xldevdocker/guestbook:green -n guestbook-bluegreen
→ Creates pods with the new image and exposes the application through the preview servicekubectl get service guestbook-bluegreen-preview -n guestbook-blue
→ to view the preview service application in browser :8080/index.htmlkubectl argo rollouts promote guestbook-bluegreen-rollout -n guestbook-bluegreen
→ promotes the preview service to live and terminates the old podskubectl get service guestbook-bluegreen-active -n guestbook-bluegreen
→ to view the application in browser :8080/index.html
This is similar to the canary template
- In Release, create Unix host connection. Specify a host which has the following
- kubectl installed and confiured to connect to the desired cluster
- kubectl argo rollouts plugin installed
- Create Kubectl Argo Rollouts connection and specify the kubectl path, namespace as guestbook-bluegreen and other fields or if required.
System defaults from the unix host will be picked where not specified. - Import the template for BlueGreen deployment found here
- Create the following global variables in Release
- blue-green.rollout-name - guestbook-bluegreen-rollout
- blue-green.container-name- guestbook-container
- blue-green.current-image - xldevdocker/guestbook:blue
- Make sure that the rollout tasks in the template have the 'Rollout Config' and 'Host' selected.
- To update a new image, create New Release, specify the new image xldevdocker/guestbook:green and start it.
- Assign and complete manual tasks where required. Choose to promote or abort rollout as desired.