GitOps Architecture Diagram

GitOps with ArgoCD and Kubernetes

🎯 Problem Statement Traditional deployment approaches often suffer from: Manual deployments leading to human errors Configuration drift between environments Lack of audit trail for changes Slow rollback processes during incidents No single source of truth for cluster state πŸ’‘ Solution Overview I implemented a GitOps-based continuous deployment pipeline using ArgoCD that treats Git as the single source of truth for declarative infrastructure and application definitions. πŸ—οΈ Architecture β”Œ β”‚ β”” β”Œ β”‚ β”‚ β”‚ β”” β”Œ β”‚ β”‚ β”‚ β”‚ β”‚ β”” ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ G ( - - - ─ ─ ─ ─ A S R ─ ─ i C ─ ─ ─ ─ p o e ─ ─ t I B T P ─ ─ ─ ─ p u p ─ ─ H u e u ─ ─ ─ ─ l r o ─ ─ u P i s s ─ ─ ─ ─ i c s ─ ─ b i l t h ─ ─ ─ β”‚ β–Ό ─ c e i ─ β”‚ β”‚ β–Ό ─ p d ─ β”Œ β”‚ β”‚ β”‚ β”‚ β”‚ β”” ─ ─ ─ a t ─ ─ A e I ─ ─ ─ ─ ─ ─ t C o ─ ─ c l m ─ ─ ─ ─ ─ ─ i o r ─ ─ t i a ─ ─ β”Œ β”‚ β”‚ β”” ─ ─ ─ ─ o d y ─ ─ i n g ─ ─ ─ N ─ ─ ─ ─ ─ n e ─ ─ o e e ─ ─ ─ a ─ ─ ─ ─ ─ ─ ─ n ) ─ ─ ─ m ─ ─ ─ ─ ─ ─ ─ s ─ ─ ─ D e ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ e s ─ ─ ─ ─ ┐ β”‚ β”‚ β”‚ β”˜ ┐ β”‚ β”‚ β”‚ β”‚ β”‚ β”˜ ─ ─ v p ─ ─ ─ ─ ─ ─ ─ ─ ─ a ─ ─ ─ ─ ─ ─ ─ ─ ─ c ─ ─ ─ ─ ─ ─ ─ ─ K ─ e ─ ─ ─ ─ ─ ─ ─ ─ u ┐ β”‚ β”‚ β”˜ ─ ─ ─ β–Ί β–Ί ─ ─ b ─ ─ D ─ β”Œ β”‚ β”‚ β”‚ β”” β”Œ β”‚ β”‚ β”‚ β”‚ β”Ό β”‚ β”” ─ e β”Œ β”‚ β”‚ β”” ─ ─ e ─ ─ ─ ─ ─ ─ ─ r ─ N ─ ─ ─ v ─ ─ ─ ─ ─ ─ ─ n ─ S a ─ ─ ─ e ─ ─ ─ ─ ( - - ─ - ─ ─ e ─ t m ─ ─ ─ l ─ ─ C ( ─ ─ C ─ ─ ─ t ─ a e ─ ─ ─ o ─ ─ o K ─ ─ D S H ─ R ─ ─ e ─ g s ─ ─ ─ p ─ ─ n 8 ─ ─ A y e ─ o ─ ─ s ─ i p ─ ─ ─ e ─ ─ f s ─ ─ r P n a ─ l ─ ─ ─ n a ─ ─ ─ r ─ ─ i ─ ─ g l c l ─ l ─ ─ C ─ g c ─ ─ ─ ─ ─ g Y ─ β”‚ β”‚ β–Ό ─ o a t ─ b ─ β”‚ β–Ό ─ l ─ e ─ ─ ─ W ─ ─ A ─ ─ C t h ─ a ─ ─ u ┐ β”‚ β”‚ β”˜ ─ ─ o ─ ─ R M ─ ─ D f ─ c ─ ─ s ─ ─ r ─ ─ e L ─ ─ o C ─ k ─ ─ t β”Œ β”‚ β”‚ β”” ─ ─ k ─ ─ p ) ─ ─ r h ─ ─ ─ e ─ N ─ ─ ─ f ─ ─ o ─ ─ m e ─ ─ ─ r ─ a ─ ─ ─ l ─ ─ ─ ─ ) c ─ ─ ─ ─ P m ─ ─ ─ o ─ ─ ─ ─ k ─ ─ ─ ─ r e ─ ─ ─ w ─ ─ ─ ─ ─ ─ ─ ─ o s ─ ─ ─ ─ ┐ β”‚ β”‚ β”‚ β”˜ ┐ β”‚ β”‚ β”‚ β”‚ β”Ό β”‚ β”˜ ─ ─ d p ─ ─ ─ ─ ─ ─ ─ a ─ ─ ─ ─ ─ ─ ─ c ─ ─ ─ ─ ─ ─ ─ e ─ ─ ─ ─ ─ ─ ┐ β”‚ β”‚ β”˜ ─ ─ ─ ─ ─ ─ ─ ─ β”Œ β”‚ β”‚ β”‚ β”” ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ C R ( ─ ─ ─ β”‚ β”‚ β”‚ β”‚ ─ ─ ─ ─ o e A ─ ─ ┐ β”‚ β”˜ ─ ─ ─ n g C ─ ─ ─ ─ ─ t i R ─ ─ ─ ─ ─ a s / ─ β”‚ β”‚ β”‚ β”‚ β”‚ β”˜ ─ ─ ─ i t G ─ β–² β”‚ β”‚ ─ ─ ─ n r C ─ ─ ─ ─ e y R ─ ─ ─ ─ r ) ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ β”˜ ┐ β”‚ β”‚ β”‚ β”˜ β”‚ πŸ› οΈ Technologies Used Category Technology GitOps Platform ArgoCD 2.8+ CI Platform GitHub Actions Container Registry Azure Container Registry Kubernetes AKS / GKE Secrets Management Sealed Secrets / External Secrets Notifications Slack, Microsoft Teams Metrics Prometheus + ArgoCD Metrics πŸ“ Repository Structure # a β”œ β”œ β”œ β”‚ β”‚ β”” # g β”œ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”œ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”” p ─ ─ ─ ─ i ─ ─ ─ A p ─ ─ ─ ─ G t ─ ─ ─ p - i o p r s D . β”” R t p a β”œ β”‚ β”‚ β”‚ β”‚ β”” a β”œ β”‚ β”‚ β”‚ β”” i β”œ β”œ β”” l e r o g ─ E O s p ─ ─ r ─ ─ n ─ ─ ─ i p c c i ─ A p - p ─ ─ g ─ ─ f ─ ─ ─ c o k t D s r s o r a e h w β”” M e / b β”œ β”œ β”œ β”” β”œ β”œ β”” c a β”œ β”œ β”” p β”” a c i m t r u o ─ E C p a ─ ─ ─ ─ v ─ ─ ─ d p ─ ─ ─ r ─ s e n o i f b r ─ . o o s ─ ─ ─ ─ e ─ ─ ─ / p ─ ─ ─ o ─ t r g n o i / k m n / e r l j r t r i n l f c d f / d s i k l d s p i a a a e m u - e t e l i i e e n u a e t r c p p p c y c m s o R o . g p r g s y v a o a p p p t - t a s r e w y u l v r t s g d t - - - s p u n - i p s a r o i e o i / i d s p / r r a n n o / m a y c s m n o e t r o e g g g s l t m e s i g n v a o j / e i / i i e . . z / s . g d e r n t o n y y a y i . c / x o n t a a t a n y t / r . m m i m g a . y R y l l o l . m y e a n y l a p m . a m o l y m l s a l i m t l o r y πŸ”„ GitOps Workflow CI Pipeline (GitHub Actions) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 name: CI Pipeline on: push: branches: [main] pull_request: branches: [main] jobs: build-and-push: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - name: Build and test run: | docker build -t app:${{ github.sha }} . docker run app:${{ github.sha }} npm test - name: Push to ACR uses: azure/docker-login@v1 with: login-server: ${{ secrets.ACR_LOGIN_SERVER }} username: ${{ secrets.ACR_USERNAME }} password: ${{ secrets.ACR_PASSWORD }} - run: | docker tag app:${{ github.sha }} ${{ secrets.ACR_LOGIN_SERVER }}/app:${{ github.sha }} docker push ${{ secrets.ACR_LOGIN_SERVER }}/app:${{ github.sha }} update-manifests: needs: build-and-push runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 with: repository: org/gitops-repo token: ${{ secrets.GH_PAT }} - name: Update image tag run: | cd apps/overlays/dev kustomize edit set image app=${{ secrets.ACR_LOGIN_SERVER }}/app:${{ github.sha }} - name: Commit and push run: | git config user.name "github-actions" git config user.email "github-actions@github.com" git add . git commit -m "Update dev image to ${{ github.sha }}" git push ArgoCD Application Definition 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: my-app-dev namespace: argocd finalizers: - resources-finalizer.argocd.argoproj.io spec: project: default source: repoURL: https://github.com/org/gitops-repo.git targetRevision: HEAD path: apps/overlays/dev destination: server: https://kubernetes.default.svc namespace: dev syncPolicy: automated: prune: true selfHeal: true syncOptions: - CreateNamespace=true retry: limit: 5 backoff: duration: 5s maxDuration: 3m0s factor: 2 πŸ” Security Implementation RBAC - Role-based access control for ArgoCD users SSO Integration - Azure AD / GitHub OAuth Sealed Secrets - Encrypted secrets in Git Network Policies - ArgoCD namespace isolation Audit Logging - Complete audit trail of all changes πŸ“Š Results & Metrics Metric Before After Deployment Frequency Weekly Multiple per day Lead Time for Changes 2-3 days < 1 hour Mean Time to Recovery 4 hours < 15 minutes Change Failure Rate 15% < 2% πŸ”‘ Key Learnings Separation of Concerns - Keeping app code and configuration in separate repos provides clear boundaries Progressive Delivery - Promoting changes through environments (dev β†’ staging β†’ prod) catches issues early Self-Healing - ArgoCD’s self-heal feature ensures the cluster always matches the desired state Observability - ArgoCD’s built-in dashboard provides excellent visibility into deployment status πŸ”— Resources GitHub Repository: github.com/yourusername/gitops-argocd Related Blog Post: Getting Started with GitOps Interested in implementing GitOps? Let’s discuss! ...

May 20, 2024 Β· 9 min Β· 1839 words Β· Elmi Abdullahi
GitOps Workflow Diagram

Getting Started with GitOps: A Practical Guide

What is GitOps? GitOps is a modern approach to continuous deployment that uses Git as the single source of truth for declarative infrastructure and applications. Coined by Weaveworks in 2017, GitOps extends the principles of Infrastructure as Code (IaC) to the entire deployment lifecycle. Core Principles Declarative Configuration - The entire system is described declaratively Version Controlled - The desired state is stored in Git Automated Delivery - Approved changes are automatically applied Continuous Reconciliation - Agents ensure actual state matches desired state Why GitOps? Traditional deployment approaches often suffer from several challenges: ...

November 15, 2024 Β· 7 min Β· 1296 words Β· Elmi Abdullahi