The Complete Guide to infra-deployments Structure
Kustomize overlays are a powerful pattern for managing Kubernetes manifests across multiple environments (dev, staging, production) without duplicating YAML files. You define a base with common configuration, then create overlays that patch/modify the base for each specific environment.
In Konflux: Every component uses this pattern. The base defines what the service IS. The overlays define HOW it runs in each environment (different replicas, resources, images, configs).
Here's the actual structure used for EVERY component in infra-deployments:
kustomization.yaml
deployment.yaml
service.yaml
rbac.yaml
kustomization.yaml
Patches base for dev
kustomization.yaml
Patches base for staging
kustomization.yaml
Patches base for production
The base/ directory contains actual YAML manifests.
The overlay directories contain only kustomization.yaml files that reference
the base and apply patches. This is the DRY (Don't Repeat Yourself) principle in action!
Why: Dev uses latest, staging uses tested, prod uses stable.
Why: Production needs more replicas for HA.
Why: Prod has stricter resource limits for stability.
Why: Different logging verbosity per environment.
Why: Some resources only make sense in certain environments.
Why: Each environment deploys to different namespace.
Why wrong: Defeats the purpose of overlays. Use patches instead!
Why wrong: Base should be environment-agnostic. Put env-specific config in overlays!
Why wrong: Use bases: [../base] to reference the entire base directory!
Why wrong: If patches are huge, maybe that config belongs in base with strategic merge!
bases: [../base]
- Set image tag
- Add environment-specific patches
4. Create ArgoCD Application pointing to overlays
5. Test: kubectl kustomize components/my-new-service/development
It's tempting to create deeply nested overlay structures or complex patch systems. Keep it simple! The current infra-deployments pattern (base + 3 overlays) works well for 95% of cases. Only add complexity when you have a clear, repeated need.