GitOps Workflows
Expert guidance for implementing production-grade GitOps workflows using ArgoCD and Flux CD, covering declarative deployment patterns, progressive delivery strategies, multi-environment management, and secure secret handling for Kubernetes infrastructure.
When to Use This Skill
- Implementing GitOps principles for Kubernetes deployments
- Automating continuous delivery from Git repositories
- Managing multi-cluster or multi-environment deployments
- Implementing progressive delivery (canary, blue-green) strategies
- Configuring automated sync policies and reconciliation
- Managing secrets securely in GitOps workflows
- Setting up environment promotion workflows
- Designing repository structures for GitOps (monorepo vs multi-repo)
- Implementing rollback strategies and disaster recovery
- Establishing compliance and audit trails through Git
Core Concepts
The Four Principles
- Declarative: Entire system state expressed in code
- Versioned: Canonical state stored in Git with full history
- Pulled Automatically: Agents pull desired state (no push to prod)
- Continuously Reconciled: Automatic drift detection and correction
Key Benefits
- Complete deployment history and audit trail
- Fast rollback via Git operations
- Enhanced security (no cluster credentials in CI)
- Self-healing infrastructure
- Multi-cluster consistency
- Familiar Git workflows for infrastructure changes
Quick Reference
| Task |
Load reference |
| GitOps principles and benefits |
skills/gitops-workflows/references/core-principles.md |
| Repository structure patterns (monorepo, multi-repo, branches) |
skills/gitops-workflows/references/repository-structures.md |
| ArgoCD setup, Applications, ApplicationSets |
skills/gitops-workflows/references/argocd-implementation.md |
| Flux bootstrap, sources, Kustomizations, HelmReleases |
skills/gitops-workflows/references/flux-implementation.md |
| Environment promotion strategies |
skills/gitops-workflows/references/environment-promotion.md |
| Secret management (Sealed Secrets, ESO, SOPS) |
skills/gitops-workflows/references/secret-management.md |
| Progressive delivery (canary, blue-green) |
skills/gitops-workflows/references/progressive-delivery.md |
| Rollback strategies and disaster recovery |
skills/gitops-workflows/references/rollback-strategies.md |
| Best practices and patterns |
skills/gitops-workflows/references/best-practices.md |
Workflow Steps
1. Choose Repository Structure
Decision factors:
- Team size and organization structure
- Application coupling and dependencies
- Access control requirements
- Deployment frequency and independence
Options:
- Monorepo: Single repo, unified platform teams, shared infrastructure
- Multi-repo: Separate repos per app/team, independent release cycles
- Environment branches: Git flow style, simple mental model
2. Select GitOps Tool
ArgoCD:
- UI-focused with visual application management
- App of Apps pattern for hierarchical deployments
- ApplicationSets for multi-cluster deployments
- Strong RBAC and project isolation
Flux:
- CLI-first, GitOps Toolkit architecture
- Native Kustomize and Helm support
- Automated image updates
- Lighter weight, cloud-native
3. Configure Secret Management
Never commit unencrypted secrets to Git
Options:
- Sealed Secrets: Client-side encryption, simple workflow
- External Secrets Operator: Sync from external secret stores (AWS, Vault, GCP)
- SOPS: File-based encryption with age or cloud KMS
4. Implement Sync Policies
Non-production environments:
- Automated sync with
prune and selfHeal
- Frequent reconciliation (1-5 minutes)
- Fail fast with immediate feedback
Production environments:
- Manual approval or gated automation
- Health checks and wait conditions
- Progressive delivery for high-risk changes
- Sync windows for maintenance periods
5. Set Up Environment Promotion
Promotion strategies:
- Git-based: Tag or branch promotion with Git operations
- Kustomize overlays: Update image tags in environment-specific overlays
- Automated updates: Flux ImageUpdateAutomation for semver policies
6. Configure Progressive Delivery
For high-risk changes:
- ArgoCD Rollouts: Canary deployments with automated analysis
- Flagger: Progressive delivery with metric-based promotion
- Traffic shifting with Istio or other service mesh
- Automated rollback on failed analysis
7. Establish Rollback Procedures
Git rollback:
git revert for specific commits
- Tag-based rollback by updating targetRevision
- Fast and declarative
Tool-specific:
- ArgoCD:
argocd app rollback with revision history
- Flux: Suspend automation, manual rollback, resume
Common Mistakes
- Committing unencrypted secrets - Always use secret management solution
- No automated sync in non-prod - Slows development feedback
- Automated sync in production without gates - High risk of breaking changes
- Ignoring drift detection - Manual changes should be reconciled or alerted
- No health checks - Sync succeeds but app is unhealthy
- Missing dependency ordering - Apps deploy before infrastructure ready
- No rollback testing - Discover issues during actual incidents
- Inconsistent environments - Staging differs too much from production
- No promotion testing - Manual errors during environment promotion
- Weak RBAC - Too many permissions for GitOps service accounts
Resources
1---2name: gitops-workflows3description: GitOps workflows and patterns using ArgoCD and Flux for declarative Kubernetes deployments. Use when implementing CI/CD for Kubernetes, managing multi-environment deployments, or adopting declarative infrastructure practices.4---5
6# GitOps Workflows
7
8Expert guidance for implementing production-grade GitOps workflows using ArgoCD and Flux CD, covering declarative deployment patterns, progressive delivery strategies, multi-environment management, and secure secret handling for Kubernetes infrastructure.
9
10## When to Use This Skill
11
12- Implementing GitOps principles for Kubernetes deployments
13- Automating continuous delivery from Git repositories
14- Managing multi-cluster or multi-environment deployments
15- Implementing progressive delivery (canary, blue-green) strategies
16- Configuring automated sync policies and reconciliation
17- Managing secrets securely in GitOps workflows
18- Setting up environment promotion workflows
19- Designing repository structures for GitOps (monorepo vs multi-repo)
20- Implementing rollback strategies and disaster recovery
21- Establishing compliance and audit trails through Git
22
23## Core Concepts
24
25### The Four Principles
26
271. **Declarative**: Entire system state expressed in code
282. **Versioned**: Canonical state stored in Git with full history
293. **Pulled Automatically**: Agents pull desired state (no push to prod)
304. **Continuously Reconciled**: Automatic drift detection and correction
31
32### Key Benefits
33
34- Complete deployment history and audit trail
35- Fast rollback via Git operations
36- Enhanced security (no cluster credentials in CI)
37- Self-healing infrastructure
38- Multi-cluster consistency
39- Familiar Git workflows for infrastructure changes
40
41## Quick Reference
42
43| Task | Load reference |
44| --- | --- |
45| GitOps principles and benefits | `skills/gitops-workflows/references/core-principles.md` |
46| Repository structure patterns (monorepo, multi-repo, branches) | `skills/gitops-workflows/references/repository-structures.md` |
47| ArgoCD setup, Applications, ApplicationSets | `skills/gitops-workflows/references/argocd-implementation.md` |
48| Flux bootstrap, sources, Kustomizations, HelmReleases | `skills/gitops-workflows/references/flux-implementation.md` |
49| Environment promotion strategies | `skills/gitops-workflows/references/environment-promotion.md` |
50| Secret management (Sealed Secrets, ESO, SOPS) | `skills/gitops-workflows/references/secret-management.md` |
51| Progressive delivery (canary, blue-green) | `skills/gitops-workflows/references/progressive-delivery.md` |
52| Rollback strategies and disaster recovery | `skills/gitops-workflows/references/rollback-strategies.md` |
53| Best practices and patterns | `skills/gitops-workflows/references/best-practices.md` |
54
55## Workflow Steps
56
57### 1. Choose Repository Structure
58
59**Decision factors:**
60- Team size and organization structure
61- Application coupling and dependencies
62- Access control requirements
63- Deployment frequency and independence
64
65**Options:**
66- **Monorepo**: Single repo, unified platform teams, shared infrastructure
67- **Multi-repo**: Separate repos per app/team, independent release cycles
68- **Environment branches**: Git flow style, simple mental model
69
70### 2. Select GitOps Tool
71
72**ArgoCD:**
73- UI-focused with visual application management
74- App of Apps pattern for hierarchical deployments
75- ApplicationSets for multi-cluster deployments
76- Strong RBAC and project isolation
77
78**Flux:**
79- CLI-first, GitOps Toolkit architecture
80- Native Kustomize and Helm support
81- Automated image updates
82- Lighter weight, cloud-native
83
84### 3. Configure Secret Management
85
86**Never commit unencrypted secrets to Git**
87
88**Options:**
89- **Sealed Secrets**: Client-side encryption, simple workflow
90- **External Secrets Operator**: Sync from external secret stores (AWS, Vault, GCP)
91- **SOPS**: File-based encryption with age or cloud KMS
92
93### 4. Implement Sync Policies
94
95**Non-production environments:**
96- Automated sync with `prune` and `selfHeal`
97- Frequent reconciliation (1-5 minutes)
98- Fail fast with immediate feedback
99
100**Production environments:**
101- Manual approval or gated automation
102- Health checks and wait conditions
103- Progressive delivery for high-risk changes
104- Sync windows for maintenance periods
105
106### 5. Set Up Environment Promotion
107
108**Promotion strategies:**
109- **Git-based**: Tag or branch promotion with Git operations
110- **Kustomize overlays**: Update image tags in environment-specific overlays
111- **Automated updates**: Flux ImageUpdateAutomation for semver policies
112
113### 6. Configure Progressive Delivery
114
115**For high-risk changes:**
116- **ArgoCD Rollouts**: Canary deployments with automated analysis
117- **Flagger**: Progressive delivery with metric-based promotion
118- Traffic shifting with Istio or other service mesh
119- Automated rollback on failed analysis
120
121### 7. Establish Rollback Procedures
122
123**Git rollback:**
124- `git revert` for specific commits
125- Tag-based rollback by updating targetRevision
126- Fast and declarative
127
128**Tool-specific:**
129- ArgoCD: `argocd app rollback` with revision history
130- Flux: Suspend automation, manual rollback, resume
131
132## Common Mistakes
133
1341. **Committing unencrypted secrets** - Always use secret management solution
1352. **No automated sync in non-prod** - Slows development feedback
1363. **Automated sync in production without gates** - High risk of breaking changes
1374. **Ignoring drift detection** - Manual changes should be reconciled or alerted
1385. **No health checks** - Sync succeeds but app is unhealthy
1396. **Missing dependency ordering** - Apps deploy before infrastructure ready
1407. **No rollback testing** - Discover issues during actual incidents
1418. **Inconsistent environments** - Staging differs too much from production
1429. **No promotion testing** - Manual errors during environment promotion
14310. **Weak RBAC** - Too many permissions for GitOps service accounts
144
145## Resources
146
147- **OpenGitOps**: https://opengitops.dev/
148- **ArgoCD Documentation**: https://argo-cd.readthedocs.io/
149- **Flux Documentation**: https://fluxcd.io/docs/
150- **ArgoCD Rollouts**: https://argoproj.github.io/argo-rollouts/
151- **Flagger**: https://docs.flagger.app/
152- **External Secrets Operator**: https://external-secrets.io/
153- **Sealed Secrets**: https://github.com/bitnami-labs/sealed-secrets
154- **SOPS**: https://github.com/mozilla/sops