Jump to content
Welcome to our new Citrix community!
  • Canary deployment of cloud-native apps with NetScaler ADC, Azure DevOps


    Guest
    • Validation Status: Validated
      Has Video?: No

    Canary deployment of cloud-native apps with NetScaler ADC, Azure DevOps

    Submitted May 2, 2022

    Author: Bharathi M

     

    When we talk about managing apps, it is important to consider how changes to the apps can affect the user experience. Updates are inevitable, and any app deployment should include plans to mitigate the impact of these changes. Sometimes, a zero-downtime deployment is not sufficient. You need to test new features with small groups of your user base and compare user adoption before rolling out updates to your entire user base.

    Canary is a deployment strategy that involves deploying new versions of an app in small and phased incremental steps. The idea is to first deploy the new changes to a small set of users to assess whether to reject or promote the new deployments. If all is OK, then you can roll out the changes to the rest of the user base. This strategy limits the risk involved in deploying a new version of an app in your production environment.

    A cloud service provided by Azure DevOps, Azure pipelines allow you to automatically run builds, perform tests, and deploy code to various development and production environments.

    In this blog post, we’ll look at how you can integrate NetScaler ADC and Ingress Controller capabilities and automation with Azure pipelines to facilitate canary deployment of cloud-native apps.

    Deployment Configurations

    In the deployment configuration, the app admins or DevOps should declare the directory path specifying the Kubernetes manifests of the target app version — v1 or v2, for example — to be deployed or torn down.

    {"K8S_CONFIG_PATH": "cd/canary-azure-devops/kubernetes_configs/v1",}

    Kubernetes Configurations

    The Kubernetes configurations include the version-specific directories with the Kubernetes manifest YAMLs that are responsible for deploying the app, as well as the updated Helm charts for deploying  Ingress Controller to configure the NetScaler ADC.

    The ingress definition below indicates the ingress YAML defined for deploying the canary version of the app with a traffic weight that can vary between 0 and 100. You can do the same to achieve a blue-green deployment by adjusting the traffic weight to either 0 or 100.

    apiVersion: extensions/v1beta1 kind: Ingressmetadata:  name: canary-ingress  annotations:    kubernetes.io/ingress.class: "citrix"    ingress.citrix.com/canary-weight: "40"    ingress.citrix.com/frontend-ip: 1.1.1.1spec:  rules:  - host:  demo-canary.webapp.com    http:      paths:      - path: /        backend:          serviceName: guestbook-canary          servicePort: 80

    Pipeline Configurations

    Pipeline configurations include the Azure pipeline script and a simple Python script. This script reads the user configurations from the deployment_configs directory and triggers the pipeline based on the user request. You can introduce a new version or adjust traffic between the canary and production versions of an application or teardown a version of an application.

    With the above configuration files in place, any update to the files under the deployment_configs, kubernetes_configs directory in GitHub triggers the pipeline in Azure.

    GitOps-Enabled Canary Deployment of a Sample App

    Assuming that the NetScaler ADC and AKS cluster are set up in the Azure platform with the required Kubernetes service connection configured in the Azure pipelines, let’s now look at the steps involved in achieving canary deployment for a Kubernetes-based app.

    Setting up Azure Pipelines to deploy production version of the application- V1:

    1. Clone the repo and update the image of guestbook application (if required).
    2. Create three Azure pipelines using the existing YAMLs “deploy_cic.yaml”, “deploy.yaml” and “teardown.yaml” for deploying CIC and guestbook application and tearing down the sample guestbook application. Update the subscription details and agent pool details in the pipeline YAML and save the pipeline. Refer to the Azure pipelines documentation for more information on creating a pipeline.
    3. Update deploy_config.json under deployment_configs directory with the path specifying the directory where the application YAMLs are placed.
    4. Git commit deploy_config.json and v1 directory to trigger the pipeline to deploy v1 version of application. Now you can try accessing the application via ADC.

    Introducing canary version of the application-v2

    1. Introduce canary version of the app by creating a v2 directory with the required deployment manifests. Manifests include the ingress definition with the annotation “ingress.citrix.com/canary-weight” specifying traffic split weight.
    2. Deploy version v2 by updating deploy_config.json
    {"K8S_CONFIG_PATH": "cd/canary-azure-devops/kubernetes_configs/v2",}

    Thus the traffic will be split between version v1 and v2 based on the canary weight set in the ingress annotation.

    You can adjust the traffic weight based on the requirement until the canary version is promoted to production. And you can repeat these same steps to introduce newer versions of apps.

    Learn More

    With NetScaler ADC, Ingress Controller, and Azure pipelines, you can create a basic canary deployment or a customized deployment to fit with the tools and technologies that you use for your infrastructure and continuous deployments. These canary deployments help you to limit the risk involved in introducing a new version of an app to your production environment.

    Check out our product documentation for more information about canary deployments and Azure pipelines.


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...