Skip to content

Commit f6feca5

Browse files
committed
2
1 parent a098230 commit f6feca5

1 file changed

Lines changed: 101 additions & 16 deletions

File tree

docs/argocd.md

Lines changed: 101 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/downloa
7777

7878
### 2. Bootstrap ArgoCD (One Command Deployment)
7979
Deploy the self-managing ArgoCD `Application`. This bootstrap application will:
80-
1. Install ArgoCD itself
81-
2. Create the three ApplicationSets
82-
3. Automatically discover and deploy all infrastructure, monitoring, and applications
80+
1. Install ArgoCD itself using Helm
81+
2. Create all three ApplicationSets automatically
82+
3. Discover and deploy all infrastructure, monitoring, and applications
8383

8484
```bash
8585
# Apply the ArgoCD bootstrap application - this is the ONLY manual command needed
@@ -88,21 +88,24 @@ kubectl apply -f infrastructure/argocd-app.yaml
8888

8989
**That's it!** ArgoCD will now manage itself and deploy everything else automatically.
9090

91+
The bootstrap application references the three ApplicationSets via the ArgoCD kustomization, ensuring they're deployed as part of ArgoCD's self-management.
92+
9193
## 🔧 Project Setup
9294

9395
ArgoCD projects define permissions and boundaries for applications. Our cluster uses three main projects with clear separation:
9496

95-
- **infrastructure**: Core cluster components (Cilium, Longhorn, Cert-Manager, etc.)
97+
- **infrastructure**: Core cluster components (ArgoCD, Cilium, Longhorn, Cert-Manager, etc.)
9698
- **monitoring**: Observability stack (Prometheus, Grafana, Loki, etc.)
9799
- **my-apps**: All user workloads (media, AI, dev, privacy, etc.)
98100

99-
These `AppProject` resources are defined in `infrastructure/projects.yaml` and are deployed automatically.
101+
These `AppProject` resources are defined in `infrastructure/projects.yaml` and are deployed automatically as part of the ArgoCD bootstrap.
100102

101103
## 📱 ApplicationSet Management
102104

103-
We use **three simple ApplicationSets** (enterprise pattern):
105+
We use **three simple ApplicationSets** following enterprise patterns:
104106

105107
### 1. Infrastructure ApplicationSet (`infrastructure/root-appset.yaml`)
108+
Manages all core infrastructure components:
106109
```yaml
107110
apiVersion: argoproj.io/v1alpha1
108111
kind: ApplicationSet
@@ -119,12 +122,29 @@ spec:
119122
template:
120123
metadata:
121124
name: 'infra-{{path.basename}}'
125+
labels:
126+
type: infrastructure
122127
spec:
123128
project: infrastructure
124-
# ... rest of config
129+
source:
130+
plugin:
131+
name: kustomize-build-with-helm
132+
repoURL: https://github.com/mitchross/k3s-argocd-proxmox.git
133+
targetRevision: HEAD
134+
path: '{{path}}'
135+
destination:
136+
server: https://kubernetes.default.svc
137+
namespace: '{{path.basename}}'
138+
syncPolicy:
139+
automated:
140+
prune: true
141+
selfHeal: true
142+
syncOptions:
143+
- CreateNamespace=true
125144
```
126145
127146
### 2. Monitoring ApplicationSet (`monitoring/monitoring-components-appset.yaml`)
147+
Manages the observability stack:
128148
```yaml
129149
apiVersion: argoproj.io/v1alpha1
130150
kind: ApplicationSet
@@ -134,17 +154,36 @@ metadata:
134154
spec:
135155
generators:
136156
- git:
157+
repoURL: https://github.com/mitchross/k3s-argocd-proxmox.git
158+
revision: HEAD
137159
directories:
138160
- path: monitoring/*/*
139161
template:
140162
metadata:
141163
name: 'monitoring-{{path.basename}}'
164+
labels:
165+
type: monitoring
142166
spec:
143167
project: monitoring
144-
# ... rest of config
168+
source:
169+
plugin:
170+
name: kustomize-build-with-helm
171+
repoURL: https://github.com/mitchross/k3s-argocd-proxmox.git
172+
targetRevision: HEAD
173+
path: '{{path}}'
174+
destination:
175+
server: https://kubernetes.default.svc
176+
namespace: '{{path.basename}}'
177+
syncPolicy:
178+
automated:
179+
prune: true
180+
selfHeal: true
181+
syncOptions:
182+
- CreateNamespace=true
145183
```
146184

147185
### 3. Applications ApplicationSet (`my-apps/myapplications-appset.yaml`)
186+
Manages all user applications:
148187
```yaml
149188
apiVersion: argoproj.io/v1alpha1
150189
kind: ApplicationSet
@@ -154,14 +193,32 @@ metadata:
154193
spec:
155194
generators:
156195
- git:
196+
repoURL: https://github.com/mitchross/k3s-argocd-proxmox.git
197+
revision: HEAD
157198
directories:
158199
- path: my-apps/*/*
159200
template:
160201
metadata:
161202
name: '{{path[1]}}-{{path.basename}}'
203+
labels:
204+
type: application
162205
spec:
163206
project: my-apps
164-
# ... rest of config
207+
source:
208+
plugin:
209+
name: kustomize-build-with-helm
210+
repoURL: https://github.com/mitchross/k3s-argocd-proxmox.git
211+
targetRevision: HEAD
212+
path: '{{path}}'
213+
destination:
214+
server: https://kubernetes.default.svc
215+
namespace: '{{path.basename}}'
216+
syncPolicy:
217+
automated:
218+
prune: true
219+
selfHeal: true
220+
syncOptions:
221+
- CreateNamespace=true
165222
```
166223

167224
## 📂 Repository Structure
@@ -171,9 +228,11 @@ The repository follows a clean three-tier structure that maps directly to the Ap
171228
```
172229
├── infrastructure/ # Infrastructure ApplicationSet
173230
│ ├── controllers/ # ArgoCD, External Secrets, etc.
231+
│ │ └── argocd/ # ArgoCD self-management
174232
│ ├── networking/ # Cilium, Gateway API, etc.
175233
│ ├── storage/ # Longhorn, CSI drivers, etc.
176234
│ ├── database/ # PostgreSQL, Redis operators
235+
│ ├── projects.yaml # ArgoCD projects
177236
│ └── root-appset.yaml # Infrastructure ApplicationSet
178237
├── monitoring/ # Monitoring ApplicationSet
179238
│ ├── prometheus-stack/ # Prometheus, Grafana, AlertManager
@@ -193,23 +252,23 @@ The repository follows a clean three-tier structure that maps directly to the Ap
193252

194253
1. **Self-Managing ArgoCD**:
195254
- ArgoCD manages its own installation and upgrades
196-
- ApplicationSets are part of the ArgoCD application itself
255+
- ApplicationSets are deployed as part of ArgoCD's kustomization
197256
- Zero manual intervention after bootstrap
198257

199258
2. **Enterprise Pattern**:
200259
- Clear separation of concerns with three ApplicationSets
201-
- Follows GitOps best practices
202-
- Scalable and maintainable
260+
- Follows GitOps best practices used in production
261+
- Scalable and maintainable architecture
203262

204263
3. **Simple Directory Discovery**:
205-
- No complex excludes or wildcards
206264
- Each ApplicationSet scans its own directory pattern
265+
- No complex excludes or wildcards needed
207266
- Easy to understand and modify
208267

209268
4. **Production Ready**:
210269
- Proper error handling and retries
211270
- Automated sync with self-healing
212-
- Comprehensive ignore patterns for drift
271+
- Comprehensive ignore patterns for configuration drift
213272

214273
## 🚀 Deployment Workflow
215274

@@ -224,13 +283,31 @@ kubectl apply -k infrastructure/
224283

225284
### Production Deployment
226285
```bash
227-
# Single command deployment
286+
# Single command deployment - ArgoCD manages everything from here
228287
kubectl apply -f infrastructure/argocd-app.yaml
229288
230289
# Monitor deployment progress
231290
kubectl get applications -n argocd -w
291+
292+
# Check ApplicationSets
293+
kubectl get applicationsets -n argocd
294+
295+
# View generated applications by type
296+
kubectl get applications -n argocd -l type=infrastructure
297+
kubectl get applications -n argocd -l type=monitoring
298+
kubectl get applications -n argocd -l type=application
232299
```
233300

301+
## 🔍 Application Naming Conventions
302+
303+
The ApplicationSets use consistent naming patterns:
304+
305+
| ApplicationSet | Pattern | Example Applications |
306+
|----------------|---------|---------------------|
307+
| **Infrastructure** | `infra-{basename}` | `infra-argocd`, `infra-cilium`, `infra-longhorn` |
308+
| **Monitoring** | `monitoring-{basename}` | `monitoring-prometheus-stack`, `monitoring-loki-stack` |
309+
| **Applications** | `{category}-{basename}` | `media-plex`, `ai-ollama`, `home-frigate` |
310+
234311
## Best Practices
235312

236313
- **All cluster state is managed in Git** - no manual changes
@@ -251,6 +328,11 @@ kubectl get applicationsets -n argocd
251328
252329
# View application details
253330
kubectl describe application infra-argocd -n argocd
331+
332+
# Check applications by type
333+
kubectl get applications -n argocd -l type=infrastructure
334+
kubectl get applications -n argocd -l type=monitoring
335+
kubectl get applications -n argocd -l type=application
254336
```
255337

256338
### Common Issues
@@ -266,8 +348,11 @@ kubectl describe application infra-argocd -n argocd
266348
# Check ArgoCD managing itself
267349
kubectl get application argocd -n argocd -o yaml
268350
269-
# View ArgoCD ApplicationSets
351+
# View ArgoCD ApplicationSets (should show 3)
270352
kubectl get applicationsets -n argocd
353+
354+
# Check ArgoCD kustomization references
355+
kubectl describe application argocd -n argocd
271356
```
272357

273358
## Enterprise Patterns

0 commit comments

Comments
 (0)