Skip to content

๐Ÿš€ Scenario 05: GitOps with ArgoCD & Argo Rollouts

"Enterprise-Grade GitOps Defeats Deployment Chaos!"


๐Ÿ“– SCENARIO OVERVIEW

The GitOps Challenge

Chaos Agent has discovered that manual deployments lead to environment drift and inconsistent configurations! Different environments have different configurations, teams can't track what's deployed where, and the deployment process is a mess. There's no audit trail and no automated rollback capabilities.

The GitOps Hero Solution

Deploy an enterprise-grade GitOps system using ArgoCD and Argo Rollouts that provides declarative, automated, and visual deployment management. Experience advanced deployment strategies with real-time monitoring and comprehensive dashboards!

What You'll Build

  • ๐Ÿš€ ArgoCD Application Management with declarative GitOps workflows
  • ๐Ÿ“Š Argo Rollouts Dashboard for visual deployment strategies
  • ๐ŸŽญ Canary Deployment with gradual traffic shifting (25% โ†’ 50% โ†’ 75% โ†’ 100%)
  • ๐Ÿ”ต๐Ÿ”ด Blue-Green Deployment with environment switching and manual promotion
  • ๐Ÿ”„ Rolling Update Strategy with pod-by-pod updates
  • ๐Ÿ‘๏ธ Real-time Monitoring with comprehensive dashboards

โฑ๏ธ TIME ALLOCATION

Activity Duration Type
Live Demo (Instructor) 10 minutes ๐Ÿ‘€ Watch
ArgoCD & Argo Rollouts Setup 5 minutes ๐Ÿ› ๏ธ Hands-on
Interactive Deployment Strategies 15 minutes ๐ŸŽฎ Interactive
Dashboard Monitoring 5 minutes ๐Ÿ“Š Analysis
Total 35 minutes

๐ŸŽฏ LEARNING OBJECTIVES

By completing this scenario, you will:

โœ… Master GitOps principles and ArgoCD workflows
โœ… Implement advanced deployment strategies with Argo Rollouts
โœ… Experience visual deployment management and monitoring
โœ… Learn enterprise-grade deployment automation
โœ… Understand declarative infrastructure management
โœ… Defeat Chaos Agent's deployment inconsistency attacks! ๐Ÿš€


๐Ÿงจ THE CHAOS AGENT'S GITOPS ATTACK

"Your manual deployments are inconsistent! Different environments have different configurations! Your team can't track what's deployed where! Your deployment process is a mess!" ๐Ÿ˜ˆ

What Chaos Agent Exploits: - โŒ Manual deployments lead to environment drift - โŒ No audit trail of what's deployed - โŒ Inconsistent deployment processes across teams - โŒ No automated rollback capabilities - โŒ Lack of deployment strategy visualization - โŒ No declarative infrastructure management


๐Ÿฆธโ€โ™‚๏ธ THE GITOPS HERO'S RESPONSE

"Enter the world of GitOps! ArgoCD and Argo Rollouts will provide declarative, automated, and visual deployment management. Watch as I demonstrate enterprise-grade GitOps workflows!" ๐Ÿฆธโ€โ™‚๏ธ๐Ÿš€

How GitOps Hero Wins: - โœ… Declarative GitOps workflows - Infrastructure as code - โœ… Automated deployment management - Git-driven deployments - โœ… Visual deployment strategies - Real-time dashboard monitoring - โœ… Advanced deployment strategies - Canary, blue-green, rolling - โœ… Comprehensive audit trails - Complete deployment history - โœ… Instant rollback capabilities - Automated reversion - โœ… Multi-environment management - Consistent deployments


๐Ÿ“ FILE STRUCTURE

scenarios/05-gitops/
โ”œโ”€โ”€ README.md                          # This comprehensive guide
โ”œโ”€โ”€ argocd-apps/
โ”‚   โ”œโ”€โ”€ app-of-apps.yaml              # ArgoCD Application of Applications
โ”‚   โ””โ”€โ”€ apps/                         # Individual ArgoCD Applications
โ”‚       โ”œโ”€โ”€ frontend.yaml             # Points to overlays/rollouts
โ”‚       โ”œโ”€โ”€ recommendationservice.yaml # Points to overlays/rollouts
โ”‚       โ””โ”€โ”€ [other services].yaml
โ”œโ”€โ”€ services/                         # Base manifests (ClusterIP, Deployments)
โ”‚   โ”œโ”€โ”€ frontend/
โ”‚   โ”‚   โ”œโ”€โ”€ service-frontend.yaml     # ClusterIP
โ”‚   โ”‚   โ”œโ”€โ”€ service-frontend-external.yaml # NodePort (30081)
โ”‚   โ”‚   โ”œโ”€โ”€ deployment-frontend.yaml
โ”‚   โ”‚   โ””โ”€โ”€ serviceaccount-frontend.yaml
โ”‚   โ””โ”€โ”€ [other services]/
โ”œโ”€โ”€ overlays/
โ”‚   โ”œโ”€โ”€ local/
โ”‚   โ”‚   โ””โ”€โ”€ frontend/
โ”‚   โ”‚       โ””โ”€โ”€ service-frontend-external.yaml # NodePort (30081)
โ”‚   โ”œโ”€โ”€ cloud/
โ”‚   โ”‚   โ””โ”€โ”€ frontend/
โ”‚   โ”‚       โ””โ”€โ”€ service-frontend-external.yaml # LoadBalancer
โ”‚   โ””โ”€โ”€ rollouts/                     # Advanced deployment strategies
โ”‚       โ”œโ”€โ”€ frontend-rollout.yaml     # Canary deployment
โ”‚       โ”œโ”€โ”€ frontend-preview-service.yaml
โ”‚       โ”œโ”€โ”€ recommendationservice-rollout.yaml # Blue-green deployment
โ”‚       โ”œโ”€โ”€ recommendationservice-preview-service.yaml
โ”‚       โ””โ”€โ”€ analysis-template.yaml    # Health checks
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ interactive-demo.sh           # Interactive demo script
โ”‚   โ”œโ”€โ”€ setup.sh
โ”‚   โ”œโ”€โ”€ teardown.sh
โ”‚   โ”œโ”€โ”€ switch-overlay.sh
โ”‚   โ””โ”€โ”€ reset-demo.sh
โ””โ”€โ”€ scenario_05_gitops_argocd.md     # Complete handbook

๐Ÿš€ QUICK START (For Participants)

Prerequisites

  • โœ… Scenario 4 completed (blue-green demo should still be running)
  • โœ… Kubernetes cluster running (Docker Desktop, Minikube, or cloud)
  • โœ… kubectl configured and working
  • โœ… ArgoCD CLI installed (optional but recommended)

Step 1: Install ArgoCD & Argo Rollouts (3 minutes)

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

# Install Argo Rollouts
kubectl create namespace argo-rollouts
kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml
kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/dashboard-install.yaml

Step 2: Access Dashboards (2 minutes)

# Start ArgoCD UI
kubectl port-forward svc/argocd-server -n argocd 8080:443 &
# Visit http://localhost:8080

# Start Argo Rollouts UI
kubectl port-forward deployment/argo-rollouts-dashboard -n argo-rollouts 3100:3100 &
# Visit http://localhost:3100 (switch to gitops-demo namespace)

Step 3: Get ArgoCD Admin Password

kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d && echo
# Username: admin
# Password: (output from above)

Step 4: Bootstrap the App-of-Apps (2 minutes)

# Navigate to gitops scenario
cd scenarios/05-gitops

# Bootstrap ArgoCD applications
kubectl apply -f argocd-apps/app-of-apps.yaml

Expected Output:

๐Ÿš€ GITOPS WITH ARGOCD & ARGO ROLLOUTS
======================================================================
๐Ÿ”ง Installing ArgoCD and Argo Rollouts...
โœ… ArgoCD installed successfully
โœ… Argo Rollouts installed successfully
๐ŸŒ Starting dashboards...
โœ… ArgoCD UI: http://localhost:8080
โœ… Argo Rollouts UI: http://localhost:3100
๐Ÿ” Getting admin credentials...
โœ… Username: admin
โœ… Password: <auto-generated>
๐Ÿš€ Bootstrapping applications...
โœ… App-of-apps pattern deployed
โณ Syncing applications...
โœ… All applications synced successfully

======================================================================
๐ŸŽ‰ GITOPS DEPLOYMENT SUCCESSFUL!
โœ… Enterprise-grade GitOps ready!
======================================================================

๐ŸŽฏ ACCESS YOUR GITOPS DASHBOARDS:
   ๐Ÿ”ง ArgoCD UI: http://localhost:8080 (admin/<password>)
   ๐Ÿ“Š Argo Rollouts UI: http://localhost:3100 (switch to gitops-demo namespace)
   ๐ŸŒ Demo App: http://localhost:8080 (via port-forward)

Step 5: Access Your GitOps Dashboards (Immediate)

๐Ÿ”ง ArgoCD UI:

๐Ÿ’ป Primary: http://localhost:8080
๐Ÿ‘ค Username: admin
๐Ÿ” Password: <auto-generated>

๐Ÿ“Š Argo Rollouts UI:

๐Ÿ’ป Primary: http://localhost:3100
โš ๏ธ Important: Switch namespace to gitops-demo

๐ŸŒ Demo Application:

# Port forward to demo app
kubectl port-forward service/frontend-external 8080:80 -n gitops-demo
# Then access: http://localhost:8080

Step 6: Interactive Deployment Strategies (15 minutes)

  1. ๐ŸŽญ Canary Deployment (Frontend):
  2. Edit overlays/rollouts/frontend-rollout.yaml
  3. Change image tag to trigger canary
  4. Watch traffic shift: 25% โ†’ 50% โ†’ 75% โ†’ 100%
  5. Use Argo Rollouts UI to promote/rollback

  6. ๐Ÿ”ต๐Ÿ”ด Blue-Green Deployment (Recommendationservice):

  7. Edit overlays/rollouts/recommendationservice-rollout.yaml
  8. Change image tag to trigger blue-green
  9. Watch blue (stable) and green (preview) environments
  10. Use Argo Rollouts UI to promote green to blue

  11. ๐Ÿ”„ Rolling Update Strategy:

  12. Edit deployment manifests
  13. Watch pod-by-pod updates
  14. Experience zero-downtime deployments

Step 7: Dashboard Monitoring (5 minutes)

  1. ๐Ÿ“Š ArgoCD Dashboard:
  2. View application health and sync status
  3. Monitor deployment history
  4. Check resource synchronization

  5. ๐Ÿ“ˆ Argo Rollouts Dashboard:

  6. Visual deployment progress
  7. Traffic shifting visualization
  8. Health check monitoring

๐ŸŽฌ LIVE DEMO WALKTHROUGH (For Instructors)

Demo Script Overview

Part 1: GitOps Chaos Exposed (3 minutes)

# Show deployment inconsistency chaos
./demo-script.sh

What Students See: 1. Manual deployments causing environment drift 2. No audit trail of deployments 3. Inconsistent configurations 4. "This is deployment chaos!"

Part 2: GitOps Hero Saves the Day (4 minutes)

# Deploy ArgoCD and Argo Rollouts
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml
kubectl apply -f argocd-apps/app-of-apps.yaml

Key Teaching Points: - ๐Ÿš€ Declarative GitOps workflows - ๐Ÿš€ Automated deployment management - ๐Ÿš€ Visual deployment strategies - ๐Ÿš€ Comprehensive monitoring

Part 3: Interactive Strategy Testing (3 minutes)

  • Demonstrate canary deployment
  • Show blue-green switching
  • Highlight dashboard monitoring
  • Celebrate GitOps victory!

๐Ÿš€ GITOPS CONFIGURATION

1. ArgoCD Application of Applications

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: app-of-apps
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/vellankikoti/ci-cd-chaos-workshop
    targetRevision: HEAD
    path: Kubernetes/kubernetes-scenarios/05-gitops/argocd-apps
  destination:
    server: https://kubernetes.default.svc
    namespace: gitops-demo
  syncPolicy:
    automated:
      prune: true
      selfHeal: true

2. Frontend Application

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: frontend
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/vellankikoti/ci-cd-chaos-workshop
    targetRevision: HEAD
    path: Kubernetes/kubernetes-scenarios/05-gitops/overlays/rollouts
  destination:
    server: https://kubernetes.default.svc
    namespace: gitops-demo
  syncPolicy:
    automated:
      prune: true
      selfHeal: true

3. Canary Deployment Strategy

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: frontend
  namespace: gitops-demo
spec:
  replicas: 4
  strategy:
    canary:
      steps:
      - setWeight: 25
      - pause: {}
      - setWeight: 50
      - pause: {}
      - setWeight: 75
      - pause: {}
      - setWeight: 100
  selector:
    matchLabels:
      app: frontend
  template:
    metadata:
      labels:
        app: frontend
    spec:
      containers:
      - name: server
        image: us-central1-docker.pkg.dev/google-samples/microservices-demo/frontend:v0.10.3
        ports:
        - containerPort: 8080

4. Blue-Green Deployment Strategy

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: recommendationservice
  namespace: gitops-demo
spec:
  replicas: 2
  strategy:
    blueGreen:
      activeService: recommendationservice
      previewService: recommendationservice-preview
      autoPromotionEnabled: false
      scaleDownDelaySeconds: 30
  selector:
    matchLabels:
      app: recommendationservice
  template:
    metadata:
      labels:
        app: recommendationservice
    spec:
      containers:
      - name: server
        image: us-central1-docker.pkg.dev/google-samples/microservices-demo/recommendationservice:v0.10.3
        ports:
        - containerPort: 8080

๐Ÿงช GITOPS TESTING

Test 1: Canary Deployment

# Trigger canary deployment
kubectl apply -f overlays/rollouts/frontend-rollout.yaml

# Watch progress in Argo Rollouts UI
# Visit http://localhost:3100 and switch to gitops-demo namespace

Test 2: Blue-Green Deployment

# Trigger blue-green deployment
kubectl apply -f overlays/rollouts/recommendationservice-rollout.yaml

# Watch environments in Argo Rollouts UI
# Promote green to blue when ready
kubectl argo rollouts promote recommendationservice -n gitops-demo

Test 3: GitOps Sync

# Check ArgoCD applications
kubectl get applications -n argocd

# Force sync with latest revision
kubectl patch application frontend -n argocd --type='merge' -p='{"spec":{"source":{"targetRevision":"HEAD"}}}'

Test 4: Rollback Capability

# Rollback to previous version
kubectl argo rollouts rollback frontend -n gitops-demo

# Check rollback status
kubectl get rollout frontend -n gitops-demo

๐Ÿ“Š GITOPS MONITORING

ArgoCD Dashboard Monitoring

# Check application health
kubectl get applications -n argocd

# View sync status
kubectl describe application frontend -n argocd

# Check deployment history
kubectl get events -n argocd --sort-by='.lastTimestamp'

Argo Rollouts Dashboard Monitoring

# Check rollout status
kubectl get rollouts -n gitops-demo

# View rollout details
kubectl describe rollout frontend -n gitops-demo

# Monitor traffic shifting
kubectl get services -n gitops-demo

Real-time Metrics

# Monitor pod status
kubectl get pods -n gitops-demo -w

# Check resource usage
kubectl top pods -n gitops-demo

# View application logs
kubectl logs -f deployment/frontend -n gitops-demo

๐ŸŽฏ SUCCESS CRITERIA

โœ… Scenario 05 Complete Checklist:

  • โœ… ArgoCD installed and accessible
  • โœ… Argo Rollouts installed and functional
  • โœ… App-of-apps pattern deployed
  • โœ… Canary deployment strategy working
  • โœ… Blue-green deployment strategy operational
  • โœ… Dashboard monitoring functional
  • โœ… GitOps workflows automated
  • โœ… Chaos Agent's deployment inconsistency attacks defeated! ๐Ÿš€

Key Learning Outcomes:

  • โœ… GitOps Principles - Mastered declarative infrastructure
  • โœ… ArgoCD Management - Implemented application automation
  • โœ… Argo Rollouts - Experienced advanced deployment strategies
  • โœ… Dashboard Monitoring - Applied visual deployment management
  • โœ… Automated Workflows - Built Git-driven deployments
  • โœ… Enterprise Patterns - Implemented production-ready GitOps

๐Ÿš€ NEXT STEPS

What's Next:

  • Production GitOps - Apply these patterns to real applications
  • Advanced ArgoCD - Explore more complex application patterns
  • Multi-Cluster GitOps - Deploy across multiple environments
  • Custom Rollout Strategies - Build application-specific strategies

Production GitOps:

  • Implement comprehensive GitOps workflows
  • Add security scanning and compliance
  • Build automated testing pipelines
  • Regular GitOps strategy reviews

๐Ÿ†˜ TROUBLESHOOTING

Common GitOps Issues:

Issue: ArgoCD not syncing applications

# Solution: Check application status
kubectl get applications -n argocd
kubectl describe application frontend -n argocd

Issue: Rollouts not visible in dashboard

# Solution: Switch namespace in Argo Rollouts UI
# Navigate to http://localhost:3100 and select gitops-demo namespace

Issue: Canary deployment stuck

# Solution: Promote the rollout
kubectl argo rollouts promote frontend -n gitops-demo

Issue: Blue-green not switching

# Solution: Check service selectors
kubectl get services -n gitops-demo
kubectl describe service recommendationservice -n gitops-demo

๐ŸŽ‰ CONCLUSION

Congratulations! You've successfully defeated Chaos Agent's deployment inconsistency attacks! ๐Ÿš€

What You've Accomplished:

  • โœ… Implemented enterprise-grade GitOps with ArgoCD
  • โœ… Mastered advanced deployment strategies with Argo Rollouts
  • โœ… Created visual deployment management with dashboards
  • โœ… Built automated GitOps workflows for consistency
  • โœ… Applied declarative infrastructure principles

Key GitOps Takeaways:

  • GitOps provides consistency across all environments
  • Declarative infrastructure ensures reproducibility
  • Visual dashboards improve deployment visibility
  • Advanced strategies enable safe deployments
  • Automation reduces human error and deployment time

You've completed all 5 Kubernetes scenarios and are now a GitOps master! ๐ŸŽ‰


Remember: In the world of GitOps, automation and consistency are your superpowers against chaos! ๐Ÿš€