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