Understanding Argo CD
Nov 18 2020Continuous Delivery is an eminent pillar of DevOps culture and is very popular in present times. There are many tools available today which are slowly paving it’s path towards being a must to have in our kitty. One such tool which I’m closely following for a while now is Argo CD. Argo project has been there for quite some time now and I’ve enjoyed working on both Argo workflows and Argo CD. In this post, I’ll be covering only Argo CD and how it works fluently with Kubernetes.
According to Argo Project Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. And the fact that it supports GitOps and Kubernetes, makes it more interesting to use. GitOps, comes into focus when we want to control with Git being the single source of truth. Rather than keeping multiple artifactory stores, we control everything from Git and especially the CD process. It definitely improves transparency and visibility for a project. Another feature of Argo CD is, it being a CD tool for Kubernetes and that helps in providing in-place upgrades of our microservices.
Let’s take a look at how Argo CD works. I’m having a local single node K8s cluster and I’ll be installing Argo CD on it. For more details on installation, check this link. We’ll start by creating a dedicated Namespace for Argo deployments to roll in followed by applying the config yamls for the same,
$ kubectl create ns argocd
$ kubectl apply -nargocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
And this is how the Argo services rollout,
$ kubectl get pods -nargocd --watch
NAME READY STATUS RESTARTS AGE
argocd-application-controller-67bc594796-x4w64 0/1 ContainerCreating 0 33s
argocd-dex-server-55675b569d-9qnv2 0/1 Init:0/1 0 32s
argocd-redis-54b6ff7bf6-g9dlz 0/1 ContainerCreating 0 32s
argocd-repo-server-654d96b48-8kkf2 0/1 ContainerCreating 0 31s
argocd-server-bdcdd6f7c-xhmfn 0/1 ContainerCreating 0 31s
argocd-application-controller-67bc594796-x4w64 0/1 Running 0 118s
argocd-dex-server-55675b569d-9qnv2 0/1 PodInitializing 0 2m1s
argocd-application-controller-67bc594796-x4w64 1/1 Running 0 2m9s
argocd-redis-54b6ff7bf6-g9dlz 1/1 Running 0 2m15s
argocd-repo-server-654d96b48-8kkf2 0/1 Running 0 2m15s
argocd-server-bdcdd6f7c-xhmfn 0/1 Running 0 2m18s
argocd-repo-server-654d96b48-8kkf2 1/1 Running 0 2m19s
argocd-dex-server-55675b569d-9qnv2 1/1 Running 0 2m25s
argocd-server-bdcdd6f7c-xhmfn 1/1 Running 0 2m49s
Also, we need to install argocd cli for interaction with the argocd server. The installations steps for various OS are available here. Let’s take a look at different components that are installed as part of Argo CD package,
$ kubectl get all -nargocd
NAME READY STATUS RESTARTS AGE
pod/argocd-application-controller-67bc594796-x4w64 1/1 Running 0 11m
pod/argocd-dex-server-55675b569d-9qnv2 1/1 Running 0 11m
pod/argocd-redis-54b6ff7bf6-g9dlz 1/1 Running 0 11m
pod/argocd-repo-server-654d96b48-8kkf2 1/1 Running 0 11m
pod/argocd-server-bdcdd6f7c-xhmfn 1/1 Running 0 11m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/argocd-dex-server ClusterIP 10.96.198.107 <none> 5556/TCP,5557/TCP,5558/TCP 11m
service/argocd-metrics ClusterIP 10.96.124.193 <none> 8082/TCP 11m
service/argocd-redis ClusterIP 10.96.50.111 <none> 6379/TCP 11m
service/argocd-repo-server ClusterIP 10.96.222.6 <none> 8081/TCP,8084/TCP 11m
service/argocd-server ClusterIP 10.96.189.59 <none> 80/TCP,443/TCP 11m
service/argocd-server-metrics ClusterIP 10.96.253.94 <none> 8083/TCP 11m
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/argocd-application-controller 1/1 1 1 11m
deployment.apps/argocd-dex-server 1/1 1 1 11m
deployment.apps/argocd-redis 1/1 1 1 11m
deployment.apps/argocd-repo-server 1/1 1 1 11m
deployment.apps/argocd-server 1/1 1 1 11m
NAME DESIRED CURRENT READY AGE
replicaset.apps/argocd-application-controller-67bc594796 1 1 1 11m
replicaset.apps/argocd-dex-server-55675b569d 1 1 1 11m
replicaset.apps/argocd-redis-54b6ff7bf6 1 1 1 11m
replicaset.apps/argocd-repo-server-654d96b48 1 1 1 11m
replicaset.apps/argocd-server-bdcdd6f7c 1 1 1 11m
Argo CD comes with a nice UI dashboard which can be accessed by forwarding one of the server service to our local and here’s how it looks,
We can deploy our application using either the UI or command line utility into a K8s cluster using Argo CD. For deployment, we’ll be using a sample application available here. With UI, we first need to create an application providing Git repo details, cluster information etc. Below is how we can specify the details while creating an app,
We have given application name as demo-app and we have used above mention example application (sockshop) for deployment. Also, for local clusters we need to give cluster URL as https://kubernetes.default.svc. Apart from this, we even have provision to update existing deployment configs with in-place upgrade of values using kustomize.
Once we hit the create button then we can see that our app is created but the changes are yet to be rolled-out into the cluster. And for that we need to synchronize our application,
And now we can see the deployments coming up along with other components,
And then finally, we can see the health of our application as well on the same dashboard,
So, this was a quick walthrough of Argo CD and some of it’s attractive yet powerful features. There are couple of other tools as well maintained by Argo Project and can be checked out here. A deep-dive with such interesting utilities definitely provides a clear understanding of how important GitOps has become. I’ll try to cover few other tools in my next post. Until then, ciao!!