Implementing ArgoCD with Terraform Helm Chart Provider for EKS CI/CD Pipelines

Home >blogs >
Implementing ArgoCD with Terraform Helm Chart Provider for EKS CI/CD Pipelines
Ruby Nahal

Ruby Nahal

Chief Cloud Architect at Avahi Inc. Ruby Nahal is a seasoned technology enthusiast with over 15 years of experience in the dynamic world of IT, where she's journeyed from the traditional on-premises data centers to the innovative realms of hybrid cloud environments. Specializing in AWS migrations, modernizations, and DevOps, Ruby has honed her skills in service delivery, pre-sales engineering, and leading technical teams to success. Her passion lies in bridging the gap between complex technical concepts and practical, real-world solutions, ensuring that every project she touches not only meets but exceeds expectations. Ruby thrives on the challenges brought by the ever-evolving cloud landscape and is always eager to connect with fellow tech aficionados, share insights, and explore new horizons in this exciting field!
Ruby Nahal

Ruby Nahal

Chief Cloud Architect at Avahi Inc. Ruby Nahal is a seasoned technology enthusiast with over 15 years of experience in the dynamic world of IT, where she's journeyed from the traditional on-premises data centers to the innovative realms of hybrid cloud environments. Specializing in AWS migrations, modernizations, and DevOps, Ruby has honed her skills in service delivery, pre-sales engineering, and leading technical teams to success. Her passion lies in bridging the gap between complex technical concepts and practical, real-world solutions, ensuring that every project she touches not only meets but exceeds expectations. Ruby thrives on the challenges brought by the ever-evolving cloud landscape and is always eager to connect with fellow tech aficionados, share insights, and explore new horizons in this exciting field!

Introduction

Deploying applications on Kubernetes, specifically on Amazon Elastic Kubernetes Service (EKS), presents a unique set of challenges. It requires a deep understanding of both Kubernetes and AWS services, alongside the need to manage resources and applications declaratively and efficiently. In this blog, we’ll explore how to streamline these processes using ArgoCD with Terraform’s Helm chart provider and the ArgoCD Image Updater. We’ll dive into the intricacies of implementing a complete end-to-end CI/CD pipeline for EKS, outlining the challenges, solutions, and a step-by-step implementation guide.

 

Challenges in Deploying Applications on EKS

  1. Complex Cluster Management: EKS simplifies Kubernetes cluster management but demands a clear understanding of AWS and Kubernetes networking, scaling, and security.
  2. Resource Provisioning: Provisioning and managing Kubernetes resources can be cumbersome, often requiring multiple tools and configurations.
  3. Application Deployment and Update: Continuous integration and continuous deployment (CI/CD) require automation for efficient application updates.
  4. Version Control and Configuration Management: Ensuring consistency and maintaining version control in application deployments is crucial for reliability and compliance.
  5. Monitoring and Logging: Efficient monitoring and logging configurations are essential for maintaining the health and performance of applications.

 

Implementing ArgoCD and Terraform for EKS CI/CD Pipelines

ArgoCD, a declarative, GitOps continuous delivery tool for Kubernetes, and Terraform, an infrastructure as a code software tool, provide solutions to these challenges.

 

Solution Overview

  • ArgoCD: Manages Kubernetes resources based on Git repositories.
  • Terraform with Helm Chart Provider: Automates the deployment and management of Kubernetes resources.
  • ArgoCD Image Updater: Automates the update process for container images in Kubernetes deployments.

 

Step-by-Step Implementation

1.Setting Up the EKS Cluster

Before proceeding, ensure that your EKS cluster is up and running. You can use the AWS Terraform Module to set up the cluster.

2.Installing ArgoCD Using Terraform

Terraform Configuration: Create a Terraform configuration file to define the ArgoCD installation using the Helm chart provider.

				
					provider "helm" {
  kubernetes {
    host                   = data.aws_eks_cluster.eks.endpoint
    token                  = data.aws_eks_cluster_auth.this.token
    cluster_ca_certificate = base64decode(data.aws_eks_cluster.eks.certificate_authority[0].data)
  }
}

data "aws_eks_cluster" "eks" {
  name = data.terraform_remote_state.infra.outputs.eks.cluster_name
}

resource "helm_release" "argocd" {
  name       = "argocd"
  repository = "https://argoproj.github.io/argo-helm"
  chart      = "argo-cd"
  version    = "x.x.x"
}

				
			

3. Configuring ArgoCD for Application Deployment

Define applications in ArgoCD using either the UI or command line, pointing to the Git repositories containing Kubernetes manifests. Use the guide here to set up an example repository on argoCD UI. Once you connect the repositories to ArgoCD and configure an application to use a branch in a repository, a push to that branch triggers the ArgoCD to deploy the new code and changes to the application on EKS.

4. Installing ArgoCD Image Updater

Terraform Configuration: Extend your Terraform configuration to include the ArgoCD Image Updater Helm chart. It is best to install argoCD image updater in the same namespace as ArgoCD so it can gain access to argoCD configuration easily.

				
					resource "helm_release" "argocd-image-updater" {
  name       = "argocd-image-updater"
  repository = "https://argoproj.github.io/argo-helm"
  chart      = "argo-cd-image-updater"
  version    = "x.x.x"
}

				
			

5.Configuring ArgoCD Image Updater

Configure the Image Updater to monitor specific container images in ECR and update them according to the defined policies. Argocd-image-updater needs annotations in the application manifest to “enroll” applications into itself. Following is the example of an annotation used to update data-warehouse-integration applications automatically if a new image is pushed to ECR.

6.Monitoring and Logging

Implement monitoring and logging solutions like Prometheus, Grafana, and ELK stack to keep track of your applications’ health and performance.

Conclusion

Implementing a CI/CD pipeline using ArgoCD and Terraform Helm chart provider for Kubernetes applications on EKS simplifies the deployment process, enhances automation, and ensures consistency and reliability in application delivery. By incorporating ArgoCD Image Updater, the process becomes even more streamlined, allowing for automated image updates in the deployment pipelines. The combination of these tools not only addresses the challenges in deploying applications on EKS but also leverages the power of GitOps and Infrastructure as Code for efficient and scalable Kubernetes management. As Kubernetes continues to evolve, embracing these tools and practices will be crucial for organizations looking to optimize their cloud-native strategies.