Skip to content

Latest commit

 

History

History
116 lines (94 loc) · 7.86 KB

File metadata and controls

116 lines (94 loc) · 7.86 KB

ArgoRollout using Release and EKS

Use the templates and manifests to perform bluegreen and canary deployments.

Prerequisites

  1. Kubernetes cluster (EKS Workshop - https://www.eksworkshop.com/)
  2. AWS Load Balancer Controller (https://www.eksworkshop.com/beginner/180_fargate/prerequisites-for-alb/)
  3. Argo rollouts setup in the EKS cluster(https://argoproj.github.io/argo-rollouts/) and argo rollouts kubectl plugin installed in a Unix host.
  4. Digital.ai Release with xlr-argo-rollouts-integration and xlr-kubernetes-integration plugins installed

Initial Canary Rollout Setup in K8s

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

  1. kubectl create namespace guestbook-canary
    → creates a namespace 'guestbook-canary'

  2. 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'

  3. 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

  4. kubectl apply -f https://raw.githubusercontent.com/xebialabs-community/howto/master/argoRollouts/manifests/redis.yaml -n guestbook-canary
    → creates a redis pod and service

  5. kubectl get service guestbook-stable -n guestbook-canary
    → to view the application in browser :8080/index.html

    Set up the dashboard for the Canary deployment

    • 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'.

Update Canary Rollout with a new Image Manually

  1. 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
  2. kubectl argo rollouts promote guestbook-canary-rollout -n guestbook-canary
    → executes the rest of the update steps
  3. kubectl argo rollouts promote guestbook-canary-rollout -n guestbook-canary
    → updates the final set of pods with the new image

Rollout new revisions using Canary

  1. 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
  2. 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.
  3. Import the template for Canary deployment from here
  4. Create the following global variables in Release
    • canary.rollout-name - guestbook-canary-rollout
    • canary.container-name- guestbook-container
    • canary.current-image - xldevdocker/guestbook:blue
  5. Make sure that the rollout tasks in the template have the 'Rollout Config' and 'Host' selected.
  6. To update a new image, create New Release, specify the new image xldevdocker/guestbook:green and start it.
  7. Assign and complete manual tasks where required. Choose to promote or abort rollout as desired.

Initial BlueGreen Rollout Setup in K8s

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

  1. kubectl create namespace guestbook-bluegreen
    → creates a namespace 'guestbook-bluegreen'

  2. 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'

  3. 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

  4. kubectl apply -f https://raw.githubusercontent.com/xebialabs-community/howto/master/argoRollouts/manifests/redis.yaml -n guestbook-bluegreen
    → creates a redis pod and service

  5. kubectl get service guestbook-bluegreen-active -n guestbook-bluegreen
    → to view the application in browser :8080/index.html

    Set up the dashboard for the Blue-Green deployment.

    • 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'.

Update Blue-Green Rollout with a new Image Manually

  1. 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 service
  2. kubectl get service guestbook-bluegreen-preview -n guestbook-blue
    → to view the preview service application in browser :8080/index.html
  3. kubectl argo rollouts promote guestbook-bluegreen-rollout -n guestbook-bluegreen
    → promotes the preview service to live and terminates the old pods
  4. kubectl get service guestbook-bluegreen-active -n guestbook-bluegreen
    → to view the application in browser :8080/index.html

Roll out new revisions using Blue-Green

This is similar to the canary template

  1. 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
  2. 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.
  3. Import the template for BlueGreen deployment found here
  4. 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
  5. Make sure that the rollout tasks in the template have the 'Rollout Config' and 'Host' selected.
  6. To update a new image, create New Release, specify the new image xldevdocker/guestbook:green and start it.
  7. Assign and complete manual tasks where required. Choose to promote or abort rollout as desired.