Course contentsShow
← Cloud and Infrastructure
Lesson 1934 of 2,98941. FluxFree lesson

Kustomize Controller

Applying Kustomize overlays and patches to Kubernetes resources with the Kustomization custom resource.

Kustomize Controller

What You'll Learn

You'll learn how the Kustomize Controller applies overlays and patches to your Kubernetes manifests through the Kustomization custom resource, enabling environment-specific configuration without modifying base files.

The Core Concept

The Kustomize Controller watches Kustomization custom resources in your cluster and applies the declarative patches and overlays you've defined to your Kubernetes manifests. Think of it as a specialized worker that reads your base configuration files, applies environment-specific modifications (like changing replicas or image tags), and reconciles the final result into your cluster.

Unlike manually running kubectl apply -k, the Kustomize Controller continuously monitors your Git repository (via the Source Controller) and automatically applies changes whenever it detects updates. It's the "doer" in Flux's GitOps workflow for Kustomize-based applications.

How It Works

The controller operates on Kustomization resources (note: Flux's custom resource, not to be confused with Kustomize's kustomization.yaml file). This resource tells the controller:

  • Where to find your Kustomize overlay (path in the Git repo)
  • How often to reconcile (sync interval)
  • What health checks to perform
  • Whether to prune deleted resources automatically

When the Source Controller fetches new Git commits, the Kustomize Controller picks up the changes, runs the Kustomize build process, and applies the resulting manifests to your cluster. It handles the entire lifecycle: creating resources, updating them when they drift, and optionally removing resources that no longer exist in Git.

Real-World Analogy

Imagine you have a recipe template (base manifests) and different spice preferences for each family member (overlays). The Kustomize Controller is like an automated chef that reads your family's preferences, applies the right spices to each meal, and serves it—then keeps checking if anyone updated their preferences and adjusts accordingly.

Key Takeaway: The Kustomize Controller automates the application of Kustomize patches and overlays through declarative Kustomization resources, enabling continuous reconciliation of your environment-specific Kubernetes configurations.