Skip to main content

Command Palette

Search for a command to run...

πŸš€ Introduction to Continuous Integration (CI) and ArgoCD for GitOps-driven MLOps

Published
β€’6 min read
πŸš€ Introduction to Continuous Integration (CI) and ArgoCD for GitOps-driven MLOps
B

I am Bittu Sharma, a DevOps & AI Engineer with a keen interest in building intelligent, automated systems. My goal is to bridge the gap between software engineering and data science, ensuring scalable deployments and efficient model operations in production.! π—Ÿπ—²π˜'π˜€ π—–π—Όπ—»π—»π—²π—°π˜ I would love the opportunity to connect and contribute. Feel free to DM me on LinkedIn itself or reach out to me at bittush9534@gmail.com. I look forward to connecting and networking with people in this exciting Tech World.

Introduction: CI/CD in the World of MLOps

In today’s Machine Learning Operations (MLOps) ecosystem, managing code, models, and infrastructure efficiently is key to faster and more reliable delivery.

To achieve this, modern teams adopt:

  • Continuous Integration (CI) β€” to build, test, and validate ML pipelines automatically

  • Continuous Delivery/Deployment (CD) β€” to deploy model services automatically into Kubernetes

This blog introduces you to ArgoCD, a GitOps-based CD tool that automates deployment directly from your Git repository, making the process declarative, traceable, and scalable.


βš™οΈ What is Continuous Integration (CI)?

Continuous Integration (CI) is the practice of frequently merging small code changes into a shared repository and validating them automatically through builds and tests.

πŸ”Ή In an MLOps Context

CI ensures that:

  • Model training scripts and pipeline code work consistently

  • Code changes are tested automatically before being merged

  • ML artifacts (data, models, and pipelines) are version-controlled

🧩 Typical CI Workflow

  1. Developer commits new code to GitHub

  2. GitHub Actions or Jenkins builds and tests the pipeline

  3. Model or container image is created and pushed to a registry (like DockerHub or ECR)

  4. ArgoCD automatically deploys the new version into Kubernetes


πŸŒ€ Overview of ArgoCD for GitOps

ArgoCD is a declarative, GitOps-based continuous delivery tool for Kubernetes.
It continuously monitors your Git repository for configuration changes and syncs them to your Kubernetes cluster.

πŸ”Ή Why GitOps?

GitOps ensures that Git is the single source of truth for your infrastructure and applications.
If a deployment differs from what’s in Git, ArgoCD automatically reconciles it.

πŸ”Ή Benefits of ArgoCD

  • βœ… Automated and consistent deployments

  • βœ… Rollbacks to previous versions easily

  • βœ… Real-time sync between Git and Kubernetes

  • βœ… Built-in UI and CLI for visualization

  • βœ… Secure and audit-friendly


🧩 Setting Up CI Pipelines with ArgoCD

Let’s integrate Continuous Integration and Continuous Delivery with GitOps.

πŸ”Ή Step 1: Build and Test your ML Code (CI)

Use any CI tool β€” GitHub Actions, Jenkins, Tekton, or GitLab CI β€” to automate testing.

Example GitHub Workflow (.github/workflows/ci.yml):

name: Build and Test ML App
on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v4

      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.10'

      - name: Install Dependencies
        run: pip install -r requirements.txt

      - name: Run Unit Tests
        run: pytest tests/

      - name: Build Docker Image
        run: docker build -t my-ml-app:${{ github.sha }} .

      - name: Push Image to Registry
        run: |
          docker login -u $DOCKER_USER -p $DOCKER_PASS
          docker push my-ml-app:${{ github.sha }}

πŸ”Ή Step 2: Update Kubernetes Manifests in Git

Once the image is built, the pipeline updates the Kubernetes YAML manifest in a GitOps repo:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ml-model-api
spec:
  replicas: 2
  selector:
    matchLabels:
      app: ml-model-api
  template:
    metadata:
      labels:
        app: ml-model-api
    spec:
      containers:
        - name: ml-model-api
          image: my-ml-app:<VERSION_TAG>
          ports:
            - containerPort: 5000

This Git update triggers ArgoCD to automatically deploy the latest version.


⚑ Automating Model Deployment with ArgoCD

πŸ”Ή Step 1: Install ArgoCD

Install ArgoCD in your Kubernetes cluster:

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

Expose the ArgoCD API server:

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

Login using the CLI:

argocd login localhost:8080

πŸ”Ή Step 2: Create an Application in ArgoCD

argocd app create ml-model-app \
  --repo https://github.com/your-org/mlops-deployments.git \
  --path manifests \
  --dest-server https://kubernetes.default.svc \
  --dest-namespace mlops

Sync the application:

argocd app sync ml-model-app

Now ArgoCD will automatically deploy whenever your Git repo changes.


πŸ”„ Integrating ArgoCD with GitHub for Continuous Delivery

πŸ”Ή Step 1: Connect GitHub Repository

In the ArgoCD UI:

  1. Go to Settings β†’ Repositories β†’ Connect Repo

  2. Add your GitHub repository URL and credentials

  3. Choose Auto-Sync mode for continuous delivery

πŸ”Ή Step 2: Configure Webhooks

Enable GitHub Webhooks to notify ArgoCD on every push:

https://argocd-server-url/api/webhook

Each new commit or PR automatically triggers synchronization, ensuring Git β†’ Cluster consistency.


πŸš€ Managing Deployments with ArgoCD

πŸ”Ή From the ArgoCD UI

You can visually see:

  • Current vs desired states

  • Application health (Healthy, Degraded, Missing)

  • Sync status (Synced, OutOfSync)

πŸ”Ή Managing with CLI

argocd app list
argocd app get ml-model-app
argocd app sync ml-model-app
argocd app delete ml-model-app

πŸ”Ή Example Deployment Workflow

  1. Commit a change to the deployment manifest

  2. GitHub triggers ArgoCD

  3. ArgoCD syncs the update

  4. New model image is deployed automatically


βͺ Rolling Back and Updating Deployments in Kubernetes

ArgoCD maintains a complete deployment history.
You can roll back with a single command:

argocd app rollback ml-model-app <REVISION_ID>

Or manually redeploy a specific Git commit:

argocd app sync ml-model-app --revision <GIT_COMMIT_SHA>

This ensures rapid rollback in case of performance issues or model drift.


πŸ“ˆ Monitoring Deployment Status with ArgoCD

πŸ”Ή UI Monitoring

The ArgoCD dashboard gives you a live visual representation of:

  • Pods and services

  • Deployment health

  • Sync status

  • Errors and drift detection

πŸ”Ή CLI Monitoring

argocd app health ml-model-app
argocd app history ml-model-app

πŸ”Ή Integration with Observability Tools

You can integrate Prometheus, Grafana, or OpenTelemetry for:

  • Pipeline performance metrics

  • Deployment latency

  • Model serving status


🧩 Example: End-to-End MLOps CI/CD Flow

Developer β†’ GitHub (Code Commit)
      ↓
GitHub Actions (CI Build/Test)
      ↓
Docker Image Push β†’ Container Registry
      ↓
GitOps Repo Update β†’ YAML Manifests
      ↓
ArgoCD Auto-Sync β†’ Kubernetes Deployment
      ↓
ArgoCD Dashboard β†’ Monitor & Rollback

🧭 Best Practices for CI/CD with ArgoCD

Best PracticeDescription
Keep Git as Source of TruthAll deployment manifests live in Git
Use Auto-SyncFor faster delivery cycles
Enable RBACSecure access and permissions
Tag Docker ImagesUse commit SHA or version tags
Integrate MonitoringUse Prometheus and Grafana
Document WorkflowKeep a Confluence record of model updates

🧠 Key Takeaways

βœ… CI ensures code quality and test automation
βœ… ArgoCD delivers GitOps-based deployment automation
βœ… Rollbacks and updates are instant and version-controlled
βœ… Integrating GitHub + ArgoCD creates a seamless delivery pipeline
βœ… Perfect setup for data-driven, model-driven, or inference-driven deployments


🏁 Conclusion

With Continuous Integration (CI) validating every model and ArgoCD automating its deployment, your MLOps lifecycle becomes fully automated, reproducible, and observable.

From code commit to production rollout β€” every step is tracked, versioned, and reversible.
That’s the true power of GitOps with ArgoCD πŸš€

Follow me on LinkedIn

Follow me on GitHub

Keep Learning……