Build a Kustomize overlay structure for three environments (dev, staging, prod) that patches replica counts, resource limits, and image tags without duplicating base manifests

domain: Kustomize · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Create a base/ directory with a kustomization.yaml that lists all shared Kubernetes manifests (Deployment, Service, ConfigMap) and sets commonLabels; do not include environment-specific values in the base
  2. Create overlays/dev/, overlays/staging/, and overlays/prod/ directories each with a kustomization.yaml that sets resources: [../../base] and adds environment-specific patches
  3. In each overlay, use a strategic merge patch YAML file to override the Deployment's spec.replicas and spec.template.spec.containers[0].resources.limits fields; use a separate patch per concern rather than one large patch file
  4. Use images: in each overlay's kustomization.yaml to override the container image tag without modifying the Deployment manifest: newName: registry/app newTag: git-$COMMIT_SHA evaluated at kustomize build time via kustomize edit set image
  5. Add a configMapGenerator in the prod overlay with a literals block containing environment-specific config values; use generatorOptions: disableNameSuffixHash: true only for configs that are referenced by name from other resources outside the Kustomize boundary
  6. Run kustomize build overlays/prod | kubeval and kustomize build overlays/prod | kubectl diff -f - in CI to validate and diff the rendered output against the live cluster before applying

Known gotchas

Related routes

Build a Kustomize component that adds a common sidecar container and shared volume across multiple overlays without duplicating the patch in each overlay
kubernetes.io · 5 steps · unrated
Order Flux Kustomization dependencies with dependsOn to sequence multi-tier deployments
fluxcd.io/flux/components/kustomize · 6 steps · unrated
Use Kustomize components to inject a shared sidecar and ConfigMap across multiple overlays without duplicating patch files
kubectl.docs.kubernetes.io · 6 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans