DEV Community

Audu Ephraim
Audu Ephraim

Posted on

End-to-End workflow with Azure Devops, Docker and ArgoCD

This project demonstrates how an end-to-end Gitops workflow was automated from start to finish using

  • Azure devops pipeline to build an application into a docker image and push said image to DockerHub.
  • configure Argocd to watch repository Kubernetes configuration files and update a Kubernetes cluster based on Kubernetes configuration files.

Azure DevOps Pipeline

trigger:
  branches:
    include:
    - master
  paths:
    exclude:
    - 'k8/*'

resources:
- repo: self

variables:
  dockerHub: 'docker-hub-service'  
  imageName: 'ephraimaudu/azure-argo-dev'
  imageTag: '$(Build.BuildId)'

stages:
  - stage: Build
    displayName: build and push image to docker hub
    jobs:
      - job: Build
        displayName: build
        pool: 
          name: myagent
        steps:
        - task: Docker@2
          inputs:
            containerRegistry: $(dockerHub)
            repository: $(imageName)
            command: 'buildAndPush'
            Dockerfile: '**/Dockerfile' 
            tags: |
              $(imageTag)
Enter fullscreen mode Exit fullscreen mode
  • build is triggered when a change is made in the master branch excluding files in the k8 folder. those are Kubernetes configuration files
  • The Azure devops pipeline was configured to run on a self-hosted agent called "myagent" while running on the local machine. installation and configuration guide is pretty straightforward and can be found Here

Image description

ArgoCD

ArgoCD is a continuous delivery tool for Kubernetes. It automates application deployment and lifecycle management from Git repositories to specified clusters.

Essentially, it ensures that your live application state matches the desired state defined in your Git repository.

The kubernetes configuration file in the specified repository is constantly being watched, when they change argocd compares with the live application in the cluster if they are out of sync argocd syncs the cluster to match the configuration files.

ArgoCD runs in its own namespace running its pods

Image description

Argocd provides a detailed web UI to manage cluster or clusters

Image description

link to repository

Top comments (0)