Sample configuration repository for Fluxcd thats install the following:
- ingress-nginx
- cert-manager
- demo application
This Git repository contains the following top directories:
- apps dir contains workloads for cluster users
- charts dir contains local Helm charts
- clusters dir contains the Flux configuration per cluster
- infra dir contains common infra tools, Helm repository definitions and cluster default settings
./
├── clusters
│ ├── dev
│ ├── prod
└── charts
│ ├── ...
└── infra
│ ├── base
│ ├── config
│ ├── dev
│ └── prod
└── apps
├── base
├── dev
└── prodThe clusters dir contains Kustomizations objects that define the source of Kubernetes manifests:
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
kind: Kustomization
metadata:
name: defaults
namespace: flux-system
spec:
interval: 5m
sourceRef:
kind: GitRepository
name: flux-system
path: ./infra/defaults
prune: true
validation: clientThe infra configuration is structured into:
infra/basedir contains Helm release definitionsinfra/configdir contains RBAC config and other infra configinfra/devdir contains the development Helm release valuesinfra/prddir contains the production Helm release values
./infra/
├── base
│ ├── ingress-nginx
│ │ ├── kustomization.yaml
│ │ ├── namespace.yaml
│ │ └── release.yaml
│ └── ...
├── defaults
│ ├── kustomization.yaml
│ ├── rbac.yaml
│ └── sources.yaml
├── dev
│ ├── ingress-nginx
│ │ ├── kustomization.yaml
│ │ └── values.yaml
│ └── ...
└── prd
├── ingress-nginx
│ ├── kustomization.yaml
│ └── values.yaml
└── ...The infra/base/ dir contains HelmReleases as base for all clusters:
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: ingress-nginx
spec:
chart:
spec:
chart: ingress-nginx
version: 4.0.17
sourceRef:
kind: HelmRepository
name: ingress-nginx
namespace: flux-system
values:
# add values hereThe infra/defaults/ dir contains namespaces, RBAC and Helm repository definitions:
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository
metadata:
name: ingress-nginx
namespace: flux-system
spec:
interval: 10m0s
url: https://kubernetes.github.io/ingress-nginxThe infra/defaults/dev & infra/defaults/prd dir containts Kustomize patches with the environments specific values:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base/ingress-nginx
patchesStrategicMerge:
- values.yamlThe apps dir contains user workloads with a similuar structure like we have with the infra dir:
./apps/
├── base
│ ├── demo
│ │ ├── kustomization.yaml
│ │ ├── namespace.yaml
│ │ └── release.yaml
│ └── ...
├── dev
│ ├── demo
│ │ ├── kustomization.yaml
│ │ └── values.yaml
│ └── ...
└── prd
├── demo
│ ├── kustomization.yaml
│ └── values.yaml
└── ...