cover-img

Install ArgoCD on the EKS cluster and configure sync with GitHub manifest repository.

10 July, 2023

4

4

0

🙋‍♂️ Introduction

Hi everybody, my name is Ankit Jodhani. and I'm DevOps and Cloud enthusiast. I recently graduated from university and building my career in DevOps and cloud. I have written many blogs and projects on could and Devops you can see that on my Hashnode profile Ankit Jodhani.

✅ Prerequisites

  • 👑 Amazon EKS Cluster in running state
  • 💻 AWS CLI
  • ⌛ Just need time to invest in learning

💶 Note (Imp)

this is the 4th blog of the Deploying Dockerized App on AWS EKS Cluster using ArgoCD and GitOps methodology with CircleCI

Blog 1 link: Click here

Blog 2 link: Click here

Blog 3 link: Click here

this is blog 4

📚 Synopsis

in this blog, I'll show you how can we install GitOps controller ArgoCD on the KS cluster.

🔸 Story

We will sync the Kubernetes manifest repository with ArgoCD. When ArgoCD notices any changes in the Kubernetes manifest file, it pulls the updated files from the Kubernetes manifest repository and applies them to the cluster. Most changes in the Kubernetes manifest file are made by the CI tool (CircleCI) while running the pipeline. This ensures that the Kubernetes manifest serves as the single source of truth for ArgoCD, maintaining consistency between the desired state and the actual state of the cluster.

🖥️ Local setup

🔹 Install ArgoCD CLI

Download the latest Argo CD version from https://github.com/argoproj/argo-cd/releases/latest. More detailed installation instructions can be found via the CLI installation documentation.

🚀 Step-by-step guide

Step 1: Create Kubeconfig

Create or update kubeconfig file, if you didn't do that.

aws eks update-kubeconfig --region REGION-CODE --name YOUR-CLUSTER-NAME

update-kubeconfig file

Step 2: Create namespace

Hit the below command in your terminal to create a namespace

kubectl create namespace argocd

creating namespace

Step 3: Create ArgoCD objects

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

objects and cofigure argocd

Step 4: Pod created by ArgoCD

kubectl get pods -n argocd

all the pods created by argocd

Step 5: Make ArgoCD-server publicly accessible

by default Argocd-server won't be accessible publicly so will use a load balancer to access from the internet. I know there are other ways to access it without using a load balancer such as port forwarding etc. but here, let's go with a load balancer.

type the below command in your terminal

kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'

Please wait for a few minutes till load balancer becomes up and running.

Well, you can visit your AWS console to see the load balancer status and DNS endpoint.

argocd-server with load-balancer

hit the below command to store the DNS name in the variable. ARGOCD_SERVER is the variable name.

export ARGOCD_SERVER=`kubectl get svc argocd-server -n argocd -o json | jq --raw-output '.status.loadBalancer.ingress[0].hostname'`

Step 6: Login into ArgoCD

we need a password and username, but the initial password was autogenerated. and username by default is 'admin'

Hit the below command to store the password in the variable ARGO_PWD

export ARGO_PWD=`kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d`

Now, let's login, use the below command to login

argocd login $ARGOCD_SERVER --username admin --password $ARGO_PWD --insecure

login into argocd

Step 7: Sync the Github Manifest repo with ArgoCD

now we need to set up sync between the argocd and GitHub manifest repository.

Copy below the declarative file and store it on your computer with any name.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: todo-app-argo
  namespace: argocd
spec:
  project: default

  source:
    repoURL: https://github.com/AnkitJodhani/kube_manifest-4thWeekOfCloudOps.git
    targetRevision: HEAD
    path: menifest
  destination:
    server: https://kubernetes.default.svc
    namespace: myapp

  syncPolicy:
    syncOptions:
    - CreateNamespace=true

    automated:
      selfHeal: true
      prune: true

Note: Please change the repoURL above file. Give your repository URL.

Type the below command to apply the sync.

kubectl apply -f=argo-sync.yaml

Step 8: ArgoCD UI

let's visit Argocd UI and see what argocd did. and we will get a better understanding of how the thing works.

take load balancer DNS and paste in the browser. you will get the DNS name from the AWS Console or type echo $ARGOCD_SERVER the command in the terminal. because we stored it previously.

The default username is 'admin'

To get the password type echo $ARGO_PWD .And you will see the interface like this

Argocd ui

step 9: Test

let's see if ArgoCD applied the manifest files or not. click on the Cart that you can see in the above image to get a better visual.

argocd ui and applicattion

I've configured my manifest file in such a way that it will create on Application load balancer to access the dockerized application.

loadbalcner

we will perform the final test. but for that, you need to visit Blog 1 of the series. you will find the link above in the Note section.

🎒 About me and Resouces

🙏 Thank you for reading this blog

🙋‍♂️ Ankit Jodhani.

📂 Github project repo https://github.com/AnkitJodhani/kube_manifest-4thWeekOfCloudOps

😺 Github https://github.com/AnkitJodhani

🐦 Twitter https://twitter.com/Ankit__Jodhani

📨 reach me at ankitjodhani1903@gmail.com

🔗 LinkedIn https://www.linkedin.com/in/ankit-jodhani/


aws

azure

docker

git

github

devops

kubernetes

linux

yaml

developer

jenkins

learninpublic

cloud

argocd

terraform

flux

kyverno

fleet

100daysdevops

pulumi

linkerd

growtogether

gitops

4

4

0

aws

azure

docker

git

github

devops

kubernetes

linux

yaml

developer

jenkins

learninpublic

cloud

argocd

terraform

flux

kyverno

fleet

100daysdevops

pulumi

linkerd

growtogether

gitops

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2024. Showcase Creators Inc. All rights reserved.