Cloud Computing, DevOps, Kubernetes

7 Mins Read

CI/CD Pipeline for Kubernetes using Devtron

Voiced by Amazon Polly

Introduction

CI/CD (Continuous Integration/Continuous Deployment) is a software development methodology that focuses on automating the entire software development and deployment process to ensure fast and efficient delivery of high-quality software applications. Kubernetes is a popular container orchestration platform that allows developers to deploy and manage their containerized applications.
CI/CD for Kubernetes involves integrating the Kubernetes platform into the overall CI/CD pipeline, enabling developers to test, build, and deploy their containerized applications seamlessly. The key components of CI/CD for Kubernetes include source code management, continuous integration, automated testing, containerization, and continuous deployment.

Source code management involves using version control systems like Git to manage the application’s source code. Continuous integration involves regularly integrating changes to the source code into a shared repository. Automated testing involves using automated tests to ensure the application functions correctly.
Containerization involves packaging the application code and its dependencies into containers that are easily deployed and run in any environment. Kubernetes provides a platform for managing and orchestrating these containers. Continuous deployment automatically deploys the containerized application to various environments: development, staging, and production.
CI/CD for Kubernetes provides several benefits, including faster release cycles, improved collaboration among development teams, improved quality of code, and reduced errors and bugs. Additionally, it enables developers to focus on writing code rather than managing the deployment infrastructure.

Customized Cloud Solutions to Drive your Business Success

  • Cloud Migration
  • Devops
  • AIML & IoT
Know More

Devtron and its features

Devtron is an open-source, cloud-native platform designed to simplify the deployment and management of containerized applications on Kubernetes clusters. It provides developers with an easy-to-use interface for managing their application deployments and simplifies deploying, scaling, and updating their applications on Kubernetes.

Devtron offers various features that make it an attractive option for developers looking to simplify the deployment and management of their applications. One such feature is the ability to deploy applications directly from Git repositories, allowing developers to deploy their code directly from their code repositories.

Another essential feature of Devtron is managing multiple environments, such as development, staging, and production, from a single interface. This feature enables developers to manage their deployments across different environments and ensures that the deployment process is consistent across all environments.
Devtron also provides an intuitive user interface that simplifies the deployment process and makes it easier for developers to manage their applications on Kubernetes. The platform offers various deployment strategies, including rolling updates and canary deployments, that enable developers to deploy their applications with minimal downtime.

In addition to deployment, Devtron also provides features for monitoring and logging, making it easier for developers to troubleshoot issues and debug their applications. The platform integrates with popular monitoring and logging tools such as Prometheus, Grafana, and Fluentd, providing developers with a comprehensive view of their applications’ performance and health.

Overall, Devtron is an excellent platform for developers looking to simplify the deployment and management of their applications on Kubernetes clusters. Its intuitive user interface, deployment strategies, and integration with monitoring and logging tools make it an attractive option for teams looking to streamline their deployment processes.

Steps to Create CI/CD Pipeline for K8s using Devtron

In this blog, I will build a CI/CD pipeline for a single microservice application in this article. Kubernetes clusters with devtron installed should be pre-requested. By using their official instructions (https://docs.devtron.ai/install/install-devtron-with-cicd), you can install Devtron.

Architecture of the pipeline

AD2

Step 1 – Setup GitOps on Devtron

I have my source code and Docker file in GitHub, to use Devtron with GitHub, we need to generate a personal access token on GitHub. This can be done by going to the Settings menu, then selecting Developer Settings, followed by Personal access tokens. Click on the Generate new token button to create a new token. Devtron must write access to the account repositories to create a new repository and make necessary changes. Also, you need a GitHub organization account.

Go to Global Configuration in Devtron, choose GitOps, select GitHub, and provide the required credentials.

step1

Step 2 – Create Environments

Go to Cluster and environment and add your environment like staging, production, etc.

step2

Step 3 – Add Git Account

Go to the Git Accounts tab, where you can add your Git accounts by providing credentials.

step3

Step 4 – Setup Container Registries

We use the AWS Elastic container registry to store our images in this demo. To provide ECR access to devtron, we must create one IAM user with full ECR access. Then we have to update this IAM user access and secret key in devtron

  1. Create an IAM user with ECR full access (AmazonEC2ContainerRegistryFullAccess)
  2. Create an ECR private repository

Switch to the Container Registries tab and fill in the registry details and provide IAM user access and secret key.

step4

Step 5 – Create an Application

Go to the Application tab in devtron, click create a button in the top right, and provide the application name. Choose project.

step5

Step 6 – Configure the Git repository

In app configuration, click Git repository and choose your Git account and provide your repo URL, then click next.

step6

Step 7 – Configure Build Configuration

Here choose your container registry and provide your repository name. In the below section, provide your Dockerfile path.

step7

If you want to edit the base deployment template, you can edit by editing advanced yaml generated by devtron.

Step 8 – Setup Workflow

In the workflow, choose to Build and deploy from the source code.

step8

In the Build pipeline, provide your Git branch name where your source code is available, then create a pipeline.

step8b

After creating the build pipeline, click the plus symbol at the end of the build stage to create a deployment pipeline.

step8c

In the deployment, pipeline choose your environment, then create a pipeline

step8d

After the deployment pipeline is created, choose to Deploy this app on the test

step8e

In Build & deploy window, click select material and start the build.step8f

After successfully building your image, it will push it to the image repository you provide. Then you can click select the image in the build & deploy section and deploy the image.

step8g

To verify the deployment status over devtron dashboard and cluster Jump host

step8h

step8i

I have exposed my deployment through ingress, so we are verifying the application functionality in the browser.

step8j

 

Roll out in Devtron

Rolling out in Devtron involves deploying a new version of an application or service to a Kubernetes cluster using Devtron, here I have modified my source code in GitHub and committed to the main branch.

dev1

Now we can see in the CI stage there is a new code commit in a git repo, so it is started the build and pushed a new version image to ECR, and it is deploying the new version image

dev2

After deploying a new version of our application, we can see the difference in the application through the browser

dev3

Rollback in Devtron

You can roll back your application by clicking the rollback button, and you can see the list of old images and choose the required image and deploy.

dev4

dev5

Conclusion

Devtron is a powerful deployment platform that simplifies deploying and managing applications in a Kubernetes cluster. Its user-friendly interface and intuitive workflow make it easy for developers to create, configure, and deploy applications without requiring extensive knowledge of Kubernetes.

Devtron is a valuable tool for developers looking to simplify the deployment process and improve their overall application management workflows. Its robust feature set, ease of use, and tight integration with Kubernetes make it a top choice for teams looking to deploy and manage applications in production environments.

Get your new hires billable within 1-60 days. Experience our Capability Development Framework today.

  • Cloud Training
  • Customized Training
  • Experiential Learning
Read More

About CloudThat

CloudThat is also the official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner and Microsoft gold partner, helping people develop knowledge of the cloud and help their businesses aim for higher goals using best in industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.

Drop a query if you have any questions regarding CI/CD Pipelines and I will get back to you quickly.

To get started, go through our Consultancy page and Managed Services Package that is CloudThat’s offerings.

FAQs

1. Is Devtron open source?

ANS: – Yes, Devtron is an open-source project available on GitHub under the Apache 2.0 license. You can install devtron by following their official documentation (https://docs.devtron.ai/install/install-devtron-with-cicd).

2. What kind of support is available for Devtron?

ANS: – Devtron provides community support through its GitHub repository and documentation. Commercial support is also available through the Devtron team.

3. Can Devtron be used with any Kubernetes cluster?

ANS: – Yes, Devtron is designed to work with any Kubernetes cluster, whether in the cloud or on-premises.

WRITTEN BY Harikrishnan S

Harikrishnan Seetharaman is a Research Associate (DevOps) at CloudThat. He completed his Bachelor of Engineering degree in Electronics and Communication, and he achieved AWS solution architect-Associate certification. His area of interest is implementing a cloud-native solution for customers and helping them by proving robust and reliable solutions for their complex problems, DevOps, and SaaS. Apart from his professional interest he likes to spend time in farming and learning new DevOps tools.

Share

Comments

  1. karthick

    Feb 28, 2023

    Reply

    awesome, since AWS is not directly supporting EKS deployment through its native pipeline solutions this tool will help lot.

  2. Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!