kustomization.yaml & resources
The file that ties it together.
Every Kustomize directory has a kustomization.yaml — the control file that declares which resources to include and how to transform them. At minimum it lists resources (the manifest files or directories to pull in). Beyond that it can add common labels and annotations, set a namespace or name prefix/suffix, generate ConfigMaps and Secrets, apply patches, and pull in other kustomizations. It is the single entry point Kustomize reads.
apiVersion: kustomize.config.k8s.io/v1beta1kind: Kustomizationresources:- deployment.yaml- service.yamlnamespace: paymentsnamePrefix: prod-commonLabels:app.kubernetes.io/part-of: paymentsenvironment: prod
Declarative cross-cutting edits
Notice what the file above does without touching the manifests: it puts every resource in the payments namespace, prefixes every name with prod-, and stamps common labels on all of them. These are transformers (covered in depth later) applied declaratively across the whole set. This is the core idea — you describe the transformation in kustomization.yaml, and Kustomize rewrites the plain manifests accordingly at build time.
$ kustomize build .# deployment + service, now namespaced payments, named prod-*, with the common labelsapiVersion: apps/v1kind: Deploymentmetadata:name: prod-payments-apinamespace: paymentslabels: { environment: prod, app.kubernetes.io/part-of: payments }