Streamlining Kubernetes CI/CD Powering Efficiency with GitLab and ArgoCD

August 7, 2023by Dhawal
What is GitLab?

GitLab, a collaborative open-source platform, unites code repository, issue tracking, and CI/CD, serving large DevOps and DevSecOps projects while offering free access to individuals.

What is ArgoCD?

ArgoCD, an open-source GitOps tool, automates application deployment by synchronizing cluster state with Git-based infrastructure definitions, streamlining continuous delivery.

Kubernetes CICD using GitLab and ArgoCD workflow as shown below.

Prerequisites:
  1. ArgoCD
  2. Gitlab CICD
  3. Kubernetes Cluster
Deploying ArgoCD In Kubernetes Cluster.

Deploying ArgoCD, the GitOps powerhouse for Kubernetes, involves installing it within the cluster. You can choose from various methods, such as CLI, YAML, or the ArgoCD Operator, to set it up seamlessly and automate application deployment.

Requirements:

To install ArgoCD via CLI, ensure kubectl and a functional Kubernetes cluster, then use a single command for a seamless setup.

Create a namespace for argocd and apply the installation yaml file.

kubectl create namespace argocd

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

Deploying the App using ArgoCD

After ArgoCD installation, effortlessly deploy your app by leveraging Git repositories to manage deployments. Combine your app’s source code and Kubernetes manifests in the same repo for seamless management.

To access the Argo instance locally, execute the command provided, enabling port-forwarding for efficient development and monitoring.

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

Retrieve the Argo password by executing the command below.

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

 

Now access ArgoCD GUI

Step 1: Access the login page

Access http://localhost:8080 in your browser, then input ‘admin’ as the username and employ the extracted password for ArgoCD UI login.

Step 2: Create the application

 

Step 3: Sync the application

Step 4: Check the app status

For this simple application, achieving a Healthy Status should be immediate.

Visualize the app’s hierarchy through a graph of Kubernetes components.

How does ArgoCD work?

ArgoCD keeps watch on specified git branches, promptly applying changes in Kubernetes manifests to the cluster upon updates or creations, triggered by commits or merges.