LAB14: Helm & Kustomize

BLOG 500: Helm & Kustomize

how to manage Kubernetes objects across environments using:

Two methods

  1. Templating (Helm-like approach – using variables)

  2. Patching / Overlays (Kustomize)

Scenario

  • App: Static website using Nginx

  • Source: index.html stored in ConfigMap

  • Environments: dev and prod

  • Differences:

    • Domains:

      • dev → dev.hello-world.xyz

      • prod → hello-world.xyz

    • SSL:

      • dev → ❌ no SSL

      • prod → ✅ SSL Ingress (TLS)

  • Namespaces: hello-dev, hello-prod

  • All objects must use labels and have names suffixed with -dev or -prod.

Method 1: Templating Approach

Templates use placeholders, and each environment fills values.

Directory Structure

1. Base Template (common.yaml)

2. Rendered Ingress Template

3. Chart.yaml

4. values.yaml

5. Dev Environment Values (values-dev.yaml)

6. Prod Environment Values (values-prod.yaml)

:::spoiler Let's deploy Here is a complete Helm workflow for your chart — check, template, package/archive, install, upgrade, and uninstall.

Your chart structure:


✅ 1. Check the Helm Chart

Lint

Checks for template syntax errors:


✅ 2. Render the Templates (Dry-run)

Use dev values

Use prod values

With default values

This shows what Kubernetes manifests will be generated.


✅ 3. Archive / Package the Chart

This creates a .tgz archive:

Output example:

You can now upload this to a Helm repo.


✅ 4. Install the Chart

Install using dev values

Install using prod values

Install a packaged chart


✅ 5. Upgrade the Chart

Modify your templates/values and run:

Upgrade dev

Upgrade prod

Upgrade with new version


✅ 6. Uninstall / Remove the Release


✅ 7. Optional Advanced Commands

Show Installed Version

Check Release Values

Check Rendered Manifests of a Running Release

:::

Method 2: Kustomize Overlay Approach

Directory structure:

BASE (common to dev + prod)

namespace.yaml

configmap.yaml

deployment.yaml

service.yaml

ingress.yaml

base/kustomization.yaml

DEV OVERLAY

dev/kustomization.yaml

dev/patch-ingress.yaml

❌ No TLS patch → dev has no SSL.

PROD OVERLAY

prod/kustomization.yaml

prod/patch-ingress.yaml

How to Deploy

Dry-run and apply

Now you can do:

Kustomize will automatically apply the namespace suffix (hello-dev / hello-prod) to all resources.


After this, verify namespaces and resources:

Using kustomize CLI

If you have kustomize installed separately:

This outputs the final manifests that would be applied. You can redirect it to a file if you want: kustomize build dev > dev.yaml


Apply Changes

Using kubectl directly

This will create/update all resources defined in base + overlay patches.


Using kustomize CLI + kubectl

References

-[helm & kustomize]

Last updated