LAB14b: Kustomize (Overlay / Patching Approach)

LAB 500b: Use Kustomize to deploy helloworld

Directory Structure

helloworld-app/
 ├── base/
 │   ├── configmap.yaml
 │   ├── deployment.yaml
 │   ├── service.yaml
 │   ├── ingress.yaml
 │   └── kustomization.yaml
 ├── dev/
 │   ├── index.html
 │   ├── kustomization.yaml
 │   └── patch-ingress.yaml
 └── prod/
     ├── index.html
     ├── kustomization.yaml
     └── patch-ingress.yaml

✔ Dev & Prod each maintain their own index.html ✔ Overlays override ConfigMap content ✔ Avoids repeating YAML (DRY principle)

BASE (Shared across dev + prod)

This folder contains all common manifests. Environments override only what they need.

base/configmap.yaml

The content will be replaced in overlays.

base/deployment.yaml

base/service.yaml

base/ingress.yaml

base/kustomization.yaml

DEV Overlay

dev/index.html

dev/kustomization.yaml

✔ Injects dev HTML ✔ Adds namespace, suffix, labels ✔ Replaces ConfigMap ✔ No TLS patch

dev/patch-ingress.yaml

Only overrides host.

PROD Overlay

prod/index.html

prod/kustomization.yaml

✔ Injects prod HTML ✔ Replaces ConfigMap content ✔ Enables TLS via ingress patch

prod/patch-ingress.yaml

Adds:

  • TLS section

  • Prod domain

How to Deploy (Kustomize)

DEV Deployment

Preview generated YAML:

Apply:

Verify:


PROD Deployment

Preview:

Apply:

Verify:


Clean Up

DEV:

PROD:

Last updated