Argo CD — No ugly deployment pipelines anymore!

In this blog post, I’m going to look hard on how to deploy an exciting toolset for Continuous Deployment, called Argo!

Let’s get into it ;)

What’s Argo CD?

Argo CD is a lightweight and easy to configure declarative GitOps tool used to sync application deployments, from a Git Repository to one or many Kubernetes / OpenShift clusters.

Argo CD is based on GitOps methodology where Git is the sole source of truth holding the a declarative definition of the desired state of a system. [Argo Project]

Argo CD & CNCF

Argo CD became a CNCF Incubations project in April 2020. Argo CD belongs to the OpenSource Continuous Delivery Foundation or CDF for short, which acts as a neutral base for continuous delivery collaborations.

CDF is already hosting projects like Jenkins, Jenkins X, Spinnaker and Tekton. Red Hat is nowadays announcing joining its forces to the Argo project to further the adoption of Argo in Enterprise Kubernetes deployments and OpenShift ecosystem.

Continuous Delivery Foundation — CDF

Large Firms already started adopting Argo, such as Adobe, DataDog, Google, NVidia and more.

Argo CD UI / CLI

Argo CD delivers, out of the box, a clean and visually compelling GUI that makes managing applications’ deployment more effortless than ever. An extensive UI, from which you can have a nice overview of Kubernetes clusters, allows deployments to multiple clusters.

You’ll be able to discover and watch Kubernetes ReplicaSets, Deployments, Services, Pods and even Side Cars running inside the Pods and more (HealthChecks, Ingress, and more). In addition to that, debugging and managing containers in real-time is also possible (delete failing containers or even instantly rollback to previous deployments).

For a deep dive, I encourage you to go through this blog post, authored by Argo Project.

Let’s play!

In this guide, we are going to deploy Argo CD on top of Azure Red Hat Openshift 4.4 (based on Kubernetes 1.7). The same procedure applies to Kubernetes.

ArgoCD Can be used standalone or as part of the CI/CD pipeline. And thus we can have ArgoCD running in the same environment as Jenkins.

Step-0. Download Kubectl or OC Client

To manage your Openshit clusters, you’ll be relying on kubectl. OC-Client is recommended but not required to manage OpenShift clusters from the CLI.

Follow this link to Download OC-Client.

NB. I assume you already have an OpenShift cluster running.

Step-1. Login & Create your ArgoCD Namespace

OpenShift — Create a new Namespace

Or using the OC Client, as follows:

oc login -u kube:admin https://<cluster-fqdn>:<port>
oc new-project argocd --display-name "Argo CD"

Step-2. Deploy ArgoCD Operator from OperatorHub

Once the project is created, we can start the install process by going over the OperatorHub, searching for ArgoCD “Community Version”, and clicking on “Install” to deploy Argo in the selected namespace.

The Operator status will go from “Pending” to “Installing” and finally to “Succeeded”, as revealed below.

ArgoCD — Operator based installation

Ensure the Operator is getting installed in ArgoCD namespace created in Step1.

Step-3. Create an ArgoCD application

Once the Operator shows “Installed” as its status, you can use the Operator to deploy an instance of ArgoCD.

Create an “ArgoCD Application“ from the following YAML resource definition template. The template uses the “ArgoCD" custom resource definition CRD to define a new resource.

apiVersion: argoproj.io/v1alpha1
kind: ArgoCD
metadata:
name: aab-argocd
namespace: argocd
spec:
server:
route: true
dex:
openShiftOAuth: true
image: quay.io/ablock/dex
version: openshift-connector
rbac:
policy: |
g, system:cluster-admins, role:admin

This ResourceDefinition for ArgoCD specifies the namespace where the instance will be created, exposing ArgoCD using a Route, hooking it up to OpenShift OAuth mapping OpenShift-ClusterAdmin to the ArgoCD-Admin.

Step-4. Access ArgoCD

Going back to “Workloads”, we can see that all pods are up and running. Once done, we go to “Networking > Routes” to get the right URL for ArgoCD.

Note that the OpenShift-Route is secured with a Self-Signed certificate. We are going to login to ArgoCD UI using OpenShift OAuth, as specified previously in the Application configuration.

Step-5. Attach & Manage your Clusters

Once logged in to Argo, we are ready to add new Kubernetes/OpenShift clusters as deployment targets. The same step can also be done through the usage of the “Argo” CLIs.

First, to download the Argo-Client binary follow this link. Once downloaded, move the file into your $PATH:

mv argocd-darwin-amd64 /usr/local/bin/argocd

Now that the Argo client is set up let’s login to the ArgoCD installation.

NB. Ensure you’re already logged in to OpenShift from the CLI to be able to add the cluster properly to Argo.

argocd login --sso argocd-serer-argocd-<OpenShiftFQDN>

Copy the “Performing authorization_code flow login” value, shown as a result, to a new browser tab. A green banner shows you’re well-authorized access.

Switching back to the CLI, we can add our first K8s/OCP targets:

argocd cluster add default/<OpenShiftFQDN>/<username>
argocd cluster list

NB. This will add an ArgoCD service account onto the cluster, which will allow ArgoCD to deploy applications to it.

Going over to GitRepo, we can sync Kubernetes manifests from Github to our cluster.

Conclusion

I advise separating the application repository from the manifest repository before targeting the applications’ deployment to Kubernetes.

Apply the needed changes to the “master” branch of the application repository to trigger your CI for testing and building the new container images. And as a final step of CI, an automated commit to updating the image version in the manifest repo, notifying Argo CD of the change.

To summarize, this process could look something like “Magic” ;) We already setup Argo, so do your magic!

Feel free to provide me with your valuable comments :)

Is a DevOps & Cloud enthusiast with 10 plus years of experience. He’s continuously immersing himself in the latest technologies trends & projects.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store