Command Palette

Search for a command to run...

Hectal
← All projects

Project 6 of 12 · project brief

Package Everything as Helm Charts

Turn the Kubernetes manifests into a reusable, tested, versioned Helm chart with per-environment values.

Intermediate 2 days 4 milestones

The scenario

Copy-pasting YAML for dev, staging, and prod is already causing drift: prod has a probe that dev doesn't. Your brief: package the services as Helm charts with sensible defaults and environment values files, test them, and publish them to a chart repository.

Before you start

Stack

Helm 3helm-unittestchart-testing (ct)kubeconformOCI registry (GHCR/ECR)

Target architecture

Project 6 architecturediagram
Rendering diagram…

Deliverables and requirements

You will hand in

  • A generic shoplite-service chart used by api, worker, and frontend (DRY)
  • An umbrella chart with dependencies and per-environment values files
  • Unit tests (helm-unittest) and CI that lints, validates, and installs the chart
  • Charts published to an OCI registry with semantic versions

Functional

  • helm install shoplite charts/shoplite -f values-dev.yaml deploys the whole app
  • Prod values change replicas, resources, and hostnames only, without template changes
  • helm rollback restores the previous release

Non-functional

  • Templates use helpers for names/labels (app.kubernetes.io/*)
  • values.schema.json validates inputs
  • Chart version bumped on every change

Milestones

  1. 1

    A generic service chart

    Done when: One chart that renders Deployment, Service, HPA, PDB, and ServiceAccount from values.

    • helm create and prune; standard labels in _helpers.tpl
    • Values for image, env, probes, resources, autoscaling, PDB
    • values.schema.json requiring image.repository and image.tag

    Prove it works

    terminal
    $ helm template api charts/shoplite-service -f examples/api.yaml | kubeconform -strict -summary
    ── expected output ──
    Summary: 5 resources found in 1 file - Valid: 5, Invalid: 0, Errors: 0, Skipped: 0
  2. 2

    Umbrella chart and environments

    Done when: The whole app as one release, with dev/prod values.

    • charts/shoplite/Chart.yaml dependencies: 3 × shoplite-service (aliases api, worker, frontend) + postgresql/redis subcharts (dev only via condition)
    • values-dev.yaml and values-prod.yaml (prod uses managed databases: subcharts disabled, external hosts set)
    • helm dependency update

    Prove it works

    terminal
    $ helm upgrade --install shoplite charts/shoplite -n shoplite -f charts/shoplite/values-dev.yaml --wait && helm list -n shoplite
    ── expected output ──
    NAME NAMESPACE REVISION STATUS CHART APP VERSION
    shoplite shoplite 1 deployed shoplite-0.4.0 1.4.0
  3. 3

    Tests and CI

    Done when: Chart changes are validated automatically.

    • helm-unittest: assert replicas, probes present, PDB rendered when enabled
    • GitHub Actions: helm lint, helm unittest, kubeconform, ct install on kind
    • helm test hook that curls the API health endpoint

    Prove it works

    terminal
    $ helm unittest charts/shoplite-service
    ── expected output ──
    Charts: 1 passed, 1 total
    Test Suites: 3 passed, 3 total
    Tests: 11 passed, 11 total
  4. 4

    Publish and roll back

    Done when: Versioned charts in an OCI registry; practised rollback.

    • helm package and helm push oci://ghcr.io/<you>/charts
    • Upgrade with a bad value (wrong image tag), then helm rollback shoplite 1
    • Record helm history

    Prove it works

    terminal
    $ helm history shoplite -n shoplite
    ── expected output ──
    REVISION STATUS CHART DESCRIPTION
    1 superseded shoplite-0.4.0 Install complete
    2 superseded shoplite-0.4.1 Upgrade complete
    3 deployed shoplite-0.4.0 Rollback to 1

Would you run this in production?

  • ☐Schema-validated values
  • ☐No secrets in values files (use External Secrets or sealed secrets)
  • ☐Chart and app versions tracked separately
  • ☐CI validates rendering and installation
  • ☐Pinned subchart versions

Stretch goals

  • Deploy the chart with Argo CD instead of helm install (Project 9)
  • Sign charts with Cosign
  • Compare with a Kustomize version of the same app

Show it off

Résumé bullet

Packaged a multi-service application into reusable Helm charts with schema validation, unit tests, CI install tests on kind, and OCI publishing; eliminated config drift across dev and prod.

Demo script

  • Diff dev vs prod rendering (helm template twice + diff)
  • Break a value and show schema validation failing
  • Roll back a bad release

Interview questions about this project

01

How do you structure Helm charts for many microservices?

02

What's the difference between chart version and appVersion?