Introduction
ArgoCD is a declarative, GitOps-based continuous delivery tool for Kubernetes. It automatically synchronises the desired application state stored in the form of Kubernetes manifests within a Git repository with the actual state in a Kubernetes cluster.
ArgoCD shines when you need to automate deployments, manage complex applications, and ensure consistency across multiple environments. It simplifies continuous delivery processes by automating workflows and supports advanced strategies like canary and blue-green deployments, ensuring safe releases into production. ArgoCD also provides real-time monitoring, rollback capabilities, and secure access to deploy changes seamlessly. If you're running Kubernetes and seeking streamlined, version-controlled deployments, ArgoCD is the perfect tool to implement GitOps practices.
Step-by-Step Guide
In this guide, we'll explore how to set up ArgoCD on an Amazon EKS cluster and configure it to sync with our GitHub repository for GitOps-style continuous delivery. The following is a high level diagram of the EKS ArgoCD setup we will perform.
1. Set Up EKS & Kubeconfig
First, we ensure that we have an EKS cluster running. We run the following command to update our kubeconfig to connect to it:
aws eks update-kubeconfig --region --name
2. Install ArgoCD
We will create a new namespace for all ArgoCD related resources. Download and install the latest version of ArgoCD:
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Check if ArgoCD is running by verifying the pods:
kubectl get pods -n argocd
The output should be as follows:

3. Expose ArgoCD Server
By default, ArgoCD is not accessible externally. To make it available via a LoadBalancer:
kubectl patch svc argocd-server -n argocd -p ''
The LoadBalancer created as a result of this command will be ready to use in a couple of minutes. The LoadBalancer can be seen in the AWS EC2 console.
Retrieve the external DNS endpoint of the LoadBalancer – this will be useful for accessing the ArgoCD web interface:
kubectl get svc argocd-server -n argocd -o jsonpath=""
The ArgoCD web interface should show a login page:

4. Log Into ArgoCD
To log in, retrieve the initial admin password:
export kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="" | base64 --decode
Access the ArgoCD login page using the LoadBalancer external DNS endpoint, and login with username "admin" and the password we just retrieved.

Alternatively, we can install the ArgoCD CLI and use it to login.
Install the ArgoCD CLI:
VERSION=$(curl --silent "https://api.github.com/repos/argoproj/argo-cd/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
curl -sSL -o argocd-darwin-arm64 https://github.com/argoproj/argo-cd/releases/download/$VERSION/argocd-darwin-arm64
sudo install -m 555 argocd-darwin-arm64 /usr/local/bin/argocd
rm argocd-darwin-arm64
And login via the ArgoCD CLI:
argocd login --username admin --password --insecure
5. Sync GitHub Repository
Github repositories containing Kubernetes manifests can be synchronised with our ArgoCD deployment via click-ops in the web interface. Another way (the better way) is to have it synchronised via a Kubernetes manifest. Now, let's configure ArgoCD to sync up with a GitHub repository. Create a YAML kubnernetes manifest (argo-git-repo-sync.yaml) with the following content:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: demo-app
namespace: argocd
spec:
source:
repoURL: https://github.com/some-username/some-repo
targetRevision: HEAD
path: some-path
destination:
server: https://kubernetes.default.svc
namespace: some-namespace
syncPolicy:
automated:
selfHeal: true
prune: true
syncOptions:
- CreateNamespace=true
Apply the file:
kubectl apply -f argo-git-repo-sync.yaml
6. Verify the Deployment
Head to the ArgoCD UI via the LoadBalancer URL and verify the sync between the GitHub repository and our EKS cluster. You should see the Kubernetes resources deployed automatically based on the manifest files in our GitHub repo.

7. Test GitOps Workflow
To test the GitOps flow, modify the app in the GitHub repository, commit the changes, and watch ArgoCD automatically update the EKS cluster. This ensures that the actual state in the cluster stays in sync with the desired state defined in the GitHub repo.
Conclusion
To conclude, we successfully set up ArgoCD on EKS, synced it with a GitHub repository, and automated our deployments using GitOps. This setup streamlines our deployment process, ensuring that any changes we make in our GitHub repo are automatically applied to the Kubernetes cluster.
Happy automating!

