Skip to content
Hands-on IT IT Drills

Day 13: Helm and Kustomize

Goal: You install ready-made packages with Helm, roll them forward and back, and build a Kustomize base with overlays for dev and prod for notes-api. · Duration: approx. 75 min · Prerequisite: Day 6

Briefing

CKAD: Application Deployment (20 %) – “Use the Helm package manager to deploy existing packages” and “Kustomize”.

Helm Kustomize
Idea templates + values = manifests base + overlays = manifests
State release with history in the cluster none, just k apply -k
Typical installing third-party software your own manifests per environment

Helm v4 is installed on cp1; Kustomize is built into kubectl.

mkdir -p ~/ckad/tag13 && cd ~/ckad/tag13

Drill 1: Find a repository and chart

The package is podinfo, a freely available demo chart:

helm repo add podinfo https://stefanprodan.github.io/podinfo
helm repo update
helm search repo podinfo --versions | head -3

Expected:

"podinfo" has been added to your repositories
...Successfully got an update from the "podinfo" chart repository
NAME            CHART VERSION   APP VERSION DESCRIPTION
podinfo/podinfo 6.17.0          6.17.0      Podinfo Helm chart for Kubernetes
podinfo/podinfo 6.16.0          6.16.0      Podinfo Helm chart for Kubernetes

Which values can be set?

helm show values podinfo/podinfo | grep -A2 -E '^replicaCount|^ui:'

Expected:

replicaCount: 1
logLevel: info
host: #0.0.0.0
--
ui:
  color: "#34577c"
  message: ""

helm show chart shows the metadata, helm show values all defaults – that is the user manual of a chart.

Save your progress? Sign up for free

Drill 2: Install with –set

helm install web podinfo/podinfo --version 6.16.0 -n tag13 --create-namespace \
  --set replicaCount=2 --set ui.message="Hallo CKAD"
helm list -n tag13
k get deploy,svc -n tag13

Expected (shortened):

NAMESPACE: tag13
STATUS: deployed
REVISION: 1
NAME    NAMESPACE   REVISION    ... STATUS      CHART           APP VERSION
web     tag13       1           ... deployed    podinfo-6.16.0  6.16.0
NAME                          READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/web-podinfo   0/2     2            0           1s
NAME                  TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)
service/web-podinfo   ClusterIP   10.102.236.229   <none>        9898/TCP,9999/TCP

Check whether the value arrived:

k rollout status deploy/web-podinfo -n tag13
k exec -n tag13 deploy/web-podinfo -- wget -qO- web-podinfo:9898 \
  | grep -E 'version|message'

Expected:

deployment "web-podinfo" successfully rolled out
  "version": "6.16.0",
  "message": "Hallo CKAD",

helm status web -n tag13 shows the same header as the installation, including the chart’s NOTES.

Save your progress? Sign up for free

Drill 3: Upgrade with a values file

cat > values-prod.yaml <<'EOF'
replicaCount: 3
ui:
  message: "Produktion"
resources:
  requests:
    cpu: 50m
    memory: 32Mi
EOF
helm upgrade web podinfo/podinfo --version 6.17.0 -n tag13 -f values-prod.yaml
helm history web -n tag13
helm get values web -n tag13

Expected (shortened):

Release "web" has been upgraded. Happy Helming!
REVISION    UPDATED                     STATUS      CHART           ... DESCRIPTION
1           Wed Nov 18 15:25:54 2026    superseded  podinfo-6.16.0  ... Install complete
2           Wed Nov 18 15:26:16 2026    deployed    podinfo-6.17.0  ... Upgrade complete
USER-SUPPLIED VALUES:
replicaCount: 3
resources:
  requests:
    cpu: 50m
    memory: 32Mi
ui:
  message: Produktion

helm get values shows only your values; with --all all chart defaults are added.

Warning: helm upgrade without --reuse-values forgets earlier --set values. Whatever is not in the current call falls back to the chart default.

Save your progress? Sign up for free

Drill 4: Rollback and a targeted change

helm rollback web 1 -n tag13
helm history web -n tag13
k get deploy web-podinfo -n tag13 \
  -o jsonpath='{.spec.replicas} {.spec.template.spec.containers[0].image}{"\n"}'

Expected (shortened):

Rollback was a success! Happy Helming!
REVISION    ... STATUS      CHART           APP VERSION DESCRIPTION
1           ... superseded  podinfo-6.16.0  6.16.0      Install complete
2           ... superseded  podinfo-6.17.0  6.17.0      Upgrade complete
3           ... deployed    podinfo-6.16.0  6.16.0      Rollback to 1
2 ghcr.io/stefanprodan/podinfo:6.16.0

A rollback creates a new revision. Change only the replicas, keep everything else:

helm upgrade web podinfo/podinfo --version 6.16.0 -n tag13 \
  --reuse-values --set replicaCount=1
helm get values web -n tag13

Expected:

Release "web" has been upgraded. Happy Helming!
USER-SUPPLIED VALUES:
replicaCount: 1
ui:
  message: Hallo CKAD

Save your progress? Sign up for free

Drill 5: Render instead of install

helm template generates the manifests locally, without a release:

helm template demo podinfo/podinfo --version 6.17.0 --set replicaCount=5 \
  | grep -E '^kind:|replicas:'

Expected:

kind: Service
kind: Deployment
  replicas: 5
kind: Pod
kind: Pod
kind: Pod

The three pods are test hooks of the chart. If you do not know whether a release already exists, use upgrade --install:

helm upgrade --install api podinfo/podinfo --version 6.17.0 -n tag13

Expected (shortened):

Release "api" does not exist. Installing it now.
STATUS: deployed
REVISION: 1

Save your progress? Sign up for free

Drill 6: Kustomize base for notes-api

mkdir -p notes/base notes/overlays/dev notes/overlays/prod
cat > notes/base/deployment.yaml <<'EOF'
apiVersion: apps/v1
kind: Deployment
metadata:
  name: notes
spec:
  replicas: 1
  selector:
    matchLabels:
      app: notes
  template:
    metadata:
      labels:
        app: notes
    spec:
      containers:
      - name: notes-api
        image: notes-api
        ports:
        - containerPort: 8080
        envFrom:
        - configMapRef:
            name: notes-config
        - secretRef:
            name: notes-secret
EOF
k create service clusterip notes --tcp=80:8080 $do > notes/base/service.yaml
cat > notes/base/kustomization.yaml <<'EOF'
resources:
- deployment.yaml
- service.yaml
labels:
- pairs:
    app.kubernetes.io/part-of: notes
configMapGenerator:
- name: notes-config
  literals:
  - PORT=8080
secretGenerator:
- name: notes-secret
  literals:
  - NOTES_API_KEY=lab-key-123
images:
- name: notes-api
  newName: 172.16.0.126:30500/notes-api
  newTag: "1.0"
EOF
k kustomize notes/base | grep -E '^kind|^  name:|name: notes-|image:'

Expected:

kind: ConfigMap
  name: notes-config-td2thftdb5
kind: Secret
  name: notes-secret-79mhh8mhd7
kind: Service
  name: notes
kind: Deployment
  name: notes
            name: notes-config-td2thftdb5
            name: notes-secret-79mhh8mhd7
        image: 172.16.0.126:30500/notes-api:1.0

The generators append a hash, and Kustomize puts the new names into the Deployment. The images transformer replaces the placeholder notes-api with the real image. lab-key-123 is purely a lab value.

Save your progress? Sign up for free

Drill 7: Overlays dev and prod

cat > notes/overlays/dev/kustomization.yaml <<'EOF'
resources:
- ../../base
namespace: tag13
namePrefix: dev-
labels:
- pairs:
    env: dev
EOF
cat > notes/overlays/prod/kustomization.yaml <<'EOF'
resources:
- ../../base
namespace: tag13
namePrefix: prod-
labels:
- pairs:
    env: prod
replicas:
- name: notes
  count: 3
secretGenerator:
- name: notes-secret
  behavior: replace
  literals:
  - NOTES_API_KEY=prod-key-456
patches:
- target:
    kind: Deployment
    name: notes
  patch: |-
    - op: add
      path: /spec/template/spec/containers/0/resources
      value:
        requests:
          cpu: 50m
          memory: 32Mi
        limits:
          memory: 64Mi
EOF
k apply -k notes/overlays/dev
k apply -k notes/overlays/prod
k rollout status deploy/prod-notes -n tag13
k get endpointslices -n tag13 -l kubernetes.io/service-name=dev-notes

Expected (shortened):

configmap/dev-notes-config-td2thftdb5 created
secret/dev-notes-secret-79mhh8mhd7 created
service/dev-notes created
deployment.apps/dev-notes created
...
NAME              ADDRESSTYPE   PORTS   ENDPOINTS                                 AGE
dev-notes-kj4gp   IPv4          8080    192.168.189.86,192.168.189.87,... + 1 more...

Four endpoints for one dev pod? labels only sets env in the metadata, not in the selectors. Both Services select app=notes – i.e. all dev and prod pods. A Deployment’s selectors are immutable, so delete and recreate:

k delete -k notes/overlays/dev
k delete -k notes/overlays/prod
sed -i 's/    env: dev/    env: dev\n  includeSelectors: true/' \
  notes/overlays/dev/kustomization.yaml
sed -i 's/    env: prod/    env: prod\n  includeSelectors: true/' \
  notes/overlays/prod/kustomization.yaml
k apply -k notes/overlays/dev
k apply -k notes/overlays/prod
k rollout status deploy/prod-notes -n tag13
k get endpointslices -n tag13

Expected (shortened):

NAME                ADDRESSTYPE   PORTS       ENDPOINTS
api-podinfo-8xmvs   IPv4          9898,9999   192.168.189.127
dev-notes-8hbhg     IPv4          8080        192.168.235.170
prod-notes-2z2mp    IPv4          8080        192.168.189.73,192.168.235.171,...
web-podinfo-jvg58   IPv4          9898,9999   192.168.189.121

Test with the prod key:

k exec -n tag13 deploy/dev-notes -- wget -qO- \
  --header 'X-API-Key: prod-key-456' --post-data '{"text":"hallo"}' \
  http://prod-notes/notes

Expected: {"id":"fb8548cf-…","text":"hallo"}

replicas, images, patches and generators with behavior: replace refer to the names before the namePrefix.

Save your progress? Sign up for free

Drill 8: See in advance what changes

sed -i 's/count: 3/count: 2/' notes/overlays/prod/kustomization.yaml
k diff -k notes/overlays/prod; echo "exit=$?"

Expected (shortened):

--- /tmp/LIVE-974998342/apps.v1.Deployment.tag13.prod-notes
+++ /tmp/MERGED-3466440709/apps.v1.Deployment.tag13.prod-notes
-  generation: 1
+  generation: 2
-  replicas: 3
+  replicas: 2
exit=1

Exit code 1 means “there are differences”, 0 means “nothing to do”. Then apply:

k apply -k notes/overlays/prod

Expected: deployment.apps/prod-notes configured, the rest unchanged.

Save your progress? Sign up for free

Exercise: Speed Drills

  1. Show all Helm releases in the entire cluster. Target time: 10 s
  2. Show only the kind: lines of the manifests that the release web installed. Target time: 20 s
  3. Uninstall the releases web and api. Target time: 15 s

Solution

helm list -A
helm get manifest web -n tag13 | grep '^kind:'
helm uninstall web api -n tag13

Expected (excerpt):

NAME    NAMESPACE   REVISION    ... STATUS      CHART           APP VERSION
api     tag13       1           ... deployed    podinfo-6.17.0  6.17.0
traefik traefik     1           ... deployed    traefik-42.4.1  v3.7.19
web     tag13       4           ... deployed    podinfo-6.16.0  6.16.0
kind: Service
kind: Deployment
release "web" uninstalled
release "api" uninstalled

Save your progress? Sign up for free

Checkpoint

helm list -n tag13

Expected: only the header line – no release left.

k get deploy -n tag13 -l env=prod -o jsonpath='{.items[0].spec.replicas}{"\n"}'

Expected: 2

k get svc dev-notes -n tag13 -o jsonpath='{.spec.selector}{"\n"}'

Expected: {"app":"notes","env":"dev"}

Challenge

Give the dev overlay its own API key dev-key-789. What happens to the Deployment and to the old Secret?

Hint: New content produces a new hash – and with it a changed pod template.

Solution

cat >> notes/overlays/dev/kustomization.yaml <<'EOF'
secretGenerator:
- name: notes-secret
  behavior: replace
  literals:
  - NOTES_API_KEY=dev-key-789
EOF
k apply -k notes/overlays/dev
k rollout status deploy/dev-notes -n tag13
k get secret,rs -n tag13 -l env=dev

Expected (shortened):

configmap/dev-notes-config-td2thftdb5 unchanged
secret/dev-notes-secret-4c74ffgcmk created
service/dev-notes unchanged
deployment.apps/dev-notes configured
deployment "dev-notes" successfully rolled out
NAME                                 TYPE     DATA   AGE
secret/dev-notes-secret-4c74ffgcmk   Opaque   1      4s
secret/dev-notes-secret-79mhh8mhd7   Opaque   1      32s
NAME                                   DESIRED   CURRENT   READY   AGE
replicaset.apps/dev-notes-5b66cb98f6   1         1         1       3s
replicaset.apps/dev-notes-5fc456c5f9   0         0         0       32s

The new Secret name changes the pod template, so the Deployment rolls out again automatically. The old Secret stays behind; apply -k does not clean up.

Clean up:

k delete ns tag13

Save your progress? Sign up for free

Exam Tip

  • With Helm, always specify -n when the task names a namespace; if it does not exist, --create-namespace helps.
  • helm show values is faster than any documentation search for the right key.
  • Make Kustomize errors visible with k kustomize <directory> first, then apply.

Enterprise Note

  • Helm values and overlays belong in Git; rollout happens via Argo CD or Flux.
  • Always pin chart versions (--version); Renovate keeps them up to date.
  • Never put real Secrets into Git as literals – use External Secrets or Sealed Secrets.
  • Read third-party charts with helm template before installing them.