Ravindra BagaleCourses & study guides मराठी

Chapter 96: Flux GitOps — Sources, Reconciliation and Safe Local Practice

DevOps

96.5 Flux Kustomization is not kustomization.yaml

Fictional teaching story. At a fictional Sangli shop, Isha and Omar find two documents with almost the same word on the cover but very different readers.

Why

Confusing these two objects leads to wrong API versions and misplaced fields.

What

Give the Flux object and the local build file their separate jobs.

How

Flux Kustomization is not kustomization.yaml
Original classroom diagram: Flux Kustomization is not kustomization.yaml

The Flux Kustomization custom resource

A Flux Kustomization tells kustomize-controller which source directory to reconcile and how. sourceRef names the source object. path points inside its artifact. prune controls garbage collection of previously managed resources that disappear from desired state.

Immediate practice example

  1. Read the example from top to bottom. Do not send it to a real cluster.
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: classroom-app
  namespace: flux-system
spec:
  interval: 2m
  sourceRef:
    kind: GitRepository
    name: classroom
  path: ./clusters/lab
  prune: false
  1. Read the expected result.

Illustrative output: not executed by Flux, kubectl, Helm or Kubernetes.

The intended consumer reads clusters/lab from the classroom source and does not request pruning.
  1. Understand each line in plain English.

The first two lines identify the Flux custom type. Metadata identifies this consumer, not the application ConfigMap. interval is its own schedule, distinct from the source interval. The two sourceRef fields point to the named GitRepository in the default same namespace. path is relative to the artifact. prune: false is a cautious teaching choice, not a universal protection from deletion by every actor or policy.

The local Kustomize configuration file

A Kustomize configuration is a local composition file normally named kustomization.yaml. Its resources list points to input manifests. It is not the Flux custom resource above.

Immediate practice example

  1. Read the example from top to bottom. Do not send it to a real cluster.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - configmap.yaml
  1. Read the expected result.

Illustrative output: not executed by Flux, kubectl, Helm or Kubernetes.

A local composition includes configmap.yaml; no cluster object was created.
  1. Understand each line in plain English.

This API identifies the Kustomize file format. The identical kind word does not make it the Flux CRD. resources lists local input files; it does not belong under the Flux scheduling spec. A real renderer must find and parse each referenced file. The chapter lab checks a narrow file shape, not full Kustomize compatibility.

Ravindra Bagale's Tip

Read apiVersion before deciding what Kustomization means.

Did you understand? Let us try it once more.