Application Modernisation and Containerization by Migrating to Kubernetes Cluster

 This post explains migration of application from VM based deployments to containers as micro services.

For example, the application runs on Java on Linux virtual machines. We need to collect some information about the application to containerize them and run as Docker images.

Application Discovery:

First, we need to do Application Discovery by having meetings with the application developer team to Discover and get the required information, like:

  • Application run environment - whether the app uses java 8/9 etc.
  • Environment variables - which environment variables are used for the application, so that same have to be configured on the container.
  • Configurations - any OS level configurations like directory structure or path etc.
  • Build commands - to collect the commands and parameters to build the application
  • Start/stop commands - commands or scripts required to start and stop the application
  • Ports - the list of ports used by the application while running on a Linux VM, so that the same ports are opened and exposed on the container.
  • Test commands - to collect the commands for testing the application, and sometimes the API's also.
Create Docker Image:

Once the application is understood, we can start writing Dockerfiles to create the Docker image. Then the docker image of the application can be deployed on Docker host. the test Docker Host.

Test the Dockerized application:

We can then test the application on Docker host using the test commands and API's received from the developer team. Many times the application test will fail due to configuration issues, port issues, path related issues etc. To resolve these issues you can go back to developer team to have calls with them and fix those issues until application test is successful

Create Helm Charts:

Once the application is running fine and passed the tests, you can start working on the Helm Charts to prepare to deploy the containerized application on a Test Kubernetes Cluster.

Depending on the microservice many Helm manifests will be created, like:

  • Deployments
  • Replica Sets or Daemon Sets
  • Services
  • Ingress
  • Horizontal Pod Autoscaler (HPA)
  • Pod Distribution Budget (PDB)
  • ConfigMaps
  • Secrets etc.
Deploy the Helm Charts:

You can manually deploy the helm charts on a test Kubernetes cluster. Go through the test cases again and fix any issues until the application runs without errors or other issues like latency etc. 


One all tests are passed, the CI/CD pipeline is created in Jenkins or any existing pipeline is modified. All the steps that were done manually in previous sections and automated:

  • Creating the Docker Image
  • Scanning the docker image
  • Pushing the image to private docker repository
  • Deploying to the Kubernetes cluster
Create CI/CD Pipeline:

Once the pipeline is ready in Jenkins, the application is deployed in the Pre-Prod Kubernetes cluster.

Pre-Prod Rollout - Partial Deployment:

The application is only deployed partially, means, only some containers in K8s, and other instances on traditional VMs. This is because we don't know how the application will behave when load is there. 

Hyper care period:

There is a hyper care period of a few days to thoroughly test the partial deployment to ensure all tests are passed, before the production deployment.


The purpose of using the VMs is to validate the application running on pods behaves exactly the same as the application running on the VMs.

During the hyper care period following tests are conducted:

  • Latency
  • Success rate
  • Memory & CPU utilization
  • Network utilization
  • Disk I/O
  • Number of container restarts
  • Other application errors, etc.
Pre-Prod Rollout - Full Deployment:

Once the application tests are successful on the partial deployment, the full deployment happens again on Pre-Prod environment (as earlier it was a partial deployment only). In the full deployment the application is deployed on the Pre-Prod cluster, the VM deployment is skipped. Now the same test cycle is repeated for the full deployment, until all tests are successful.

Production deployment:

During the full deployment, you can start customizing the Helm charts for production deployment, because the production might differ from the pre-prod environment.

Handover to application & operations team:

Once the application is running on production cluster, handover phase starts. The application team and operations team are contacted and handover is done on following points:

  • Knowledge transfer on the new Kubernetes environment
  • Provide information on changed configuration - where to perform config changes
  • How to apply new config changes
  • Any new issues observed
  • How to deploy new version of the application
  • How to rollback to previous version in case of issues on production, etc.
Agile Practice:

All above is performed through the Agile practices, and it is encouraged that you familiarize yourself with Agile way of working for the containerization projects. You can go with Agile concepts:

  • Epic
  • Sprint
  • Scrum Master
  • Burndown charts
  • Estimation

Hope this helps you to start your application modernization and containerization journey.

-Cheers

Comments

Popular posts from this blog

Install Puppet Client on RHEL 6.4

Install IBM Tivoli TSM 5.5 Backup Server (trial) on your Laptop using Linux KVM virtual machine

IBM TSM Client 5.x install (trial) on your Laptop using KVM Virtual Machines