CoursesFluxIntermediate

Dependencies & health

Order and readiness gates.

Advanced12 min · lesson 6 of 12

Ordering across Kustomizations and HelmReleases is expressed with dependsOn: a resource waits until its dependencies are Ready before it reconciles. Combined with wait: true (which makes a Kustomization Ready only when its workloads are healthy), this builds reliable chains — infrastructure (ingress, CRDs, cert-manager) becomes Ready first, then configuration, then apps. Flux will not roll the app layer until the infrastructure it needs is actually up.

DEPENDENCY-ORDERED ROLLOUT
1infrastructure
ingress, CRDs, cert-manager - Ready first
2configuration
namespaces, policies (dependsOn infra)
3apps
reconcile only after config is healthy
Each layer uses dependsOn + wait/healthChecks; downstream waits until upstream is truly Ready.
apps.yaml
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata: { name: apps, namespace: flux-system }
spec:
dependsOn:
- { name: infrastructure } # wait until infrastructure is Ready
interval: 10m
sourceRef: { kind: GitRepository, name: fleet }
path: ./apps
prune: true
wait: true

Health checks and readiness

Beyond wait, a Kustomization can declare explicit healthChecks — named resources it must see healthy before reporting Ready — which is how you gate on a specific Deployment or a custom resource (a Certificate being issued, an operator being up). This makes dependency chains robust: the config layer does not proceed until the specific thing it needs exists and is healthy, not merely applied. Accurate health gating is what prevents the ordering races that plague naive apply-everything approaches.

kustomization healthChecks
spec:
wait: true
healthChecks:
- { kind: Deployment, name: cert-manager, namespace: cert-manager }
- { apiVersion: apiextensions.k8s.io/v1, kind: CustomResourceDefinition, name: certificates.cert-manager.io }
A stuck dependency blocks everything downstream
dependsOn plus wait means a dependency that never becomes Ready (a failing infrastructure Kustomization) will indefinitely hold back everything that depends on it — correct, but it can look like “apps just will not deploy” when the real problem is upstream. When a downstream resource is stuck, check its dependencies’ readiness first; the chain is doing its job, pointing you at the actual failure.