How to deploy Argo cd in Kubernetes cluster

Reading Time: 5 minutes
OneLogin - Argo CD - Declarative GitOps CD for Kubernetes

Hello folks, As you might know, that Argocd is a declarative continuous deployment tool that you can use to deploy your applications to your Kubernetes cluster.

How it works?

The way Argocd works is you define all your applications manifest all your resources that you want to deploy in your Kubernetes cluster so you’ll define all of them in GitHub repository and then Argocd will pull the changes or pull the resource definition from the GitHub repository and it deploys the resources for you in your Kubernetes cluster.

Components of argo cd :

After we’ll see the components of Argocd

Argocd Server or API Server: the Argocd-server is an important component which is the API server. all the instructions you do with Argocd have to go through this API server.

Repo-server: it’s responsible to communicate with your external GitHub repository and also it maintains a cache of your GitHub repository so whenever you change your repo it pulls the changes for the last commit and then finds what has actually changed and what’s the current state of deployment etc.

application controller: Argocd component is responsible to maintain the state of the deployed resource in your Kubernetes cluster.

Redis: it’s an advanced key-value cache and store.

Dex-Server: Argocd-dex is like a gateway for your Argocd application so you can connect to dex-server with an external identity provider if you’ve got an active directory, you can hook it up with Argocd through this dex server component.

ways to deploy argocd:

Argocd the way it deploys to the cluster there are two ways:

manual sync

automatic sync

manual v/s automatic sync

so the difference between both, while you create a new app, is if you’ve set the sync policy to

be manual it checks out the Github repo and maintains a local cache in the repo server and

then it doesn’t actually deploy the resources it waits for you to push a button.

After it, there will be a synchronize button that you need to press and then it will deploy the


for automatic:

Similarly, if you set the policy to automatic once you have created the app, then the app will be

immediately deploy to your Kubernetes cluster.

Now the app is deployed so it constantly checks the state of the app so you define

the apps in your GitHub repository and it also makes sure that the resource deployed in

your Kubernetes cluster matches the definition that you’ve in the GitHub repository.

for example :

if there is any change or the deployed resources deviates from the state that

we’ve defined in the GitHub repo so Argocd will complain that the app is out of

sync in case of the manual but if auto sync is enabled then even if you make any

changes manually so it will automatically update the resources to match the definition.

However, if you want to update your application you just need to make the changes in

the repo and commit the changes then the repo server constantly pulls the changes so

it’ll find that.


let’s begin with deploying Argocd in the k3d Kubernetes cluster and k3d installation:

k3d cluster create --agents 2
kubectl get nodes

therefore we’ve Nginx deployment and service.yml

kubectl create namespace argocd
kubectl apply -n argocd -f

Argocd related components deployed to Argocd namespace to check it:

kubectl get all -n argocd

But before it in order to use Argocd web UI service/argocd-server is responsible for that but by fault, it’s exposed as ClusterIP which isn’t accessible outside the cluster so what I’m gonna do is change this to NodePort.

kubectl -n argocd edit svc argocd-server

pick any nodes running IP and service/Argocd-server any 80 or 443 highlighted in the below image:

the default username is admin and for password

kubectl get secrets -n argocd argocd-initial-admin-secret -o yaml

copy the encoded password and decode it

 echo "RnVNSGc1dkdBLUZKdlg4Rw==" | base64 -d

copy the password and you’ll see the Argocd web UI like this

deploy argo cd

After it, the first thing we need to add is the repository.

NOTE: you need to use the Argocd CLI command-line tool to add a new cluster.

now let’s create an application: give the application name and rest settings to default like for project and namespace, the path will be yamls directory name, etc then click on create an application and the yaml in below URL.
deploy argo cd

After creating the application so you can see out of sync state because of

manual sync so you need to sync it manually and to do that press

the sync button after selecting the application.

deploy argo cd

Now you can see deployment is getting created and

pods are running and the app status is sync and healthy.

Similarly, you can check the sync status :

deploy argo cd

Now we’ve deployed the application through Argocd so Argocd deployed the application for us.

 kubectl get all
deploy argo cd
deploy argo cd

Conclusion: In this blog, you have seen that the Nginx pod is running so our Nginx application

has been deployed through Argocd and it has taken care of the deployment for us.

Written by 

A curious DevOps Intern , love to learn and working on technical skills/tools, know the basics of Linux, Docker, Ansible , Kubernetes and more..