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 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]

Git used to be a repository for versioning only Source Codes. Now its usage is extended furthermore and is utilised for storing everything running in Kubernetes. Based on this approach, Developers apply their deployment changes through Git Commits on a Git Repository. ArgoCD is notified through webhooks. Based on the triggered webhooks, Argo makes a Diff and then Synchronize the Git Repo to live Kubernetes environments.

Argo CD & CNCF

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

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!

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

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

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

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

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

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

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.