Skip to content
Hands-on IT IT Drills

Day 11: Helm and Kustomize

Goal: You install, upgrade and roll back cluster components with Helm and adapt manifests per environment with Kustomize. · Duration: approx. 60 min · Prerequisite: Day 8

Briefing

CKA: “Use Helm and Kustomize to install cluster components” (part of the 25 %).

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

You installed Helm on Day 8; Kustomize is built into kubectl.

mkdir -p ~/cka/tag11 && cd ~/cka/tag11
k create ns tag11
k config set-context --current --namespace=tag11

Drill 1: Find a repository and chart

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

Expected:

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 --version 6.16.0 | grep -A2 -E '^replicaCount|^ui:'

Expected:

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

Save your progress? Sign up for free

Drill 2: Install with –set

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

Expected (shortened):

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

The release web lives in the current namespace; Helm commands use -n for this.

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 -f values-prod.yaml
helm history web
helm get values web

Expected (shortened):

REVISION    UPDATED                     STATUS      CHART           ... DESCRIPTION
1           Tue Nov 17 22:19:17 2026    superseded  podinfo-6.16.0  ... Install complete
2           Tue Nov 17 22:19:42 2026    deployed    podinfo-6.17.0  ... Upgrade complete
USER-SUPPLIED VALUES:
replicaCount: 3
resources:
  requests:
    cpu: 50m
    memory: 32Mi
ui:
  message: Produktion

Warning: A helm upgrade without --reuse-values forgets all earlier --set values. Anything not in this call falls back to the chart default.

Save your progress? Sign up for free

Drill 4: Rollback

helm rollback web 1
helm history web
k get deployment web-podinfo \
  -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

As with kubectl rollout undo, a new revision is created. Now change only the replicas and keep everything else:

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

Expected:

USER-SUPPLIED VALUES:
replicaCount: 1
ui:
  message: Hallo CKA

Save your progress? Sign up for free

Drill 5: Render instead of install

helm template generates the manifests locally – without a release in the cluster:

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

Expected:

kind: Service
kind: Deployment
  replicas: 5
kind: Pod
kind: Pod
kind: Pod
Chart.yaml
LICENSE
README.md
templates
values-prod.yaml
values.yaml

The three Pods are the chart’s test hooks. helm pull --untar downloads the chart so you can read it.

Save your progress? Sign up for free

Drill 6: Kustomize – base and overlays

mkdir -p shop/base shop/overlays/dev shop/overlays/prod
k create deployment shop --image=nginx:1.28 $do > shop/base/deployment.yaml
k create service clusterip shop --tcp=80:80 $do > shop/base/service.yaml
cat > shop/base/kustomization.yaml <<'EOF'
resources:
- deployment.yaml
- service.yaml
labels:
- pairs:
    team: shop
  includeSelectors: false
EOF
cat > shop/overlays/dev/kustomization.yaml <<'EOF'
resources:
- ../../base
namespace: shop-dev
namePrefix: dev-
configMapGenerator:
- name: settings
  literals:
  - MODE=dev
EOF
k kustomize shop/overlays/dev | grep -E '^kind|name: |MODE'

Expected:

  MODE: dev
kind: ConfigMap
  name: dev-settings-bk2hmt6gd5
kind: Service
  name: dev-shop
  - name: 80-80
kind: Deployment
  name: dev-shop
        name: nginx

The generator appends a hash to the ConfigMap name. If the content changes, the name changes – and Pods that use it are restarted.

Save your progress? Sign up for free

Drill 7: Overlay for production

cat > shop/overlays/prod/kustomization.yaml <<'EOF'
resources:
- ../../base
namespace: shop-prod
namePrefix: prod-
replicas:
- name: shop
  count: 3
images:
- name: nginx
  newTag: "1.29"
patches:
- target:
    kind: Deployment
    name: shop
  patch: |-
    - op: add
      path: /spec/template/spec/containers/0/resources
      value:
        limits:
          memory: 128Mi
EOF
k kustomize shop/overlays/prod | grep -E 'replicas|image:|memory'
k create ns shop-dev
k create ns shop-prod
k apply -k shop/overlays/dev
k apply -k shop/overlays/prod
k get deploy -A -l team=shop

Expected (shortened):

  replicas: 3
      - image: nginx:1.29
            memory: 128Mi
...
NAMESPACE   NAME        READY   UP-TO-DATE   AVAILABLE   AGE
shop-dev    dev-shop    1/1     1            1           10s
shop-prod   prod-shop   3/3     3            3           9s

replicas, images and patches refer to the names before the namePrefix.

Save your progress? Sign up for free

Exercise: Speed Drills

  1. Show all Helm releases in the whole cluster. Target time: 10 s
  2. Show the manifests that the release web installed, only the lines with kind:. Target time: 20 s
  3. Delete the release web. Target time: 10 s

Solution

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

Expected (excerpt):

NAME            NAMESPACE   REVISION    ... CHART                   APP VERSION
csi-driver-nfs  kube-system 1           ... csi-driver-nfs-4.13.6   4.13.6
traefik         traefik     1           ... traefik-42.4.1          v3.7.19
web             tag11       4           ... podinfo-6.16.0          6.16.0
kind: Service
kind: Deployment
release "web" uninstalled

Save your progress? Sign up for free

Checkpoint

helm list -n tag11

Expected: only the header line – no release left.

k get deploy prod-shop -n shop-prod \
  -o jsonpath='{.spec.template.spec.containers[0].image}{"\n"}'

Expected: nginx:1.29

k get cm -n shop-dev -o name

Expected: configmap/dev-settings-bk2hmt6gd5 (the hash may differ) and configmap/kube-root-ca.crt.

Challenge

In the dev overlay, change MODE to debug and apply it. What happens to the old ConfigMap?

Hint: Compare the ConfigMap names before and after.

Solution

sed -i 's/MODE=dev/MODE=debug/' shop/overlays/dev/kustomization.yaml
k apply -k shop/overlays/dev
k get cm -n shop-dev

Expected:

configmap/dev-settings-6km8h95bh5 created
service/dev-shop unchanged
deployment.apps/dev-shop unchanged
NAME                      DATA   AGE
dev-settings-6km8h95bh5   1      1s
dev-settings-bk2hmt6gd5   1      65s
kube-root-ca.crt          1      66s

The new ConfigMap is created next to the old one; apply -k does not clean up. The Deployment stays unchanged because it doesn’t mount the ConfigMap in this example – otherwise the new name would trigger a rollout. You can clean up with k apply -k … --prune and labels, or by hand.

Clean up:

k config set-context --current --namespace=default
k delete ns tag11 shop-dev shop-prod

Save your progress? Sign up for free

Exam Tip

  • helm upgrade --install creates or upgrades – handy when you don’t know whether the release already exists.
  • With Helm, always pass -n when the task names a namespace; --create-namespace creates it.
  • Make Kustomize errors visible with k kustomize <ordner> first, and only then apply.

Enterprise Note

  • Helm values and Kustomize overlays belong in Git; they are rolled out via Argo CD or Flux.
  • Always pin chart versions (--version); Renovate keeps them up to date.
  • Check charts from third-party sources with helm template before installing them.