Deploying Argo CD in a Kubernetes Cluster

Filed Under: Random
ARGO CD TOOL Deployment

Hello, readers! This article talks about Deploying Argo CD in a Kubernetes Cluster with a detailed demonstration about the same.

So, let us begin!! 馃檪


What is Argo CD?

Argo CD is a GitOps tool that is used to have continuous delivery enabled for the Kubernetes-based applications. That is, Argo CD makes use of Git as the source of information for deployment or Updation of any Kubernetes-based application.

We can have Argo CD configured to the Kubernetes cluster and enable Argo CD to monitor the state of the application by configuring the apps through Argo CD as the integration point. Also, it continuously monitors the current state of the application against the desired state of the application.

In cases when the states do not match, Argo CD offers us a manual or automatic option to sync the app to the desired states.

Argo CD can have apps configured in the form of Kubernetes plain YAML files, Kustomization files, HELM charts, etc.

Having understood the concept of Argo CD, let us now focus on the deployment of the same in a Kubernetes Cluster.


Steps to Deploy Argo CD in a Kubernetes cluster

We are now going to focus on deploying Argo CD in a Kubernetes cluster through the below steps.

  1. Pre-requisites check for the Deployment
  2. Installing the Argo CD packages
  3. Configuring the Argo CD CLI tool
  4. Enabling access to Argo CD API server
  5. Login to Argo CD through CLI
  6. Inspect the User Interface

Let us now understand each and every step in the below break up of the topic.


1. Pre-requisites

In order to deploy Argo CD within a cluster, we assume that the setup includes a full-fledged and running Kubernetes Cluster. It also demands kubectl command-line tool to be installed.


2. Install Argo CD

At first, we need to create a namespace within the Kubernetes cluster for the deployment of the Argo CD resource files.

kubectl create ns argocd

Having created a namespace, we now apply the operator file to deploy the relevant Argo CD resources which include-

  • Argo CD deployment files
  • Network Policies
  • Argo CD services
  • Argo CD secret, etc
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

Output:

Image 4
Argo CD resources
Image 5
Argo CD services

3. Download and Configure Argo CD CLI tool

In order to make the process of monitoring a bit easy, we can take due advantage of the Argo CD CLI feature. To install the Argo CD CLI tool, use the below command-

#linux machine
curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64

chmod +x /usr/local/bin/argocd

#windows machine
$version = (Invoke-RestMethod https://api.github.com/repos/argoproj/argo-cd/releases/latest).tag_name

$url = "https://github.com/argoproj/argo-cd/releases/download/" + $version + "/argocd-windows-amd64.exe"
$output = "argocd.exe"

Invoke-WebRequest -Uri $url -OutFile $output

Post-installation, you can type argocd to confirm if it is installed successfully-

Image 6
Argo CD CLI

4. Configure Access to Argo CD API Server

In a generic manner and as a default configuration, Argo CD is not automatically exposed to an external IP on which we can access the resource (UI).

For the same, we can expose the Argo CD API server using any one of the below techniques:

  1. Exposing using Load Balancer as the Service type
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'

2. Use Istio or Ingress controller for exposing the Argo CD API Server.

3. Port Forwarding technique

kubectl port-forward svc/argocd-server -n argocd 8080:443

Using the above command, we can access the Argo CD UI on localhost:8080 without exposing the service.


5. Login to Argo CD API Server through Argo CD CLI

By default, the password for the Argo CD login is stored within the Argo CD secret named argocd-initial-admin-secret for the username admin.

We can retrieve the password using the below command-

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

Use the below command to login to the Argo CD API server using the above username and password-

argocd login <ARGOCD_SERVER_IP or HOSTNAME>

6. Inspect the User Interface

At this step, the User Interface becomes accessible to us. It should look like-

Image 7
Argo CD default screen

Once we enter the username and password, the below is the default landing page of Argo CD-

Image 8
Argo CD UI

We can now click on + NEW APP to create applications in sync with the Git repository to be deployed to the Kubernetes cluster.


Conclusion

By this, we have reached the end of this topic. Feel free to comment below, in case you come across any questions.

For more such posts related to Kubernetes, Stay tuned with us.

Till then, Happy Learning!! 馃檪

Leave a Reply

Your email address will not be published. Required fields are marked *

close
Generic selectors
Exact matches only
Search in title
Search in content