Application Modernisation and Containerization by Migrating to Kubernetes Cluster
This post explains migration of application from VM based deployments to containers as micro services.
Link to my blog with diagrams: http://j-darwin.blogspot.com/2022/11/containerize-applications-by-migrating.
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:
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:
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:
Create CI/CD Pipeline:
Once the pipeline is ready in Jenkins, the application is deployed in the Pre-Prod Kubernetes cluster.
Recommended by LinkedIn
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:
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:
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:
Hope this helps you to start your application modernization and containerization journey.
-Cheers