Components & reuse
Optional, composable feature sets.
A component is a reusable, optional slice of configuration you can mix into multiple overlays — the answer to “these three environments all need the monitoring sidecar, but not the others.” Unlike a base (which an overlay fully inherits), a component is composable: it contributes resources and patches that get applied wherever you list it, so you assemble an environment from a base plus the components it opts into.
apiVersion: kustomize.config.k8s.io/v1alpha1kind: Component # note: Component, not Kustomizationresources:- servicemonitor.yamlpatches:- path: add-metrics-port.yaml # patch the base Deployment to expose metrics---# an overlay opts in:# components:# - ../../components/monitoring
Composition over duplication
Components let you express features independently and combine them per environment: a prod overlay might include the monitoring, network-policy, and hardening components while dev includes only monitoring. Because each component is a self-contained unit of resources-plus-patches, you avoid copy-pasting the same additions into every overlay. It is the Kustomize equivalent of feature toggles, done through composition rather than conditionals.