December 16, 2022

Argo CD using Helm

Table of Contents

Argo CD and Helm charts streamline Kubernetes deployments by automating and managing application states through GitOps. This integration simplifies complex deployments, promotes consistency, and enhances productivity by leveraging the strengths of both tools.

The GitOps approach to application deployment has become very popular as it is straightforward to use and removes many bottlenecks for developers. Using the open source project Argo CD and Helm Charts to manage Kubernetes applications make GitOps easy.

In this article, we will walk through how GitOps can be implemented using Argo CD with Helm charts. Using this approach, we will show how to deploy a simple application and Helm charts. 

Argo CD & Helm Chart

GitOps works as a modern continuous delivery (CD) model where a GitOps agent is used between the Git and target environment (for example, Kubernetes) where applications are deployed. GitOps also keeps track of all the changes that happen in Git. 

If there is any change, the GitOps agent pulls the changes to match the expected configuration. The agent compares the actual and desired state. For example, when a developer changes pod numbers in a yaml file from 2 to 4, the agent compares the two states, and when the change gets identified, it pulls the changes to make the two states (actual and desired) the same. Argo CD and Kubernetes make a great pair when it comes to a well thought out GitOps approach.

Using Argo CD and Helm Charts together work very well when it comes to GitOps. You can easily deploy applications on Argo CD using Helm. They both make a powerful cloud-native combo in helping enterprises with their software delivery. Kubernetes has become a de facto container orchestration tool that every organization wants to adopt and speed up the deployment of their applications. But, Kubernetes alone won’t be able to make a difference; you should adopt a cloud-native approach like GitOps to make sure you are on the right path. 

Along with the tools like Argo CD and Helm, you can reap the benefits of deploying software with speed. While Argo CD is a true GitOps tool, Helm is used to deploy Kubernetes applications. With both in your software development lifecycle, you can do wonders.

What is Argo CD?

Argo CD is a declarative, GitOps-based continuous delivery tool that helps you deploy applications from Git, manage their lifecycle, and keep your environment in sync. By choosing Argo CD, you can keep your deployments up to date and ensure that your application always follows the desired state. Argo CD allows you to define your applications and their environments as code and then deploy and update them on any Kubernetes cluster.

What is a Helm Chart?

While Kubernetes has become the de facto container orchestration tool for modern cloud-native enterprises, the learning curve is high as it is a complex tool for some. The process of configuring and deploying an application on Kubernetes can be a daunting task. Fortunately, with Helm and Helm Charts, it is now possible to automate the deployment process and quickly deploy and manage applications on Kubernetes. 

Helm is an open-source tool that helps you manage Kubernetes applications. Helm Charts are packages of pre-configured Kubernetes resources that can be deployed quickly and easily. With the help of Helm and Helm Charts, developers can streamline their Kubernetes deployment process and quickly get their applications up and running. 

Helm charts provide a way to package and distribute Kubernetes applications in a standardized format, making it easier to share and deploy applications across different environments. Charts can be shared through a public or private chart repository, or they can be stored locally for internal use.

Using Helm charts allows developers to define and configure their application once, and then deploy it consistently across different Kubernetes clusters or environments. This helps to reduce configuration errors and simplify the deployment process, as well as promote reusability of configuration across different teams and projects. Helm charts can be customized and extended to fit the specific needs of a particular application or environment. This can be done by overriding default values in the chart, or by creating custom templates and configuration files.

Overall, Helm charts provide a powerful tool for managing Kubernetes applications, simplifying the deployment process, and promoting consistency and reusability across different teams and projects.

Argo CD Versus Helm 

Both Argo CD and Helm are popular open-source tools for managing and deploying cloud-native applications, but they have some major differences. Let's take a look at the three main differences between Argo CD and Helm.

1. Application Deployment

The first difference between Argo CD and Helm is how they deploy applications. Argo CD is a CD tool/platform that can be used to deploy applications to multiple environments. Helm is a package manager that can be used to deploy applications to a single environment. Hence, Argo CD is better suited for more complex deployments, and Helm is better suited for simple deployments.

2. Application Management

The second difference is how they manage applications. Argo CD is a GitOps-based tool, which means that it uses Git as a single source of truth and uses it as a focal point to store and track application configurations and manifests. This makes observability easier, and you can roll back to previous versions if needed. Helm considers Helm charts as a focal point to manage and deploy applications, and the changes must be tracked manually.

3. Scaling Applications

The third difference is how they scale applications. Argo CD is designed to scale horizontally and can easily be deployed to multiple clusters. With Helm, you can only deploy to a single cluster. Argo CD is well suited for large-scale deployments, and Helm is well suited for small-scale deployments.

How to Use Argo CD with Helm Charts

Now that we've taken a look at Argo CD and Helm, let's explore how to use Argo CD with Helm charts:

  1. The first step is to have a Kubernetes cluster up and running
  2. Create a namespace to store all our Argo CD related deployments. 
  3. Install the Argo CD CLI on your local machine to interact with the Argo CD instance and manage your applications
  4. Deploy Argo CD and manifests onto your Kubernetes cluster and access the Argo CD UI via your preferred method (we will be using the port forward method in our tutorial) 
  5. Log in to your Argo CD from the UI with the username and password (we will show it in our tutorial below)
  6. The next step is to install the Helm command line interface (CLI) on your local machine. This will allow you to interact with your Helm charts. 
  7. Once the Helm CLI is installed, you can then connect to your Argo CD instance and configure it to use Helm charts. 
  8. Finally, you can then use Argo CD to deploy your applications using Helm charts. This will allow you to quickly and easily manage and deploy your applications. 

Tutorial

For this tutorial, the only prerequisite is to have access to a Kubernetes cluster. You can also use Minikube or Kind to get a one-node cluster.

First, create a namespace: 

kubectl create namespace argocd

Apply the manifest file to the namespace created: 

kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
a screenshot of a developer applying the manifest file to the namespace created

Make sure all your pods are running properly inside the namespace:

kubectl get pods -n argocd
screenshot of a developer running pods properly inside the namespace

Now, let’s expose our ArgoCD server UI through port forwarding:

kubectl port-forward svc/argocd-server -n argocd 8080:443

Once you do that, you can now see the ArgoCD UI on https://localhost:8080/

Argo CD login in screen

Now, you need a username and password to log in. By default, the Username is ‘admin’ and the password can be generated using the following command:

kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo

You will get an output to use as your password. Once you have the username (admin) and the password, login to ArgoCD.

Argo CD UI

Also, make sure you can use Argo CD locally via CLI, hence install the Argo CD CLI: 

brew install argocd

Now, you can login and talk to your Argo CD via CLI:

argocd login localhost:8080

It will ask you for the username and password. Set both, and the login will be successful.

Deploying Application via Helm to Argo CD

Reference the Argo CD example repo to deploy a guestbook application via Helm.

Let’s create an application on ArgoCD.

argocd app create helm-guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path helm-guestbook --dest-server https://kubernetes.default.svc --dest-namespace default

You should see the application getting created:

application 'helm-guestbook' created

Let’s check the status of the application created:

argocd app get helm-guestbook

You can see that both Service and Deployment are in OutOfSync status. Let’s sync the application with the following command:

argocd app sync helm-guestbook
syncing in Argo CD application

You can now see that the health status of our Service is Healthy and Deployment is Progressing. The Deployment will take some time and becomes Healthy.

You can verify the created application on Argo CD by going to the UI.

Argo CD Helm Chart

Here you can see that the status is Healthy and Synced.

By doing the port-forward, you can easily access your deployed application:

kubectl port-forward svc/helm-guestbook 9090:80 

Let’s access our application at https://localhost:9090/.

Deploying Helm Charts with Argo CD

Let us use Argo CD to deploy Helm Charts.

Go to settings in the Argo CD UI and add Repositories.

Argo CD Settings

Add the following details and connect.

You should see your added repository in the list.

Now, click on create a new application. We will deploy NGINX Helm chart on Argo CD.

Make sure to specify the required details.

Once you click on create, you should be able to see your application on the Argo CD dashboard.

At first, the application will be out of sync. Once we synchronize the application, it will update and show as healthy.

Helm Chart Argo CD dashboard

Click on ‘Sync’ and then ‘Synchronize’

Now, if you go back and see, your application should show Healthy and Synced status. 

Healthy sync'd Argo CD helm chart application

GitOps Using Harness

Harness provides native GitOps functionality that manages Argo CD which lets you deploy services by syncing the Kubernetes manifests in your source repos with your target clusters. First, you set up Harness GitOps by installing a GitOps Agent in your environment. Next, you define how to manage the desired and target state in a GitOps Application in Harness. The GitOps Agent performs the sync operations defined in the Application and reacts to events in the source and target states.

Harness GitOps Architecture

Try this Harness GitOps using one of your Kubernetes clusters. 

First, you will need to sign up for a Free Harness Account and navigate to the GitOps tab.

Navigate to Deployments > GitOps from the side menu.

Harness GitOps UI

Harness will install Argo CD on your behalf and wire that Argo CD instance to Harness. All you need is a Kubernetes cluster. Now, we need to set up the required things to do GitOps as part of Harness. 

Navigate to GitOps > Settings > GitOps Agents.

One by one, you will connect all the required GitOps settings shown below.

Harness GitOps settings

Once everything is connected and verified, you can start deploying applications via Harness GitOps. By taking the famous guestbook example, once the deployment is done, you should see your Harness GitOps dashboard as shown below:

Harness GitOps guestbook example

You can follow this simple Harness GitOps tutorial to see how intuitive and simple it is to deploy applications via Harness GitOps

Let’s Do GitOps

GitOps is a modern software delivery approach that has a bright future ahead. If you are working with Kubernetes-related deployments, there are many GitOps benefits. GitOps accelerates your software deployment speed focusing on a rich developer experience. Combined with DevOps best practices, GitOps gives wings to your software delivery.

Looking for a GitOps continuous delivery tool? Request a demo of Harness CD & GitOps-as-a-Service today! 

You might also like
Continuous Delivery & GitOps