Select Page
by

Sreejith S Menon

|
last updated on November 28, 2023
Share

Introduction

ArgoCD and its role in deploying applications

ArgoCD simplifies the deployment of applications via automated deployment (to Kubernetes clusters) and GitOps continuous delivery approach. 

ArgoCD works on declarative configuration files, such as Kubernetes manifests, Helm charts, and other types of YAML files, stored in a Git repository. The changes to these configuration files can be monitored and automatically trigger deployments to the target environment when changes are detected. This is an extremely efficient way of managing the entire deployment process using Git, including version control, change management, rollbacks and audit.

The high-level functionalities Argo CD offers can be related to but not restricted to:

  • Rollbacks: Automated rollback to a previous best version if deployment is having issues.
  • Application monitoring: Helps in identifying the health issues for applications via metrics monitoring. 
  • Configuration management: Manage configuration files for all applications and environments for maintaining consistency and reducing errors.

Argo CD helps developers deliver applications or services faster and safer. 

Enterprise Argo and OpsMx

Overview

In this article we will explore how applications can be onboarded on ArgoCD for continuous delivery in an efficient way. 

Prerequisites

As an Argo CD user

You need the following to be able to create an application using Argo CD. Assuming that you have:

  • Access to Argo CD cluster – Argo CD instance is up and running
  • Access to Kubernetes – Kubernetes target destination is up and running
  • Access to container registry – where application images can be stored
  • Access to Git repository – where application manifests and configuration files must be stored 
  • Configured Argo CD to work with Git repository and Kubernetes cluster.

If you are beginning from scratch then these steps are mentioned below for reference. 

User Skill Set

A user trying to achieve this should have a basic understanding or conceptual knowledge of ArgoCD and its configurations. The User may or may not have the expertise around Kubernetes is just fine.  

Setting up ArgoCD

Just to reiterate, here are a few easy steps to set up Argo CD:

Installing Argo CD

You can install an Argo CD on your Kubernetes cluster using the CLI or by using a Helm chart. 

  • If you are using the CLI, you need to run the following command:
				
					kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

				
			
  • When using a Helm chart, you can use the following command:
				
					helm repo add argo https://argoproj.github.io/argo-helm
helm install argocd argo/argo-cd

				
			
  • To access Argo CD UI port-forward the ARgo CD to your local machine:
				
					kubectl port-forward svc/argocd-server -n argocd 8080:443
				
			
  • Access the UI via browser using 
				
					https://localhost:8080
				
			
  • Login to Argo CD after obtaining credentials, by retrieving the password for “admin” user using
				
					kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
				
			

Configure Argo CD

Configure access to the Git repository and the target Kubernetes cluster. 

  • To add a git repository, create a Kubernetes secret that contains Git repo credentials in the same namespace as Argo CD as shown below
				
					apiVersion: v1
kind: Secret
metadata:
  name: private-repo
  namespace: argocd
  labels:
    argocd.argoproj.io/secret-type: repository
stringData:
  type: git
  url: https://github.com/argoproj/private-repo
  password: my-password
  username: my-username
				
			
  • Registering a Kubernetes cluster is only required when deploying to an external cluster. To deploy to the same cluster that the Argo CD is running in,https://kubernetes.default.svc can be used as the application’s destination cluster URL.
    • To connect an external cluster, first install the Argo CD command line tool from here.
    • List all the cluster contexts in your current kubeconfig
				
					kubectl config get-contexts -o name
				
			
  • Choose the context name and use the following command to add it to Argo CD
				
					argocd cluster add CONTEXT_NAME
				
			

You are now ready to create and then deploy your application using Argo CD.

Access the ArgoCD dashboard and verify settings

Now that you’ve added your Git repository, you may verify the following from the UI:

  • Repository: From the Settings menu, Navigate to the Repositories tab and verify your repository is listed there.
  • Cluster: From the Settings menu, Navigate to the Clusters tab and verify your cluster is listed there.

Creating an application

Steps to create an application in ArgoCD

  • Navigate to the Applications tab. Click the New application button located at the top right corner of the Applications page.
  • Enter the application details – the Application Name, Project, and Sync Policy. Set Sync Policy as “Manual” if you do not want Argo CD to automatically Sync the git repository to the cluster, otherwise choose “Automatic”
  • You also need to specify the Repository URL where your application manifests are located, the Revision of the manifests to use, and the Path to the manifests in the repository.
  • To specify the Destination cluster navigate to the Destination section, specify the Cluster and the Namespace where the application should be deployed. Choose https://kubernetes.default.svc if you want to deploy to the same cluster.
  • Once you have reviewed the details, click the Create button. The created application will show up in the Applications tab. 

Congratulations, you just successfully created your application using Argo CD.

Deploying an application

Steps to deploy an application once it has been created in ArgoCD

  • Once the application is created, Argo CD automatically syncs it but just in case you want to manually sync the application, you can click on the Sync button. 
  • To view the components in your application and their status click on the application box. As you can see below, the application is successfully Synced with the destination cluster and it is healthy.

Best practices

Tips and recommendations for creating and deploying applications in ArgoCD

For improving the efficiency and effectiveness of deploying applications Argo CD following best practices are recommended.

  • Follow GitOps practices to ensure all changes and versions are tracked in the Git repo.
  • You may want to use Argo CD Projects to better organize your applications and provide additional access control.
  • Use of Helm charts or Kustomize can help simplify the management of complex applications.
  • Use of Argo Rollouts along with Argo CD to make use of advanced deployment strategies such as canary and blue-green 
  • Use automated log and metric analysis to verify the deployments or for the application health check. Even when leaning towards third-party observability tools, Argo CD and Rollouts have restrictions on analyzing the number of metrics and don’t support log analysis by default. You may want to refer to automated verification for Argo rollouts.
  • Apply security checks to your Argo CD installations and all the integration points. We also recommend enabling RBAC as extended guardrails. 

Conclusion

Argo offers the simplest and safest mechanism to deploy your Kubernetes applications. Users need not possess expert skills in Kubernetes while working with Argo (however additional knowledge is always useful). 

There are certain limitations that come as a part of any open-source software but those can be addressed with plugins and extensions offered by the community or the enterprise software vendors. 

As you mature with your GitOps practices, you may find the need for specific add-ons especially for:

  • Visibility and insights into your applications and Argo CD clusters
  • Audit and supply chain traceability (vulnerability and security checks)
  • Delivery intelligence (AI/ML driven automated approvals and verifications)
  • Compliances and Governance using policy orchestration
  • UI driven self-service capabilities

Please refer to the newly released OpsMx ISD for Argo (ver 4.1.2) 

OpsMx can fast track your Argo CD / Rollouts adoption and improve the maturity model around GitOps practices for greater efficiencies and profitability. 

Contact us to learn more.

About OpsMx

Founded with the vision of “delivering software without human intervention,” OpsMx enables customers to transform and automate their software delivery processes. OpsMx builds on open-source Spinnaker and Argo with services and software that helps DevOps teams SHIP BETTER SOFTWARE FASTER.

Tags : Argo, Argo CD

Sreejith S Menon

Sreejith S Menon is a Product Manager at OpsMx. He is experienced in product planning, designing and developing components. He is also interested in user experience, automation and no-code/low-code development.

Link

0 Comments

Submit a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.