flux-gitops-patterns
Skill19 starsChanged 10 months agoMITView on GitHub
Use when designing GitOps repository structure, setting up dependency chains between resources, implementing multi-environment deployments, configuring secrets management with Flux, setting up notifications and alerts, or optimizing reconciliation intervals
In this repository19 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- cert-manager-troubleshootingSkill
- external-dns-troubleshootingSkill
- external-secrets-troubleshootingSkill
- flux-operationsSkill
- flux-troubleshootingSkill
- helm-chart-developmentSkill
- helm-chart-maintenanceSkill
- helm-chart-reviewSkill
- helm-chart-testingSkill
- k8s-continual-improvementSkill
- k8s-dns-troubleshootingSkill
- k8s-namespace-troubleshootingSkill
- k8s-network-troubleshootingSkill
- k8s-platform-operationsSkill
- k8s-platform-tenancySkill
- k8s-security-hardeningSkill
- k8s-security-redteamSkill
- kyverno-troubleshootingSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 285
Versioned: - All changes tracked in Git history
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Flux CD GitOps Patterns
Implement GitOps best practices with Flux CD, including repository structure, dependency management, and deployment patterns.
Keywords
flux, fluxcd, gitops, patterns, architecture, repository, structure, kustomization, helmrelease, dependencies, multi-tenant, multi-cluster, secrets, sops, designing, creating, deployment, deployments, notification, alerts, alerting, reconciliation, interval
When to Use This Skill
- Designing GitOps repository structure
- Setting up dependency chains between resources
- Implementing multi-environment deployments
- Configuring secrets management with Flux
- Setting up notifications and alerts
- Optimizing reconciliation intervals
Related Skills
- flux-troubleshooting - Diagnosing issues
- flux-operations - Day-to-day operations
- k8s-platform-tenancy - Multi-tenant patterns
Quick Reference
| Task | Pattern/Command |
| Monorepo layout | clusters/, infrastructure/, apps/ directories |
| Multi-repo layout | Separate repos per team/concern |
| Component layout | namespace.yaml, repository.yaml, release.yaml |
| Force sync | flux reconcile ks flux-system --with-source |
| Variable substitution | spec.postBuild.substitute / substituteFrom |
| Encrypt secrets | SOPS with spec.decryption.provider: sops |
| Set up alerts | Alert + Provider in notification.toolkit.fluxcd.io |
Repository Patterns
Monorepo (Recommended for Small Teams)
homelab/
├── clusters/
│ ├── production/
│ │ ├── flux-system/
│ │ ├── infrastructure.yaml
│ │ └── apps.yaml
│ └── staging/
│ ├── flux-system/
│ └── ...
├── infrastructure/
│ ├── kustomization.yaml
│ ├── cert-manager/
│ ├── external-dns/
│ └── external-secrets/
├── apps/
│ ├── kustomization.yaml
│ ├── grafana/
│ └── loki/
└── helm/
└── local-charts/Multi-Repo (Enterprise)
fleet-infra/ # Flux bootstrap, cluster configs
├── clusters/
│ ├── production/
│ └── staging/
platform-components/ # Shared infrastructure
├── cert-manager/
├── ingress-nginx/
└── monitoring/
team-alpha-apps/ # Team-specific apps
├── app1/
└── app2/Component Structure
component-name/
├── namespace.yaml # Namespace isolation
├── repository.yaml # HelmRepository source
├── release.yaml # HelmRelease deployment
└── kustomization.yaml # Resource orchestrationDependency Management
Kustomization Dependencies
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: apps
namespace: flux-system
spec:
dependsOn:
- name: infrastructure
- name: configs
interval: 10m
path: ./apps
prune: true
wait: true
sourceRef:
kind: GitRepository
name: flux-systemDeployment Order
Flux System (bootstrapped)
└─> Infrastructure (CRDs, operators)
├─> Configs (ConfigMaps, Secrets)
└─> Monitoring (Prometheus, Grafana)
└─> Apps (depends on all above)Source Configuration
GitRepository
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: flux-system
namespace: flux-system
spec:
interval: 10m
url: https://github.com/org/repo
ref:
branch: main
secretRef:
name: flux-system
ignore: |
/*
!/clusters/
!/infrastructure/
!/apps/OCI Repository
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: OCIRepository
metadata:
name: podinfo
namespace: flux-system
spec:
interval: 10m
url: oci://ghcr.io/stefanprodan/manifests/podinfo
ref:
tag: latest
provider: generic # or aws, azure, gcpHelmRepository
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: bitnami
namespace: flux-system
spec:
interval: 30m
url: https://charts.bitnami.com/bitnamiVariable Substitution
Environment Variables
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
spec:
postBuild:
substitute:
CLUSTER_NAME: production
DOMAIN: example.com
ENVIRONMENT: prod
substituteFrom:
- kind: ConfigMap
name: cluster-vars
- kind: Secret
name: cluster-secretsUsage in Manifests
apiVersion: networking.k8s.io/v1
kind: Ingress
spec:
rules:
- host: app.${DOMAIN} # SubstitutedSecrets Management
SOPS Integration
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
spec:
decryption:
provider: sops
secretRef:
name: sops-age # Contains age private keyExternal Secrets Pattern
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: app-secrets
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: vault
target:
name: app-secrets
creationPolicy: Owner
data:
- secretKey: db-password
remoteRef:
key: secret/data/app
property: passwordNotification Patterns
Provider Configuration
apiVersion: notification.toolkit.fluxcd.io/v1beta3
kind: Provider
metadata:
name: discord
namespace: flux-system
spec:
type: discord
secretRef:
name: discord-webhookAlert Configuration
apiVersion: notification.toolkit.fluxcd.io/v1beta3
kind: Alert
metadata:
name: on-call-alerts
namespace: flux-system
spec:
providerRef:
name: discord
eventSeverity: error
eventSources:
- kind: GitRepository
name: '*'
- kind: Kustomization
name: '*'
- kind: HelmRelease
name: '*'
namespace: '*'Interval Guidelines
| Resource Type | Recommended Interval | Rationale |
| GitRepository | 10m | Balance freshness vs API calls |
| HelmRepository | 30m | Charts update less frequently |
| Kustomization | 10m | Sync with Git interval |
| HelmRelease | 15m | Allow chart fetch first |
| OCIRepository | 10m | Similar to Git |
GitOps Principles
- Declarative - Desired state in Git, not imperative commands
- Versioned - All changes tracked in Git history
- Automated - Flux applies changes automatically
- Auditable - Git log provides complete audit trail
- Self-healing - Drift automatically corrected
Anti-Patterns to Avoid
| Anti-Pattern | Problem | Solution |
| Direct kubectl apply | Bypasses GitOps | Always commit to Git |
| Forgotten suspensions | Resources don't update | Document, set reminders |
| Missing dependsOn | Race conditions | Define explicit dependencies |
| Secrets in Git (plaintext) | Security breach | Use SOPS or External Secrets |
| Very short intervals | API throttling | Use 10m+ for most resources |
| Wildcard sources | Security risk | Explicit resource names |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

