Skip to content
EgyKode
07 · PackagingLab 41 / 59
Guided labhelm

Creating a Custom Helm Chart for Django Microservices

Turn a directory of manifests into a versioned chart you can install into any environment with different values.

Time
47 min
Level
Intermediate
Objectives
4 objectives
Cost
Low cost

Where this fits in the platform

Before you start

CostLow cost

Depends on an existing cluster. Helm itself is free; the workloads it installs consume cluster capacity.

Nothing to pay in the browser. Open the terminal runs this against a simulated cloud — the same API calls and the same commands, with no account and no bill. The figure above applies only if you build it in your own.

How to clean up

The scenario#

There are three directories of manifests — dev, staging and prod — that started identical and are not any more. Nobody can say what differs except by diffing them, and the diff is 400 lines because the namespaces and image tags are on every file.

Hands-on environment

Run this lab in a real terminal, free and in your browser. The environment is temporary and yours alone — break it as much as you like.

Open the terminal

Opens in Killercoda, in a new tab — keep this page open for the steps.

Run it on your own machine

Run this lab on your own machine. One command starts the environment, with everything the lab needs already installed:

Where the values file points at an ECR image, point it at a local image instead and load it with `kind load docker-image`.

You will need:

  • docker
  • kubectl
  • kind
  • helm
git clone https://github.com/EgyKode/EgyKode-lab.git
cd EgyKode-lab
./egykode start k8s
./egykode shell

You need Docker and Git installed. Everything else runs inside the environment. The first start downloads it and takes a few minutes; later starts are seconds.

Not sure what you already have? Run: npm run doctor — it checks and changes nothing.

Run it on AWS

This lab builds real cloud infrastructure, so it needs your own AWS account. Follow the cost and cleanup notes above — the resources are yours, and so is the bill.

Anything you tick here is your own record. EgyKode cannot see inside that terminal, so the success criteria stay self-assessed even when the environment checks your work for you.

Chart.yaml

Step 1 of 5

What you are building#

text
  myapp/
    Chart.yaml            name, version, appVersion
    values.yaml           the defaults, and the documented interface
    values-prod.yaml      only what production differs by
    templates/
      _helpers.tpl        names and labels, defined once
      deployment.yaml
      service.yaml
      ingress.yaml
      configmap.yaml
      hpa.yaml
      NOTES.txt           printed after install

A chart is a package plus a template engine plus a release. The last part is what people underuse: Helm remembers what it installed, so upgrade, rollback and diff are possible. kubectl apply -f has no memory of what it applied.


Build it#

Verify it worked#

Terminal
# Same chart, different environments, no edited templates
helm template rel ./myapp | grep -c "replicas: 2"
helm template rel ./myapp -f myapp/values-prod.yaml | grep -c "replicas: 4"
 
# What the release is ACTUALLY running, not what the file says
helm get values rel -n platform
helm get manifest rel -n platform | head -30
 
# A config change produces a rollout
kubectl get pods -n platform -o name > /tmp/before
helm upgrade rel ./myapp -n platform --set config.LOG_LEVEL=debug --atomic --wait
kubectl get pods -n platform -o name > /tmp/after
diff /tmp/before /tmp/after && echo "NO ROLLOUT — checksum annotation missing" || echo "rolled — correct"
 
helm history rel -n platform

Clean up#

DestructiveThis removes real resources. Check which environment you are in first.

Terminal
helm uninstall rel -n platform
kubectl delete namespace platform

Cost of this lab: Free on kind or minikube.

Maintained by others, on Killercoda. Useful for extra repetition on one tool — it does not complete this lab or settle any criterion above.

Success criteria

0 of 4

The concept behind it

Ready to try it without help?Do the challenge

Next up

Lab 41 of 59 on the project path

Helm Upgrades, Rollbacks & Release StrategyShip a release, break the next one on purpose, and get back to a working state in seconds.Why next: The application as one versioned, installable chart45 minIntermediate

Previous: Kubernetes Security Hardening (NetworkPolicies) & HPA