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)
- 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
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
Argocd provides a detailed web UI to manage cluster or clusters
Top comments (0)