Skip to content
Latchkey

kustomization.yaml: The Kustomize Config File

kustomization.yaml declares the resources, transformers, and generators that kustomize build assembles into final manifests.

Every Kustomize directory is anchored by a kustomization.yaml. Knowing its top-level fields and exact spelling avoids most build failures.

What it does

kustomization.yaml is a YAML document with apiVersion kustomize.config.k8s.io/v1beta1 and kind Kustomization. It lists inputs (resources, components) and the transformers and generators applied to them. kustomize build reads it and emits combined manifests on stdout.

Common usage

kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: web
namePrefix: prod-

resources:
  - deployment.yaml
  - service.yaml

images:
  - name: myapp
    newTag: 1.4.2

Top-level fields

FieldWhat it does
apiVersion / kindkustomize.config.k8s.io/v1beta1 and Kustomization
resourcesFiles or directories to include
componentsReusable Kustomization Components to apply
namespace / namePrefix / nameSuffixNamespace and name transformers
imagesOverride image names and tags
patchesStrategic-merge or JSON 6902 patches
configMapGenerator / secretGeneratorGenerate ConfigMaps and Secrets

In CI

Always set apiVersion and kind explicitly so newer kustomize versions do not warn or default unexpectedly. Render with kustomize build into an artifact and apply that, so the same bytes that passed review reach the cluster.

Common errors in CI

A newer kustomize rejecting an old key with "json: unknown field \"patchesStrategicMerge\"" means the field was deprecated in favor of patches. "kind: should be Kustomization but got <X>" means a typo. "accumulating resources: missing metadata.name" means a listed resource is not valid YAML.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →