Automating Kubernetes Deployments With ArgoCD

  • November 17, 2021

Overview

ArgoCD is a deployment mechanism based on the GitOps principle used in Kubernetes clusters and applications running. It is an automation tool with an impact in the productivity of your development team, specially in the CI/CD process. Argo CD is a tool that helps us forget the existence of `kubectl apply`, `helm install`, and similar commands. It is a mechanism that allows us to focus on defining the desired state of our environments and pushing definitions to Git. It is up to Argo CD to figure out how to converge our desires into reality. The major components of the ArgoCD tool include the following:

  • ArgoCD-server: This helps for interaction with argoCD.
  • Repo-server: This helps for interaction with the GitHub repositories and comparing desired and current states.
  • App controller: This helps to maintain the state of the deployment.
  • Redis: This helps for orchestrating caching mechanism.
  • Dex server: This service provides an essential abstraction layer between other services (e.g. an app, microservice or a Kubernetes cluster itself) and sources of identity.

These all work to get the declarative resources from the GitHub repository and initialize them on the Kubernetes clusters in any cloud provider of your choice.

 

Working Principle Of ArgoCD – Demo

Requirements

  1. Understand basic Kubernetes commands and processes.
  2. Understand Git.
  3. Kubernetes cluster running either locally or in the cloud.

 

Tutorial Steps

1.Firstly, check the number of nodes available:

 

2.Install ArgoCD in the cluster via this documentation and view all the services, deployments, and resources as shown thus:

 

3.Change the accessibility of the argoCD server via changing the resource type from ClusterIP to Nodeport so you can view it from outside the cluster. This is done by changing the yaml file and replacing the type with NodePort.

 

4.Get the IP address of one of the pods and use the ports from the argoserver to run on your local browser to access the ArgoCD web UI. Here is a sample:
172.31.0.3:32576 – This should give you access but take not, this will vary in your own case because of the pod you have running on your machine already. Here is the browser below:

From this UI, you can add repositories, clusters and many other resources. Try to navigate and see the UI possibilities. Also, you can create an application and this will give you a chance to connect the project with the repository that has all your manifest files to be remotely initialized on your clusters.

 

5.Next, you should synchronize everything with the GitHub repository so you do not have to manage things manually; you can see a use-case below:

 

6.After syncing, you can see the details of the process and how the deployment is going through.

 

7.Confirm the details of the deployment by running the command “kubectl get all”.

 

8.Finally, use the IP of the pod that was deployed with the port of the corresponding service, you should have access to your application.

 

In final words, any changes made to your repository would cause a job to happen in the ArgoCD process and ensures that your desired state of the application is attained but this is dependent on activating the auto-sync feature. Other interesting features include the self-healing capability amongst many others. it is important that ArgoCD completely manage the deployment and maintenance infrastructure and you should activate auto-sync so in case there is any change in states or deployments twitches then it could automatically ensure the states are in sync and the declared resources are maintained as well.

 

Credits
Written by: Gabriel Vazquez
General corrections and edition: Diego Woitasen