Kustomize

Kustomize is a Kubernetes native configuration management tool.

Why Kustomize?

Help vs. Kustomize

Helm templates consist of:

  • Templated YAML files (the template)

  • A values file (template variables)

Kustomized files consist of:

  • Base YAML files (the base)

  • A modifications file (the overlay)

On the surface, these two approaches seem similar. However, they’re fundamentally different.

Style Guide

Kustomizations should be treated as code and code should be clean.

  1. Use kustomize cfg fmt to format your yaml configuration. It will ensure consistent field ordering and indentation.

  2. Always use generators to emit ConfigMap (with configMapGenerator) and Secret (with secretGenerator) resources. Generators add a content hash to the resource name which ensures that rolling updates are triggered when the content changes.

  3. Use a consistent naming scheme for resources. We recommend the following format: <metadata.name>.<lowercase(kind)>.yaml. Use the most significant part of a resource apiVersion instead of <kind> in the case where a single file stores multiple resources. E.g. use rbac for the RBAC example above.

Project Layout

Reference

Last updated