Argo CD — Declarative GitOps CD for Kubernetes

mayank agrawal
3 min readApr 29, 2021

--

In this article we will discuss lots of thing about argocd. why argocd becomes so popular now days, what is argocd, installation (GKE Cluster) we will discuss all things in this article. So let’s get started

What is ArgoCD?

Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes.

Why ArgoCD?

Application definitions, configurations, and environments should be declarative and version controlled. Application deployment and lifecycle management should be automated, auditable, and easy to understand.

How ArgoCD works?

Argo CD follows the GitOps pattern of using Git repositories as the source of truth for defining the desired application state. Kubernetes manifests file can be specified in different ways: kustomize file, helm charts, ksonnet , jsonnet files and yaml.

Architecture

Components:

ArgoCD WebUI / CLI

Interaction component for preforming any task after installing ArgoCD on Cluster.

GitHub Repository

Repository contained all your Manifests-YAML files.

API Server

  • application management and status reporting
  • invoking of application operations (e.g. sync, rollback, user-defined actions)
  • repository and cluster credential management (stored as K8s secrets)

Repository Server

The repository server is an internal service which maintains a local cache of the Git repository holding the application manifests.

  • repository URL
  • revision (commit, tag, branch)
  • application path

Application Controller

The application controller is a Kubernetes controller which continuously monitors running applications and compares the current, live state against the desired target state (as specified in the repo). It detects OutOfSync application state and optionally takes corrective action.

Redis & Dex-Server

Redis is only used as a throw-away cache and can be lost and rebuilt without loss of service. The Dex-Server uses an in-memory database, and two or more instances would have inconsistent data.

Installation

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

This will download the pod in argocd namespace. In ArgoCD we have 6 components so we have 6 running pods

Install ArgoCD CLI

VERSION=$(curl --silent "https://api.github.com/repos/argoproj/argo-cd/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
sudo curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/$VERSION/argocd-linux-amd64
sudo chmod +x /usr/local/bin/argocd

Access The Argo CD API Server

kubectl patch svc argocd-server -n argocd -p ‘{“spec”: {“type”: “LoadBalancer”}}’

If we don’t want to expose the service we can do port forwarding

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

Get the public ip by using

kubectl get svc argocd-server -n argocd

or we can use localhost:8080

Access the ArgoCD by GUI

Here username is admin

and password we can retrieve from by this command

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

After successful login this dashboard came

Now from here we can create the app

After apply this manifests file our app deployed on argocd

If any changes happen in github after some time changes will reflect

That’s all for this time here’s some references that can help!

--

--

mayank agrawal

I am devops enthusiast always trying to learn new technologies and try to implement in real world to solve real use cases. Creative integrator