Appendix A: Cheat Sheet
The most important commands and patterns from Day 0 to Day 20,
ordered by topic. The days are in brackets. You replace placeholders in
angle brackets. Values such as lab-key-123 and
lab-zot-123 are lab values. All commands run on
prod; the registry is zot at localhost:30500
(HTTP, hence --plain-http). Inline comments in the code
blocks are kept as in the labs (German); the note below each block
translates them.
Terrain and environment (Day 0)
# on prod
export KUBECONFIG=$HOME/.kube/config
helm version --short
helm env | grep -E 'NAMESPACE|KUBECONTEXT'
helm list --short --kube-context helm-lab -n default- Without
-n, the context’s namespace applies – for Helm too. - In scripts, always set
--kube-contextand-n.
Lifecycle (Day 1, 13)
# on prod
helm repo add zot https://zotregistry.dev/helm-charts && helm repo update
helm search repo zot/zot --versions | head -3
helm show values zot/zot --version 0.1.134 | grep -A3 '^service:'
helm pull zot/zot --version 0.1.134 --untar
helm install <rel> <chart> -n <ns> --create-namespace -f werte.yaml --wait
helm upgrade --install <rel> <chart> -n <ns> -f werte.yaml --wait --timeout 5m \
--rollback-on-failure --history-max 5 --description "Ticket LAB-1"
helm rollback <rel> [<rev>] -n <ns> --wait --description "zurück, Ticket LAB-2"
helm uninstall <rel> -n <ns> [--keep-history]werte.yaml is your values file; zurück
means “back”.
Inspection – the first minute (Day 1, 13, 19)
# on prod
helm list -A # Helm 4: jeder Status
helm list -A --failed --pending # nach aktueller Revision
helm status <rel> -n <ns> # inkl. Ressourcen und Pods
helm history <rel> -n <ns> --show-rollback-revision
helm get values <rel> -n <ns> [--all] [--revision N]
helm get manifest <rel> -n <ns> [--revision N]
helm get hooks <rel> -n <ns>
helm get notes <rel> -n <ns>
helm get metadata <rel> -n <ns> # APPLY_METHOD, Version
kubectl -n <ns> get events --field-selector reason=Failed \
-o custom-columns=MELDUNG:.message | tail -1Comments: Helm 4 lists every status;
--failed/--pending filter by the current
revision; status includes resources and pods.
MELDUNG means “message”.
Read a release Secret (Day 13):
# on prod
kubectl -n <ns> get secret -l owner=helm,name=<rel> \
--sort-by=.metadata.creationTimestamp
kubectl -n <ns> get secret sh.helm.release.v1.<rel>.v<N> -o jsonpath='{.data.release}' \
| base64 -d | base64 -d | gzip -d | jq -c '.config.global, .info.status'Values and precedence (Day 3)
values.yaml < -f a.yaml <
-f b.yaml < --set (rightmost wins).
# on prod
helm install x ./notes --dry-run=client -o json --set a=1 | jq .config
--set-string env.NOTES_PAGE_SIZE=25 # String, Schema verlangt ihn
--set 'hosts={a.lab,b.lab}' # Liste
--set-json 'resources={"limits":{"memory":"64Mi"}}'
--set-file motd=motd.txt
--set key=null # Standard löschenComments: --set-string forces a string because the
schema requires one; braces build a list; key=null deletes
a default.
| Upgrade with | Default values | Your own values |
|---|---|---|
| nothing | new | those of the last deployed revision |
-f/--set |
new | only the ones given |
--reuse-values |
old (computed) | old + new |
--reset-then-reuse-values |
new | old + new |
--reset-values |
new | only the ones given |
Lists are replaced, maps are merged – define environment variables as a map.
Template patterns (Day 4–8)
{{/* rendern: helm template <rel> ./notes -s templates/<datei>.yaml */}}
metadata:
labels:
{{- include "notes.labels" . | nindent 4 }} # nindent, nie indent
spec:
replicas: {{ hasKey .Values "replicaCount" | ternary .Values.replicaCount 2 }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/config.yaml") .
| sha256sum }}
spec:
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- image: {{ printf "%s:%s" .Values.image.repository
(.Values.image.tag | default .Chart.AppVersion) | quote }}
env:
- name: NOTES_API_KEY
valueFrom:
secretKeyRef:
name: {{ required "apiKey.existingSecret fehlt"
.Values.apiKey.existingSecret }}
key: api-keyComments: the first line shows how to render a single file
(rendern = render, <datei> = file);
always nindent, never indent.
fehlt means “is missing”.
{{- range .Values.ingress.hosts }}
- host: {{ tpl . $ | quote }} # $ = Wurzel im range
service: {{ include "notes.fullname" $ }}
{{- end }}
{{- if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1" }} … {{- end }}
uid: {{ dig "metadata" "uid" "leer" (lookup "v1" "Namespace" "" "kube-system") }}
sekunden: {{ durationSeconds .Values.shutdownTimeout }} # neu in Helm 4.3
data:
{{- (.Files.Glob "config/*.conf").AsConfig | nindent 2 }}Comments: $ is the root inside range;
durationSeconds is new in Helm 4.3. leer means
“empty”, sekunden “seconds”.
| Trap | Remedy | Day |
|---|---|---|
default swallows 0/false |
hasKey + ternary, kindIs |
5 |
{{- … -}} glues lines together |
trim on one side only, render | 5 |
. inside range/with |
$ for the root |
5 |
template … \| nindent |
include |
6 |
quote does not rescue 1.20 |
quote it in the values file | 4 |
lookup empty with template, Argo CD |
template must handle the empty case | 7, 18 |
randAlphaNum in a Secret |
lookup + reuse, or existingSecret |
7 |
.Files returns "" |
path, .helmignore, not in templates/ |
8 |
Schema (Day 8, 9)
{"$schema": "http://json-schema.org/draft-07/schema#", "type": "object",
"additionalProperties": false, "required": ["apiKey"],
"properties": {"replicaCount": {"type": ["integer", "null"], "minimum": 0},
"postgres": {"type": "object"}, "global": {"type": "object"}}}Applies to install, upgrade,
lint, template. Allow subchart keys and
global, otherwise you get “additional properties … not
allowed”.
Subcharts and library charts (Day 9, 10)
# Chart.yaml
dependencies:
- name: postgres
version: "~0.1.0"
repository: oci://localhost:30500/charts
condition: postgres.enabled
- name: plattform
version: "~0.1.0"
repository: oci://localhost:30500/charts# on prod
helm dependency update notes --plain-http # löst Bereich auf, schreibt Chart.lock
helm dependency build notes --plain-http # baut genau nach Chart.lock
helm dependency list notesComments: update resolves the range and writes
Chart.lock; build builds exactly from
Chart.lock.
Subchart values go under its name (postgres.enabled),
shared values under global. type: library
cannot be installed.
Hooks and tests (Day 11)
metadata:
annotations:
"helm.sh/hook": post-install,pre-upgrade
"helm.sh/hook-weight": "0"
"helm.sh/hook-delete-policy": before-hook-creation# on prod
helm test <rel> -n <ns> --logs
helm upgrade <rel> <chart> -n <ns> --no-hooksHooks are not part of the release (they survive
uninstall); pre-install runs before all
objects – even before Secrets and subcharts. Migrations:
post-install,pre-upgrade.
CRDs (Day 12)
# on prod
helm template x ./chart --include-crds
helm install x ./chart --skip-crds
helm show crds ./chart | kubectl apply --server-side --field-manager=helm -f -crds/: only at installation, never updated, never
deleted. A separate CRD chart with
"helm.sh/resource-policy": keep.
Caution: Deleting a CRD deletes all objects of that type in the cluster.
Rolling out safely (Day 13)
| Flag | Effect |
|---|---|
without --wait |
waits only for hooks (hookOnly) |
--wait / --wait=watcher |
waits for readiness (kstatus) |
--wait=legacy |
Helm 3 behaviour |
--wait-for-jobs |
waits for Jobs (only with --wait) |
--rollback-on-failure |
rollback or uninstall on failure, sets --wait |
--dry-run=server |
renders with the cluster and lookup, stores nothing,
does not send the objects to the API for validation (Day 4) |
--history-max N |
revisions to keep (default 10) |
Server-Side Apply and Helm 4 (Day 14)
# on prod
helm get metadata <rel> -n <ns> | grep APPLY_METHOD
helm upgrade <rel> <chart> -n <ns> --server-side=true # true|false|auto
helm upgrade <rel> <chart> -n <ns> --force-conflicts
kubectl -n <ns> get deploy <name> --show-managed-fields -o json \
| jq -r '.metadata.managedFields[]
| [.manager, .operation, .subresource // "-"] | @tsv'
helm diff upgrade <rel> <chart> -n <ns> --three-way-merge --detailed-exitcode| Helm 3 | Helm 4 |
|---|---|
--atomic |
--rollback-on-failure |
--force |
--force-replace (not with SSA) |
helm list -a |
helm list (every status), filters
--deployed etc. |
--post-renderer ./skript |
--post-renderer <plugin> (type
postrenderer/v1) |
| three-way merge, drift silently overwritten | SSA, conflict naming the field manager |
OCI registry (Day 15)
# on prod
echo lab-zot-123 | helm registry login localhost:30500 -u lab-zot-user \
--password-stdin --plain-http # nur der Host
helm package notes
helm push notes-0.12.1.tgz oci://localhost:30500/charts --plain-http # stdout!
helm show chart oci://localhost:30500/charts/notes --version 0.12.1 --plain-http
helm install <rel> oci://localhost:30500/charts/notes@sha256:<digest> --plain-http
curl -s -u lab-zot-user:lab-zot-123 localhost:30500/v2/charts/notes/tags/listComments: registry login takes only the host;
helm push writes its output (including the digest) to
stdout.
+ becomes _ in the tag; tags can be
overwritten, the digest cannot.
Signing and secrets (Day 16)
# on prod
gpg --export-secret-keys '<Name>' > secring.gpg
helm package notes --sign --key '<Name>' --keyring secring.gpg
helm verify notes-0.12.1.tgz --keyring pubring.gpg
helm install <rel> ./notes-0.12.1.tgz --verify --keyring pubring.gpg
cosign signing-config create --out offline.json # ohne Rekor
cosign sign --key cosign.key -y --signing-config offline.json --allow-http-registry \
localhost:30500/charts/notes@<digest>
cosign verify --key cosign.pub --allow-http-registry --insecure-ignore-tlog \
localhost:30500/charts/notes:0.12.1
sops encrypt -i secrets.dev.yaml
helm upgrade <rel> ./notes -f secrets://secrets.dev.yamlComment: ohne Rekor means “without Rekor” (no
transparency log).
Anything that ends up in Helm as a value is stored in plain text in
the release Secret. Better: existingSecret and a Secret
from outside (ESO, Sealed Secrets, CSI).
Checking without a cluster (Day 17)
# on prod
set -o pipefail
helm lint notes --strict --with-subcharts -f values/prod.yaml
for env in dev staging prod; do
helm template notes ./notes -f values/$env.yaml \
| kubeconform -strict -summary -kubernetes-version 1.37.0
done
helm template notes ./notes -f values/staging.yaml --skip-tests --no-hooks \
| kubectl apply --dry-run=server --server-side -n <staging> -f -
trivy config --severity HIGH,CRITICAL --exit-code 1 rendering.yaml
pluto detect rendering.yaml --target-versions k8s=<version>
pluto detect-helm
helm unittest notesCI and GitOps (Day 18)
# on prod
ct lint # liest ct.yaml, verlangt neue Version bei Änderung
ct install --namespace <ns> # installiert, helm test, deinstalliert
flux get sources oci -n <ns>
flux get helmreleases -n <ns>
kubectl kustomize --enable-helm .Comments: ct lint reads ct.yaml and demands
a new version when a chart changes; ct install installs,
runs helm test and uninstalls.
| Flux | Argo CD | Kustomize helmCharts |
|
|---|---|---|---|
helm list |
yes | empty | empty |
lookup |
cluster | empty | empty |
| Hooks | Helm hooks | sync hooks | normal objects |
Troubleshooting (Day 19)
# on prod
helm template <rel> ./chart -f werte.yaml --debug # Schicht Rendern
helm template <rel> ./chart | kubectl apply --dry-run=server -f - # Schicht API
helm rollback <rel> <letzte-deployed> -n <ns> --wait # pending-upgrade lösen
kubectl delete sts <name> --cascade=orphan # volumeClaimTemplates ändern
helm upgrade <rel> <chart> --take-ownership --force-conflictsComments: line 1 checks the rendering layer, line 2 the API layer;
rolling back to the last deployed revision
(<letzte-deployed>) resolves
pending-upgrade; orphan-deleting the StatefulSet lets you
change volumeClaimTemplates.
Never without thinking
kubectl delete secret -l owner=helm– deletes Helm’s memory.--force-replace,--cascade=orphan,kubectl delete crd– back up first.--reuse-valuesin pipelines – swallows new defaults.- Secrets via
--set– stored in plain text in every revision. - Upgrades without
--wait– broken revisions become the “last good” one. --force-conflictsacross the board in pipelines – hides drift.- Installing by tag instead of digest, without signature verification.
Error patterns
| Message | Cause | Day |
|---|---|---|
execution error at (notes/templates/deployment.yaml:20:20) |
required/fail in the template |
7, 19 |
YAML parse error … mapping values are not allowed |
indentation, indent/dash |
5, 20 |
can't evaluate field Values in type string |
. instead of $ in range |
5, 20 |
additional properties '…' not allowed |
schema, typo, subchart key | 8, 9, 20 |
library charts are not installable |
type: library |
10 |
no matches for kind |
CRD missing, or in templates/ of the same chart |
12 |
another operation … is in progress |
orphaned pending-* revision |
19, 20 |
release has no 0 version |
rollback without a good revision | 19 |
field is immutable |
selector, volumeClaimTemplates, Job |
6, 19, 20 |
invalid ownership metadata |
object belongs to no release or another one | 12, 19 |
conflict with "…" using … |
another field manager | 14, 19 |
cannot use server-side apply and force replace together |
--force-replace with SSA |
19 |
unable to build kubernetes objects from current release manifest |
removed API in the release | 19 |
context deadline exceeded |
image, probe, hook, PVC | 13, 19, 20 |
chart version not ok. Needs a version bump! |
ct lint without a new version |
18 |
no signatures found |
chart not signed | 16, 20 |
sha256 sum does not match |
package changed after signing | 16 |
invalid registry |
registry login with a path or oci:// |
15 |
improper constraint |
_ instead of + in
--version |
15 |