HomeTalksPanels
 
  

Argo CD

December 19, 2020

There are several options when it comes to Continuous Delivery, powered by the GitOps toolkit, and Argo CD is one of the most popular. It describes itself as "a declarative, GitOps continuous delivery tool for Kubernetes."

Following the GitOps philosophy, Argo is/has:

  • declarative since it uses Git as its source of truth where the entire desired state is described;
  • automated because it can read state (described in YAML) and act upon it;
  • auditable due to Git history;
  • designed for Kubernetes from the ground up;
  • out-of-the-box integrations so that the wheel doesn't need to be reinvented;
  • extensible allowing for particular use cases to be added.

Get the ball rolling

We will be spinning a local Kubernetes cluster with k3d and deploying a demo Guestbook application described in Helm and will let Argo take care of deploying it. We need the following tools to make this happen:

We start by creating a local Kubernetes cluster with k3d:

k3d cluster create -a 2 gitops
k3d kubeconfig merge gitops --switch-context

We then create a namespace for Argo and deploy it:

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

A password is auto generated. We will retrieve it and login in with the cli and the web interface:

# Retrieve password
kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2
# cli login
argocd login localhost:8080
# Update password, if you prefer
argocd account update-password
# Port-forward to access the UI
kubectl -n argocd port-forward svc/argocd-server 8080:443

The next few steps can be done in the UI or the command line. The UI will be left for the reader to explore and we'll use the command line. We will create the application in Argo and point to the Helm charts:

argocd app create guestbook \
--repo https://github.com/argoproj/argocd-example-apps.git \
--path helm-guestbook \
--dest-server https://kubernetes.default.svc \
--dest-namespace default

We can check the status of the application in the command line or the UI:

argocd app get guestbook
out of sync

OutOfSync is the initial application status because the application has yet to be deployed, all Kubernetes resources have to be created. We'll sync it by running:

argocd app sync guestbook

synced details

After Argo has done it's magic we can, at last, access the application:

kubectl port-forward svc/guestbook-helm-guestbook 9090:80

We've barely scratched the surface of what Argo can do but, with only a bit code we were able to deploy an application effortlessly. Argo is very powerful and can do a lot more and, in case you're interested, take a look a the documentation.

Ricardo Castro

Ricardo Castro

Software Engineering, DevOps, Taekwondo and Metal

 

 

© 2021