ArgoCD Application Deployment- Deploy the same helm chart multiple time

Santosh Gupta
4 min readSep 3, 2023

--

ArgoCD is a powerful tool for managing Kubernetes applications and deployments. It simplifies the process of deploying and maintaining applications in a Kubernetes cluster.
Helm, on the other hand, is a popular package manager for Kubernetes that allows you to define, install, and upgrade even the most complex Kubernetes applications.

In this blog post, we will explore how to deploy the different versions of the same Helm chart using a single ArgoCD application manifest. We will create a new helm chart, use dependencies, and aliases to achieve the required results. This approach can be helpful if you need to deploy the same helm chart multiple times but you don’t want to deploy multiple applications in ArgoCD. This will streamline your deployment process and improve maintainability by reducing duplication of ArgoCD application deployments.

Prerequisites
Before we dive into the deployment process, make sure you have the following prerequisites in place:

  1. A Kubernetes cluster.
  2. ArgoCD installed and configured.
  3. Helm and Helm CLI installed.
  4. A Helm chart that you want to deploy using ArgoCD.

Step 1: Create a Helm Chart

If you don’t already have a Helm chart, create one or use an existing one. You can create a basic Helm chart structure using the helm create command:

helm create argocd-helm-multi-deployment

Customize the Helm chart as per your application’s requirements. You can add values, templates, and other necessary resources.

Step 2: Define Dependencies

First, we will delete all the files from the template folder of the above helm chart as we don’t need them for this demo and will clear the values.yaml file.
In the Helm chart's Chart.yaml file, you can define dependencies for your chart. This can be done under the dependencies section. Specify the Helm charts that your application depends on and their versions. For this demo purpose, we will use the Redis helm chart. Once all the details are added, the Chart.yaml will be like the below -

apiVersion: v2
name: multi-release-helm-chart
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
dependencies:
- condition: redis.enabled
name: redis
version: 18.0.1
repository: https://charts.bitnami.com/bitnami

I have defined a condition in the above dependent helm chart, with this I can control whenever I need to add/remove this dependent helm chart without many changes to my actual application helm chart.

the values.yaml file will look like the below:

redis:
enabled: true

Step 3: Create the ArgoCD Application

Now that your Helm chart and its dependencies are properly set up, you can create an ArgoCD application for your project. Below is what this will look like:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: argocd-helm-multi-release
namespace: argocd
spec:
project: default
source:
path: argocd/argocd-helm-multi-release
repoURL: ssh://git@bitbucket.org/skgnova/devops-git.git
targetRevision: HEAD
helm:
valueFiles:
- values.yaml
destination:
server: https://kubernetes.default.svc
namespace: multi-release-helm
syncPolicy:
syncOptions:
- CreateNamespace=true

I have saved the above manifest file with the name "deploy-argocd-helm-multi-release.yaml" now we can deploy it with the below command:

kubectl apply -f .\deploy-argocd-helm-multi-release.yaml

Once it’s deployed, we can see the same on ArgoCD

We can check the deployment and pods from Lens as well

Now, let’s suppose you want to deploy another instance of Redis, you have two options -

  1. Create a new ArgoCD application manifest and deploy it
  2. Update the existing helm chart with additional helm dependency and alias

In this post. we will use the 2nd approach. In the helm chart that we created above, update the Charts.yaml file by adding an alias parameter, it will look like the below -

apiVersion: v2
name: multi-release-helm-chart
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
dependencies:
- condition: redis.enabled
name: redis
version: 18.0.1
repository: https://charts.bitnami.com/bitnami
- condition: redis.enabled
name: redis
version: 17.17.0
repository: https://charts.bitnami.com/bitnami
alias: redis-version-02

In this demo, I’m using a different version of redis for 2nd instance with an alias name "redis-version-02", However, you can use the same version if needed.

Now, when I pushed the updated code to my repo, I went to ArgoCD and synced the deploy application. It will take a few minutes for the application to be synced and deploy the new instance of redis. Once done, you can see the same on the ArgoCD console:

We can see the new instance of the redis pods with the alias name in the Lens console as well:

Conclusion

Using Helm dependency management and aliasing in conjunction with ArgoCD can simplify and streamline the deployment process of Helm charts. It helps avoid duplicating Helm values and resources, making your GitOps pipeline more efficient and maintainable. By following the steps outlined in this blog post, you can effectively deploy the same Helm chart on ArgoCD while managing dependencies and ensuring consistency in your Kubernetes applications.

I hope this has been informative for you. Please post your comments in case of any queries.

Originally published at http://virtualhackey.wordpress.com on September 3, 2023.

--

--

Santosh Gupta
Santosh Gupta

Written by Santosh Gupta

Kubernetes | Docker | Terraform | Helm | DevOps | Cloud | AWS