๐ 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)
- ๐ญ Canary Deployment (Frontend):
- Edit
overlays/rollouts/frontend-rollout.yaml - Change image tag to trigger canary
- Watch traffic shift: 25% โ 50% โ 75% โ 100%
-
Use Argo Rollouts UI to promote/rollback
-
๐ต๐ด Blue-Green Deployment (Recommendationservice):
- Edit
overlays/rollouts/recommendationservice-rollout.yaml - Change image tag to trigger blue-green
- Watch blue (stable) and green (preview) environments
-
Use Argo Rollouts UI to promote green to blue
-
๐ Rolling Update Strategy:
- Edit deployment manifests
- Watch pod-by-pod updates
- Experience zero-downtime deployments
Step 7: Dashboard Monitoring (5 minutes)
- ๐ ArgoCD Dashboard:
- View application health and sync status
- Monitor deployment history
-
Check resource synchronization
-
๐ Argo Rollouts Dashboard:
- Visual deployment progress
- Traffic shifting visualization
- 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! ๐