Jenkins (CI-CD) on Kubernetes Operations (KOps)

Introduction

There's a new change that is being implemented in organization – them migrating their traditional models-based delivery processes to the DevOps model. Clearly, opting for the best technology available in the market is a priority for enterprises today.

One solution that is actively being sought and adapted to by organizations is cloud (technologies) with microservice architecture. The aim is to containerize application(s) and use the DevOps model for continuous integration and delivery, using tools such as Docker and Kubernetes for container orchestration.

Use Case/Scenario

Think of a scenario where a product needs to include web applications which are meant to be light weight and fast, such as MEAN stack or full stack; where there are constant changes with respect to the market; where new changes are expected to be part of product because this product has to be released to consumers. Along with this, take addressing maintenance and, versioning of changes into account too.

In the traditional model, development, testing, build, deployment and production releases are each separate processes. Some of these are handled manually, resulting in slowing their completion.

Challenges

The current model, if adopted without implementing DevOps, includes a number of tasks which are carried out manually. For instance, building the code, testing it, deploying the specific changed version(s) of the code, deployment in a specific environment, version maintenance, rollback handling, and finally production deployment.

Manual intervention in each individual process adds to the time taken to complete it, apart from not guaranteeing agility.

Proposed Solution

To migrate from the tradition workflow to implement DevOps methodology in projects; considering microservice-type architecture instead of monolithic architecture for better advantages; migrating a project or products from on-premises servers to cloud servers – all three are considerations which help in being cost effective.

Consider a simple Nodejs and Reactjs based with mongo database web applications which can be exposed as an application though Nginx ingress. These web apps are designed with microservice architecture, and so, the aforementioned challenges can be overcome by containerising the application using Dockers and through open source tools - such as Jenkins - automating continuous integration and delivery. The goal is to use helm for versioning and package management and finally, Kubernetes for container orchestration on AWS Cloud servers.

Prerequisites:Kubernetes cluster has to be brought up for the deployment process as a prerequisite. Kubernetes cluster must have a master and a slave node type server availability, where the master node will maintain the assigning of an application to specific available nodes based on CPU requirements. This process is seem less and highly available.

Using Kubernetes orchestration for applications, a blue green deployment can be managed (deployment without downtime).

Mentioned below are Kubernetes services for different cloud providers:

  • Kops (Kubernetes operations) for AWS
  • ACS or AKS (Azure Kubernetes service) can be used in Azure
  • GCE (Google compute engine) – Kubernetes for GCE

Development: To develop web applications which are fast, REST APIs with responsive UIs for front end by using nodejs and react js/angular js for full stack development

Repository: GitHub can be used as a code repository and to handle branches

Packaging: Helm is a Kubernetes packaging manager which can be used to maintain the microservice as a deployment package to deploy on Kubernetes cluster(s). These packages can also be maintained on Git repositories

Continuous Integration and Continuous Deployment: Open source tools like Jenkins can be used to provide continuous integration and continuous delivery/deployment, wherein a pipeline can be built for each process to build, test, deploy and finally deliver.

  • Build: These microservice-based applications are built as Docker images and these images can be stored in Docker Hub (open source)
  • Test: As part of pipeline application, specific basic testing can be done
  • Deploy: The recent most built Docker image can be pulled to server and deployed as a pod (container) on the Kubernetes cluster

Pipeline: All the above steps can be automated through Jenkins using Jenkins pipeline.

Step1: On code commit on any code repository, integrate the code repo with Jenkins and pull the changed code on to the master server

Step2: Build a Docker image with changed code, version the image and push the Docker image to any registery (eg: can use Docker hub)

Step3: Deploy the newly built Docker image as a container (pod) on the Kubernetes cluster as a helm package (versioning and rollback can be handled though helm)

Step4: Test

Step5: On test success, this gets finally deployed to production automatically. Alternatively, this step can be completed with manual go

Limitations

Kubernetes orchestration works well for web applications which are completely on the cloud. Even though on-premises orchestration can be handled using RKE and other available solutions which seem a bit complex, the high availability and seamless implementation of applications are handled well and easily for cloud deployments.

Tags: Cloud

You might also like...

Reverse Proxy’ing’ requests with the AWS ELB edge
One of our clients once reached out to us for help with deep inspection of traffic that was reaching its web servers, mostly from the compliance perspective.

Continue Reading >

The revolution that is Cloud Computing
Remember the days when we had to carry floppies, USBs and hard disk drives to access stored files? Well, times have changed, and how! Cloud computing has revolutionized the way enterprises manage,…

Continue Reading >

Overcoming cloud migration obstacles
During cloud infrastructure migration from one AWS account to another,  services like VPC, EC2, etc and the content in storage services like S3 buckets should also be moved. However, application-…

Continue Reading >