Implementing CICD using Argo

Harshad
2 min readSep 6, 2023

--

Argo CD is a continuous delivery tool that helps you manage your Kubernetes applications. It uses a declarative approach to define the desired state of your applications, and then it automatically deploys and updates them to match that state.

Argo CD can be used with any Kubernetes cluster, and it supports a variety of deployment strategies, including blue-green deployments, canary deployments, and rolling updates. It also has a number of features that make it easy to manage your applications, such as support for multiple environments, automatic rollbacks, and detailed audit logs.

In this blog post, we will show you how to set up a CI/CD pipeline using Argo CD. Introduction: CI/CD (Continuous Integration/Continuous Delivery) is a software development practice that enables the continuous delivery of software updates to production. Argo is an open-source tool that helps you create and manage CI/CD pipelines. In this blog, we will discuss how to set up a CI/CD pipeline using Argo on Google Cloud Platform (GCP).

Prerequisites: Before you begin, make sure you have the following:

  • A GCP project with the Kubernetes Engine API enabled.
  • Argo CLI installed.
  • A GitHub repository with your code.

Setting Up Argo:

  1. Install Argo CLI:
curl -sSL https://github.com/argoproj/argo-cd/releases/latest/download/argo-linux-amd64.tar.gz | tar -xzv
sudo mv argo /usr/local/bin

2. Create a namespace for Argo:

kubectl create namespace argo

3. Install Argo:

argo install --namespace argo

4. Create a secret for Argo to access your GitHub repository:

kubectl create secret generic argocd-secret --namespace argo --from-literal=username=<your-github-username> --from-literal=password=<your-github-password>

Creating a CI/CD Pipeline:

  1. Create a new Argo application:
argo app create my-app --project default --source https://github.com/your-github-username/your-repo.git --destination default

2. Create a new Argo workflow:

argo workflow create my-workflow --template=argo-workflow.yaml

3. Edit the argo-workflow.yaml file and add the following steps:

steps:
- name: build
template: build
- name: test
template: test
- name: deploy
template: deploy

4. Create a new Argo task for each step in the workflow:

argo task create build --template=build-task.yaml
argo task create test --template=test-task.yaml
argo task create deploy --template=deploy-task.yaml

5. Edit the task templates and add the appropriate commands for each step:

build-task.yaml:
template:
container:
image: your-build-image
command: ["./build.sh"]
test-task.yaml:
template:
container:
image: your-test-image
command: ["./test.sh"]
deploy-task.yaml:
template:
container:
image: your-deploy-image
command: ["./deploy.sh"]

6. Start the Argo workflow:

argo workflow start my-workflow

Monitoring the Pipeline:

  1. You can monitor the progress of the pipeline in the Argo UI:
kubectl port-forward svc/argo-server -n argo 8080:8080

2. Access the Argo UI at http://localhost:8080.

Conclusion: In this blog, we discussed how to set up a CI/CD pipeline using Argo on GCP. Argo is a powerful tool that can help you automate the software delivery process. By using Argo, you can improve the quality and efficiency of your software development process.

--

--

Harshad
Harshad

Written by Harshad

7x GCP | 2X Oracle Cloud| 1X Azure Certified | Cloud Data Engineer

No responses yet