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.
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.
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.
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.
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.
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.
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.
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.
Now that we've taken a look at Argo CD and Helm, let's explore how to use Argo CD with Helm charts:
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:
Apply the manifest file to the namespace created:
Make sure all your pods are running properly inside the namespace:
Now, let’s expose our ArgoCD server UI through port forwarding:
Once you do that, you can now see the ArgoCD UI on https://localhost:8080/
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:
You will get an output to use as your password. Once you have the username (admin) and the password, login to ArgoCD.
Also, make sure you can use Argo CD locally via CLI, hence install the Argo CD CLI:
Now, you can login and talk to your Argo CD via CLI:
It will ask you for the username and password. Set both, and the login will be successful.
Reference the Argo CD example repo to deploy a guestbook application via Helm.
Let’s create an application on ArgoCD.
You should see the application getting created:
Let’s check the status of the application created:
You can see that both Service and Deployment are in OutOfSync status. Let’s sync the application with the following command:
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.
Here you can see that the status is Healthy and Synced.
By doing the port-forward, you can easily access your deployed application:
Let’s access our application at http://localhost:9090/.
Let us use Argo CD to deploy Helm Charts.
Go to settings in the Argo CD UI and add Repositories.
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.
Click on ‘Sync’ and then ‘Synchronize’
Now, if you go back and see, your application should show Healthy and Synced status.
Harness provides native GitOps functionality that 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.
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 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.
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:
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.
Enjoyed reading this blog post or have questions or feedback?
Share your thoughts by creating a new topic in the Harness community forum.