Continuous Deployment with Microservices using Kubernetes and Jenkins

What is a Microservices?
Before understanding Microservices, let’s discuss about Monolithic.

In a monolithic architecture, all code is in one principal executable file which can be tougher to troubleshoot, test and update.

Hence, we can deploy the code base of our system in a project and any updates in the system will be applied using a continuous integration (CI) pipeline can be adopted in a continuous deployment (CD) pipeline to deploy the system continuously into production environment. Under such circumstances, the CI or CD pipeline will execute every change introduced into the system. For instance, implementing an updating on the current system will require:

However, the deployment time may be significantly longer for larger systems.

Now, coming to Microservices, when we split a monolithic system into multiple microservices and deploy every service independently then every code change introduced to the system will only effect the individual service. Now, we just need to deploy the changed service and re-run CI or CD pipeline of the service. The total time taken for successful deployment is as listed below:

After splitting, we can better meet the decoupling requirements by minimizing the required changes when a code change is introduced. However, since the services are split, major effort is necessary for independent deployment of every service.

In microservices scenarios, different services may adopt different technologies based on demands and each service requires its own CD pipeline. Therefore, creation of a new service necessitates frequent configuration of the supporting logs and monitoring systems, posing a huge challenge for CD.

What is Continuous Deployment?

Build and test your code automatically. If tests pass – make your application available for deployments, deploy it to a test environment and verify whether the deployment was a success or not. If the test deployment was a success, promote that code to  production.

Let’s take an example of Web Application developed on Java Language using spring boot framework which splits into 3 Microservices:

  1. ShopFront
  2. ProductCatalogue
  3. StockManager

Prerequisite for Continuous Deployment (CD) with Microservices using Kubernetes and Jenkins pipelines according to our use case: –

To achieve continuous deployment according to our above Web Application example

Let’s say that when a Development Team make any changes in any of the services, it creates Jenkins pipeline to achieve continuous deployment end-to-end.

The Pipeline should like

Benefits of Using Continuous Deployment

  1. Users can fix, update, improvement new features in their hands early and often. The “patch” and upgrade cycles are integrated into daily usage, not spaced out in major releases.
  2. Internal Managers (Like Product owners for individual lines of business can do marketing campaigns, etc.) can see their projects decoupled from all the other projects in the organization, therefore they are ready to be presented to end customers immediately as soon as it is ready, not dependent on numerous other variables or “release trains.”
  3. Make deployments frictionless without compromising security.
  4. Scale from a single application to an Enterprise IT portfolio.
  5. Connect your existing tools and technologies (such as CI providers, DevOps tools, or scripts) into a harmonious workflow.
  6. Integrate teams and processes with a unified pipeline.
  7. Create workflows across the development, testing and production environments
  8. Provide a single view across all applications and environments.
  9. Ship both cloud-native and traditional applications into a unified pipeline.
  10.  Improve overall productivity.


Setting up the continuous delivery pipeline and automating testing is extremely challenging in monolithic architectural styles. This is mainly because of dependencies. Services aren’t independent the entire logic is within the pipeline.

With microservices, software teams can test separate components and prevent risky deployments. In microservice architecture, the entire logic is transferred from the pipeline to endpoints making services independent. Moreover, without microservices – a lot of dependencies have to be met to prepare various environments for testing. The microservice architecture enables development teams to set up these environments quickly, deploy fast and automate the complete cycle.

Microservices improve the traditional delivery approach and ships release specific to services and components making the entire release safe, cost-effective and quick to debug.

Kubernetes help to deploy docker containerize application that can be scalable, Load Balanced, maintained in the docker networking and blue/green (B/G) deployment strategy that will deploy the build on production without any downtime can also give one of the major benefit that it can follow a canary workflow which helps to route the customer to use the latest deployed application.

Microservice architecture has resolved this complexity and helped many product companies to build loosely coupled services that could be changed, scaled and easily managed. With the entire application divided in various small set of services, each running on its own but communicating with each other through APIs – understanding application becomes a lot easier.

It also enable DevOps and helps companies to focus on zero-downtime, continuous integration and deployment. With so many benefits, microservices are gaining traction and here to stay for long.

Author : Rishabh Gupta


Get A Free Quote