DEV Community

Cover image for Devtron : Deploy your applications over k3s, Lightweight Kubernetes, in no-time
Abhinav Dubey
Abhinav Dubey

Posted on • Updated on

Devtron : Deploy your applications over k3s, Lightweight Kubernetes, in no-time

In this blog, we will set up Devtron over k3s - Lightweight Kubernetes. If you haven't heard about Devtron yet, let's take a moment to walk you through it. Devtron is an open-source AppOps solution that caters and supports end-to-end software delivery workflow for Kubernetes, written in Go. It can be used for the deployment of your applications over Kubernetes through simple configurations over user-intuitive UI.

GitHub logo devtron-labs / devtron

Tool integration platform for Kubernetes

Why k3s?

Devtron is cloud-agnostic and can easily be installed over the k3s cluster. Let’s understand about k3s - Lightweight Kubernetes, shall we? It is essentially a lightweight version of Kubernetes that can be installed in a binary less than 100MB. It can be installed as a single-node as well as multi-node cluster and is fully compatible and production-ready Kubernetes distribution.
Some of the advantages of having k3s cluster are -

  • Less System Resources
  • Quick Cluster Setup
  • Easy to add Worker Nodes (k3s-agent)
  • Lightweight
  • All features as that of k8s

K3s Cluster Setup

Before we get started and install Devtron, we need to set up the k3s cluster in our servers. We will be setting up a single node cluster. Please execute the following commands to set up the single-node k3s cluster for Devtron.

The only thing we need to do is set up the k3s server/master node where the necessary configuration files will be installed. The command below downloads and sets up the master node in the server with an extra flag for setting up the right permission of the KubeConfig file.

curl -sfL https://get.k3s.io | sh -s - --write-kubeconfig-mode 644
Enter fullscreen mode Exit fullscreen mode

Please note that the below command is not mandatory for setting up the k3s cluster, but for Devtron installation, we need to deploy the local-path-storage as it will create hostPath to dynamically provision Persistent Volume (PV) based on Persistent Volume Claim (PVC) for Devtron installation.

kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml
Enter fullscreen mode Exit fullscreen mode

Congratulations! You have successfully set up the k3s cluster. To verify the nodes, please execute the command - kubectl get nodes, it will result in the nodes which are created. For the single cluster setup, you will find only one node as control-plane,master.

[Note: You need to deploy all the commands in the same cluster where the master is being installed]

System Configurations for Devtron Installation

  • 2 CPUs+ cores
  • 4GB+ of free memory
  • 20GB+ free disk space

Devtron Installation

After the cluster is successfully set up, we are ready to go with the Devtron installation over it. Installing Devtron is quite a straightforward process with just a few commands. It can be installed using helm3, helm2, and kubectl. For this particular demonstration, we will be using helm3. If you haven’t installed helm3 in your k3s cluster, please follow along -

Helm3 Setup

Before moving ahead, let’s set up helm3 in our cluster. The helm3 can be installed in the traditional way. Please follow the commands for installation -
The below command will download the helm3 installation script on our server.

curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
Enter fullscreen mode Exit fullscreen mode

Making the script executable so that we can run the helm3 installation script.

chmod 700 get_helm.sh
Enter fullscreen mode Exit fullscreen mode

The command below will execute the installation script and download helm3 on our server.

./get_helm.sh
Enter fullscreen mode Exit fullscreen mode

To make the helm interact with the k3s master, we need to set up the path of the KUBECONFIG file. Please execute the following command -

export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
Enter fullscreen mode Exit fullscreen mode

For detailed information about the KUBECONFIG file in the k3s cluster, please refer to this documentation.

Devtron Installation

Now, as we have successfully set up our cluster for Devtron Installation, please execute the following commands, and let’s complete the Devtron installation with just a few simple commands -
The command below will add Devtron repo in helm known repositories

helm repo add devtron https://helm.devtron.ai
Enter fullscreen mode Exit fullscreen mode

The below command will install Devtron in the provided namespace, i.e., devtroncd. The install command initiates Devtron-operator, which spins up all the Devtron micro-services one by one in about 15-20 mins.

helm install devtron devtron/devtron-operator --create-namespace --namespace devtroncd
Enter fullscreen mode Exit fullscreen mode

To check the status of the installation, please execute the following command. If the installation is still in progress, it will print Downloaded. And when the installation is complete, it prints Applied.

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

After the installation, we need to access the Devtron dashboard with the right credentials. For this blog, we will be using the concept of NodePort as service type to access the dashboard. Please execute the following command and edit the type from LoadBalancer to NodePort.

kubectl edit svc devtron-service -n devtroncd
Enter fullscreen mode Exit fullscreen mode

The command will open the editor for you. Press i for insert mode, change type from LoadBalancer to NodePort and then enter :wq to save and exit the editor mode.

To verify that the changes have been made, please execute the following command. It will give all the services running with their port number. For Devtron-service, please note down the port number given. It will be used for accessing the dashboard.

kubectl get svc -n devtroncd
Enter fullscreen mode Exit fullscreen mode

After changing the type to NodePort, we are now ready to access the dashboard. To do so, type the IP of the server with the port number given for devtron-service.

[Note : The NodePort port must be added in the security group of your instance.]

In my case I am using AWS so here's how you can add the NodePort number or range in the security group of your instance.

Step-1 : Check the instance, click on security group under the the security tab, as shown below.

security-group

Step-2 : Click on the edit inbound rules as shown in the image below.

inbound-rules

Step-3 : Now you need to add rules as per your requirement. In our case, we need to add a rule of type Custom TCP and then enter the range of NodePort or specific NodePort port which you got for devtron-service and then click on Save-rules. Also for security reasons you can add the source as per your requirement. 0.0.0.0/0 is for anywhere, means it can be accessed by anyone from any IP.

rule-add

Now we would be able to access the dashboard with IP:NodePort-Port/dashboard. For admin credentials, the username is admin , and for password, run the below command.

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

Kudos! We have successfully installed Devtron in our single node k3s cluster and accessed the dashboard. For any doubts, feel free to comment down or read the official documentation of Devtron.

What Next?

Now that we have configured the k3s cluster and successfully installed Devtron over it, we are ready to begin our first app creation and deployment through Devtron. The Application Deployment process needs a dedicated blog by itself. Feel free to check out our documentation for a detailed understanding of App Deployment along with the Configuration of Devtron after installation. You can also have a look at this video for detailed understanding of Devtron's features.

Top comments (0)