Effortless Helm chart management with Devtron

Devtron

Devtron is a Kubernetes native CICD tool that simplifies the process of deploying applications to Kubernetes through CICD pipelines that are defined in a simple and user friendly UI. Devtron is also GitOps aware and provides inbuilt vulnerability scanning for images as a part of the CI. Although Devtron is primarily a CICD tool, it also provides helm chart management as well.

Helm charts

Helm charts are Kubernetes native way of packaging applications. A helm chart contains the necessary Kubernetes manifests for deploying an application in Kubernetes. The variables necessary for customizing the deployment of the application are defined in a file, which is usually called values.yaml.

Installing Devtron

In this blog, I will be using a single node EKS cluster to deploy Devtron using helm. Devtron can either be installed with the CICD module or without the CICD module. According to the Devtron docs, we will require 2CPUs and 6GB memory and hence we will go with the instance type of t2.large. The cluster can be created using eksctl as follows -

eksctl --region ap-south-1 create cluster --name devtron-labs \
        --node-type t2.large --nodes 1

Once the cluster is created, we can install Devtron using helm as follows -

helm repo add devtron https://helm.devtron.ai

helm install devtron devtron/devtron-operator \
--create-namespace --namespace devtroncd \
--set installer.modules={cicd}

More options for installation is available in the Devtron docs.

We can verify if Devtron was successfully installed using -

kubectl -n devtroncd get installers installer-devtron -o jsonpath='{.status.sync.status}'

The above command should return Applied to consider the installation complete.

Note that the installation will take around 20-30 minutes to complete since it installs quite a few components such as ArgoCD, Grafana, etc.

Access Devtron

Once the installation is complete, we can get the URL for the Devtron dashboard using -

kubectl get svc -n devtroncd devtron-service \
-o jsonpath='{.status.loadBalancer.ingress}'

Visit the URL from the output of the previous command. The password for the admin login is retrieved by running the following command -

kubectl -n devtroncd get secret devtron-secret -o jsonpath='{.data.ACD_PASSWORD}' | base64 -d

Login to the Devtron dashboard with the username - admin and the password from the previous command.

Managing helm charts

Once logged in, navigate to the Global Configurations section of the dashboard from the sidebar on the left using the ⚙(gear) icon.

Set the host url for the Devtron dashboard. You can use the URL from the browser by clicking on the URL suggested by Devtron and clicking on Save.

We will be using Devtron to install and manage the helm chart for an open source Kubernetes security tool called Kubescape. We will install this tool in the namespace called armo-system. To create a namespace where Devtron can install an application/helm chart, click on Clusters & Environments from the left sidebar in the Global Configurations section of the dashboard. Click on Add environment and enter armo-system for the Environment name and Namespace. Select Non-production and click on Save.

Add environment

Devtron provides a set of default chart repositories such as Bitnami, Elastic, Prometheus and a few others. To add a custom repository, click on Chart repositories from the left sidebar in the Global Configurations section of the dashboard. Click on ➕ Add repository and enter the following details for the repository -

Name - armosec

URL - https://armosec.github.io/armo-helm/

Click on Save to save the repository on Devtron. Click on Refetch charts once saved.

Add chart repository

Once the refetch charts is triggered, wait for the completion of the refetch before proceeding. Check for the status of the refetch job using kubectl as follows -

kubectl get jobs -n devtroncd

Wait for the job app-manual-sync-job to complete.

Installing helm charts

Once the custom helm repository is configured in Devtron, we can use Devtron to install charts from the custom repositories. Navigate to the home of the Devtron dashboard by clicking on the Devtron icon in the top left. Click on Create from the top right and select 🔆From Chart Store.

You can find all the helm charts from all the repositories configured in Devtron including the default charts. Filter the charts by repositories using the Repositories dropdown and filter by armosec.

Filter by repositories

Let's look at the helm chart by clicking on the helm chart card. The chart view will contain all details about the chart including the README, version, digest, created date, etc.

Click on Deploy to deploy the chart on any of the clusters configured with Devtron. Before deployment, Devtron asks for the App Name, Project and Deploy to environment, Chart Version and Chart Values. On the right, we can configure the values for the helm chart. These values can be saved for further deployments as well by clicking on the Chart Values dropdown and clicking on ➕Create Preset Value.

To keep things simple, we will not be going down that route and configuring the values in the editor on the right instead. We will be adding 2 values to the YAML file -

# Customer Specific Data
accountGuid: "441qocd3-q6c0-4e24-5816-pzac8606fge0"
clusterName: "devtron-blog"

The value for the accountGuid can be fetched by creating an account on the Kubescape SaaS and following this guide to fetch the accountGuid.

Enter armosec for the App Name, devtron-demo for the project and armo-system for the environment. Click on Deploy once done.

Chart Visualization

Once the chart is deployed, we are navigated to the chart deployment view where we can find all details about the deployed chart such as the K8s resources created, status, chart name and the logs in the App details.

Chart Visualisation

We can also look at the values used for the deployment along with the deployment history. We can update the values and re-deploy using a single click and track deployments, all without having to interact with the kubectl command.

The Helm Apps feature of Devtron is feature rich as it helps to monitor and track helm chart deployments with a granular focus such as looking at the manifest or events of each individual Kubernetes resource that is created through the helm chart.

Devtron also allows installation of applications using a custom helm chart apart from publicly available helm repositories.

Devtron provides an excellent user interface for managing helm charts along with a good user experience. Although Devtron consumes a lot of cluster resources and time during installation and sync jobs, it is well worth the investment due to the experience for CICD and helm deployments.

Thank you for reading 🌞


Above blog is submitted under 'Blogathon Contest 2022' conducted by Devtron

Check out their Github repo ⭐ : https://github.com/devtron-labs/devtron

Follow them on: LinkedIn, Twitter

4
Subscribe to my newsletter

Read articles from Avinash Upadhyaya directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Avinash Upadhyaya
Avinash Upadhyaya