Simplifying Kubernetes Continuous Delivery With ArgoCD

Simplifying Kubernetes Continuous Delivery With ArgoCD

ยท

5 min read

Introduction

In the ever-evolving landscape of cloud-native technologies, Kubernetes has emerged as the de facto standard for container orchestration. With its flexibility and scalability, Kubernetes enables organizations to deploy and manage complex applications with ease. However, managing deployments in Kubernetes can be challenging, especially as applications grow in complexity and scale. This is where Argo CD comes into play.

What is Argo CD?

Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. Developed by the engineering team at Intuit, Argo CD simplifies the deployment and management of applications in Kubernetes clusters. By leveraging Git as the source of truth for declarative infrastructure and application definitions, Argo CD ensures that the desired state of the cluster matches the state defined in Git repositories.

Key Features of Argo CD

  • Declarative GitOps Workflow: Argo CD follows a declarative approach where the desired state of the cluster is defined in Git repositories. It continuously monitors these repositories for changes and reconciles any differences to ensure that the cluster remains in the desired state.

  • Application Lifecycle Management: With Argo CD, you can easily define and manage the lifecycle of your applications in Kubernetes. From deployment to scaling and monitoring, Argo CD provides a unified platform for managing the entire application lifecycle.

  • Rollback and Version Control: Argo CD maintains a history of deployments and allows you to easily rollback to previous versions in case of errors or failures. This provides a safety net for managing changes and ensures reliability in your continuous delivery pipeline.

  • Multi-Tenancy Support: Argo CD supports multi-tenancy, allowing you to manage multiple clusters and environments from a single control plane. This makes it easy to scale your deployments across different teams and environments.

Getting Started with Argo CD

Now that we have a basic understanding of Argo CD, let's explore how to get started with it.

Step 1: Installing Argo CD

Argo CD can be installed on Kubernetes clusters using various methods, including Helm charts, YAML manifests, or Kubernetes operators. Depending on your preference and deployment requirements, choose the installation method that best suits your needs.
In order to install Argo CD, you'll need the kubectl CLI installed and access to a Kubernetes cluster. If testing locallay, you can use one of the following:

Once you have a cluster, you are ready to install Argo CD. You first need to create the argocd namespace.

kubectl create namespace argocd

Once created, you can apply the following YAML provided by the Argo Project's git repo.

kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

You can install Argo CD on your Kubernetes cluster using various methods such as Helm charts, YAML manifests, or Kubernetes operators. Let's consider the Helm chart installation method for simplicity:

helm repo add argo https://argoproj.github.io/argo-helm
helm install argo-cd argo/argo-cd

This command adds the Argo CD Helm repository and installs Argo CD on your Kubernetes cluster with the release name argo-cd.

Step2: Verify Install

Verify that Argo CD is installed by running kubectl get pods -n argocd

$ kubectl get pods -n argocd
NAME                                                READY   STATUS    RESTARTS   AGE
argocd-application-controller-0                     1/1     Running   0          12m
argocd-applicationset-controller-74558d8789-2fcql   1/1     Running   0          12m
argocd-dex-server-5bf8b66b55-vggd6                  1/1     Running   0          12m
argocd-notifications-controller-dc5d7dd6-g8hrh      1/1     Running   0          12m
argocd-redis-6fd7cbd95d-cj28p                       1/1     Running   0          12m
argocd-repo-server-7c57dc5975-9fzrl                 1/1     Running   0          12m
argocd-server-7c85877d9d-vj8h2                      1/1     Running   0          12m

Also verify that the argocd cli is installed correctly by running argocd version --client

$ argocd version --client
argocd: v2.1.3+d855831
  BuildDate: 2023-09-29T18:53:32Z
  GitCommit: d855831540e51d8a90b1006d2eb9
  GitTreeState: clean
  GoVersion: go1.16.5
  Compiler: gc
  Platform: darwin/amd64

Step3: Access the Argo CD Web UI

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

After port forwarding, open your web browser and navigate to http://localhost:8080. You'll be prompted to log in with the default username admin and password admin.

Step 4: Configure ArgoCD

With Argo CD running, it's time to define the applications you want to deploy. Applications in Argo CD are defined using Kubernetes manifests stored in Git repositories. Here's how you can define an application:

  • Log in to the Argo CD web interface.

Getting Started :: ArgoCD Tutorial

  • Click on the "New App" button.

Configuring private Git repo in Argo CD to deploy apps into K8S

  • Fill in the application details such as name, project, and sync policy.

Configuring private Git repo in Argo CD to deploy apps into K8S

  • Configure the Git repository URL, branch, and path to your Kubernetes manifests.

GitOps in Kubernetes with Argo CD | Ambassador Labs

  • Optionally, set any additional parameters or sync options.

  • Click on the "Create" button to create the application.

ArgoCD: Tutorial & Examples

Step 5: Monitoring Deployments

Once the applications are deployed, monitor their status and health using the Argo CD dashboard. The dashboard provides real-time insights into the status of your deployments, including the current version, desired version, and any differences between the two.

Monitor via ArgoCD - Cinchy Platform Documentation

Conclusion

Argo CD simplifies Kubernetes continuous delivery by providing a declarative, GitOps-based approach to application deployment and management. By leveraging Git as the source of truth, Argo CD ensures consistency and reliability in your continuous delivery pipeline. Whether you're a beginner or an experienced Kubernetes user, Argo CD offers a powerful set of features to streamline your deployment workflows and accelerate your journey to cloud-native excellence.

If you found this guide valuable, don't forget to like and share it with your peers. Stay tuned for more insightful content by following me for future updates. Together, let's continue to unlock the full potential of Argo CD and empower the Kubernetes community with advanced deployment strategies and best practices. Thank you for reading!

Did you find this article valuable?

Support Dheeraj Choudhary by becoming a sponsor. Any amount is appreciated!

ย