Kubernetes Kustomize
Luke Hebert
- 2 minutes read - 233 wordsKustomize is a native Kubernetes configuration management tool that enables declarative, template-free customization of Kubernetes objects using YAML files. Available as a standalone binary and built into kubectl since version 1.14, it supports hierarchical base-and-overlay structures, targeted patches, and built-in generation of ConfigMaps and Secrets, making it a practical choice for managing environment-specific configurations without introducing templating complexity.
Key Features and Concepts
- Template-free customization: Unlike templating engines, Kustomize works directly with raw, un-templated YAML files, allowing you to modify and patch them without altering the original source.
- Kustomization file: A
kustomization.yamlfile defines the resources and the customizations to be applied (e.g., patches, name prefixes, labels, annotations, or the generation of ConfigMaps and Secrets). - Bases and overlays: Kustomize supports a hierarchical structure where a “base” defines common resources and configurations, and “overlays” apply environment-specific customizations (e.g., for development, staging, or production environments) on top of the base.
- Patches: Patches are partial resource declarations that modify specific fields within a base resource, allowing for targeted changes without redefining the entire resource.
- Built into kubectl: Kustomize functionality is integrated into kubectl, allowing users to build and apply configurations directly using commands like
kubectl kustomize <directory>to view resources orkubectl apply -k <directory>to apply them. - Declarative approach: Kustomize emphasizes a declarative workflow, where all configurations and transformations are defined in files and can be tracked in source control, promoting consistency and reproducibility.