Blue-Inexperienced Deployment to Azure Kubernetes Service utilizing Jenkins

Writer- Anubhav Bisht (Cloud Engineer)

 

Overview

Steady integration (CI) and steady deployment (CD) type a pipeline by which you’ll be able to construct, launch, and deploy your code. Jenkins supplies an entire, absolutely featured set of CI/CD automation instruments for deployment. It’s a self-contained, open supply automation server which can be utilized to automate all kinds of duties associated to constructing, testing, and delivering or deploying software program. Trendy purposes are more and more constructed utilizing containers, that are microservices packaged with their dependencies and configurations. Kubernetes is open-source software program for deploying and managing these containers at scale.

A blue/eco-friendly deployment is a change administration technique for releasing software program code. Blue/eco-friendly deployments, which can even be known as A/B deployments require two an identical {hardware} environments which can be configured precisely the identical manner. Whereas one atmosphere is lively and serving finish customers, the opposite atmosphere stays idle.

This publish describes the right way to setup a Blue-Inexperienced Deployment CI/CD pipeline utilizing Jenkins for deploying a containerized customized Utility working with Azure Kubernetes Service.

Conditions:

  • An Azure account with following companies:
    • An occasion of Linux machine with following set of software program put in:
    • An occasion of Azure Container Registry.
    • An occasion of Azure Cosmos DB with an empty database.
    • An cases of Azure Kubernetes Service cluster.
  • A Jenkins account for performing CI/CD with following plugins put in:
    • Azure Credentials
    • Docker Pipeline
    • Jackson 2 API (2.10.3)
    • Snakeyaml API (1.26.2.)

Code Construction:

You could find the Pattern Code right here and clone it to your native.

Constructing Deployment Mission :

  • Add the Service Principal particulars of your Azure occasion in Jenkins Credentials

  • Add the credentials of Azure Container Registry in Jenkins Credentials

  • Replace the main points within the Jenkinsfile at todo-app-java-on-azure/deploy/aks/Jenkinsfile location

  • Hook up with your cluster utilizing following command

    az aks get-credentials –resource-group –identify

  • Deploy the .yml  information at todo-app-java-on-azure/deploy/aks location to the cluster as

    kubectl apply -f service-green.yml
    kubectl apply -f test-endpoint-blue.yml
    kubectl apply -f test-endpoint-green.yml

  • Within the Jenkins dashboard choose New Merchandise  and choose Pipeline as Mission and choose OK 

  • From the configuration choices choose the next and add particulars accordingly and SAVE

  • Choose the venture and click on Construct Now and let the pipeline construct

  • As soon as the pipeline is completed, you may verify the picture within the Azure container Registry

  • Now go to the Kubernetes cluster and within the left panel choose Companies and Ingress to see the blue/eco-friendly deployment service Exterior IP

  • In the event you browse each the IPs, then, solely IP for todoapp-test-blue will work however not for todoapp-test-green because the software is deployed to solely BLUE  atmosphere

  • Now, go to the Jenkinsfile and alter the atmosphere variable currentEnvironment to eco-friendly

  • Now construct the pipeline once more and refresh the webpage with the IP of todoapp-test-green and it is possible for you to to see software deployed to the GREEN atmosphere as properly

Each, Blue and Inexperienced atmosphere now have similar software deployed. One(let’s say Blue) will likely be within the manufacturing part and different(Inexperienced) will stay idle. At any time when there’s any change to be made then the idle(Inexperienced) one is moved to manufacturing part and adjustments are made to the opposite(Blue) atmosphere in order to maintain the appliance obtainable for public.

Leave a Reply

Your email address will not be published. Required fields are marked *