When to Use Components
Use components when an application offers optional features that only apply to some overlays. If a feature is required in all overlays, include it in your base. For features needed by only a subset, bundle them as components to avoid repetition.Visual Example
Consider three deployment environments:- dev (development)
- premium (for premium customers)
- standalone (self-hosted)
- Caching (backed by Redis) — enabled in premium and standalone
- External DB (Postgres) — enabled in dev and premium

caching and db) and import them selectively.

Component Features Table
Project Structure
- base/: Common resources (e.g., API Deployment)
- components/: Feature directories (
caching/,db/) - overlays/: Environment-specific kustomizations
Database Component
The db component adds a Postgres deployment, a Secret for credentials, and patches your API Deployment.postgres-depl.yaml
Components require
kind: Component with the v1alpha1 API. Ensure you’re running Kustomize v4.x or later.kustomization.yaml (Component)
deployment-patch.yaml
This strategic merge patch injects the DB_PASSWORD from the Secret into your API Deployment:
Overlay Configuration
Each overlay’skustomization.yaml pulls in base plus the desired components.
Example: Dev Overlay
- premium overlay adds both
../../components/dband../../components/caching. - standalone overlay adds only
../../components/caching.