Helm Hour 7: Deep Troubleshooting, Optimization and Advanced Topics
- By the seven-layer model (chart fetch → values merge → template rendering → API validation → apply → wait → release record) to locate any Helm error and skillfully use
--debug,helm template --debug,--dry-run=server,helm get all,helm get metadataandkubectl get events. - Explain
pending-install/pending-upgrade/pending-rollback's real causes (process killed by SIGKILL, CI timeout, network interruption), and understandanother operation (install/upgrade/rollback) is in progress, and safely recover (roll back to the last deployed revision; delete the release Secret only as a last resort). - Diagnose hook Job failures and timeouts, and understand
hook-delete-policywhy it “deletes the evidence”, and use Helm 4'shelm.sh/hook-output-log-policyprint hook logs to output, and know the risks of--no-hooks. - Master server-side apply (SSA) field ownership: a fresh Helm 4 install defaults to SSA, while a release migrated from Helm 3 still defaults to client-side apply (CSA); understand
Apply failed with 1 conflict, and usemanagedFieldsIdentify the “field-grabbing” manager, and use correctly--force-conflictsand--server-side. - Use
fail/requiredwrite readable errors, debug templates by printing intermediate values, and understandlookuphow it behaves under various dry-runs, and the sources of rendering time for large charts. - Understand release storage (Secret driver, gzip+base64, 1 MiB limit,
--history-maxdefault of 10, SQL driver), and can handle “release too large”. - Complete one Helm 3 → Helm 4 Migration Assessment: parameter renames,
--waitsemantic changes, post-renderer plugin conversion, plugin signature verification, GitOps tool compatibility; output an actionable checklist.
1-Hour Time Allocation Table
| # | Time | Module | Core Content | Animation / Interaction | Lab (kind cluster lab, namespace faults) |
|---|---|---|---|---|---|
| 0 | Pre-class | Prep: Fault Injection Environment | Create the faultbox chart (toggleable hook Job, CRD, values switches) and deploy the release fb | Environment self-check checklist | Deploy baseline revision 1 |
| 1 | 00–06 | Troubleshooting Methodology and --debug | Seven-layer model,--debug,template --debug,--dry-run=server,get all, and events | Error → layer locator | One chart produces 4 layers of different errors |
| 2 | 06–14 | Release Stuck: pending-upgrade | causes of the pending state, errPending pessimistic lock, reading history, rollback recovery, risks of deleting the Secret | Core animation: causes and recovery of pending-upgrade | kill -9 an upgrade running with --wait, and recover |
| 3 | 14–21 | Hook Failures and Timeouts | hook Job failure, delete-policy deleting evidence, output-log-policy,--timeout,--no-hooks | Hook policy combination simulator | Failed pre-upgrade migration Job |
| 4 | 21–29 | SSA and Field Ownership Conflicts | managedFields, conflict determination,--force-conflicts,--server-side=auto/true/false, and Helm 3-migrated release | Core animation: SSA field conflict determination | kubectl patch grabbing a field → conflict → two fixes |
| 5 | 29–36 | Template Debugging and Rendering Performance | fail/required, printing intermediate values,-s, rendering time,lookup and dry-run | required/fail validators + lookup behavior table | Write defensive templates + timing |
| 6 | 36–43 | Release Storage, Size and Cleanup | Secret driver, 1 MiB,--history-max, SQL driver,--keep-history | release size calculator | Create an oversized release and fix it |
| 7 | 43–52 | Migrating from Helm 3 to Helm 4 | rename parameters,--wait, SSA default, post-renderer plugin, Wasm plugins and signatures, CI/GitOps checklist | CI script migration scanner | Helm 3 vs Helm 4 side-by-side comparison |
| 8 | 52–60 | Mixed Fault Blind Box | 8 fault types injected at random, diagnosed, and fixed | In-browser fault simulator + interactive troubleshooting tree | fault-box.sh random injection |
| — | Post-class | Cheat Sheet · Comprehensive Lab | Diagnose and fix the 8 faults one by one + output a Helm 3→4 migration checklist | Final quiz (12 questions) | Comprehensive Lab |
Knowledge Coverage Matrix
| Target skills | M1 | M2 | M3 | M4 | M5 | M6 | M7 | M8 | Key commands | Lab |
|---|---|---|---|---|---|---|---|---|---|---|
| Locate Helm errors by layer | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | · | ✓ | --debug,get all | M1 four-layer errors |
| release state machine and recovery | · | ✓ | ✓ | · | · | ✓ | · | ✓ | history,rollback | kill -9 lab |
| hook failure | · | ✓ | ✓ | · | · | · | · | ✓ | get hooks,kubectl logs job/… | Failed migration Job |
| SSA and field ownership | · | · | · | ✓ | · | · | ✓ | ✓ | --force-conflicts,--show-managed-fields | field-grabbing lab |
| Template Debugging and Performance | ✓ | · | · | · | ✓ | · | · | ✓ | template --debug -s | Defensive templates |
| release storage and size | · | ✓ | · | · | · | ✓ | · | ✓ | kubectl get secret -l owner=helm | 1 MiB lab |
| Immutable fields and CRDs | ✓ | · | · | ✓ | · | · | · | ✓ | --force-replace,kubectl apply --server-side | Selector / CRD failures |
| Helm 3 → 4 migration | · | · | · | ✓ | · | · | ✓ | ✓ | --rollback-on-failure,--wait=watcher | side-by-side comparison + checklist |
Content not covered in this lesson (and where to learn it)
| Topic | Why it's not in this lesson | Where to learn |
|---|---|---|
| Basic Helm commands, values precedence, OCI distribution | Introductory content | Lesson 1 · Helm 4 introduction in Lesson 6 of the Kubernetes course |
| template syntax, helpers, schema, dependencies, lint/test | Basics of writing charts | Lesson 2 |
| hook execution order and weights, chart-testing, GitOps HelmRelease reconciliation | this lesson only covers what to do when they fail | Lesson 5,Lesson 6 |
| Pod-level troubleshooting (CrashLoopBackOff, scheduling, probes) | belongs to Kubernetes itself | Kubernetes course |
| 50 production problems, 50 interview questions | Lesson 8 (optional) | Lesson 8 |
How to Use This Courseware
Theory · Diagrams · Animations · Commands · Labs · Production Cases · Troubleshooting · Quizzes · Audio · Video. All labs in this lesson run in the kind cluster
lab 's namespace faults , and each lab is “inject → observe → diagnose → fix → reset”.A quiz score ≥ 70%, or clicking “Mark this module complete”, counts toward progress. Progress is saved in this browser (cleared on refresh when local storage is disabled).
The “Audio” page reads the lecture script aloud with the browser Web Speech API (en-US); English terms are pronounced with en-US. The lecture script remains readable even without a Chinese voice pack.
pkg/action,pkg/cmd,pkg/storage/driver,pkg/kube). Helm 3's last feature release, 3.22, was published on 2026-09-09,with security fixes continuing until 2027-02-10 (Helm official blog; originally 2026-11, since extended). In this lesson, “Helm 3 behavior” refers to version 3.22 and earlier. Times, hashes, IPs and durations in sample output are example values.Module 0 · Prep: Fault Injection Environment
- Lessons 1–6 completed: installed Helm 4 (
get-helm-4script or package manager), a kind clusterlab(node imagekindest/node:v1.37.0), kubectl 1.37. The myapp chart is still in~/helm-lab/myapp, but this lesson does not inject faults into myapp, instead creating a new faultbox so as not to break the results of your earlier lessons. - Connection to the previous lesson: Lesson 6 covered hook execution order and weights, and helm test; Module 3 of this lesson directly covers diagnosing hooks that fail. The GitOps tools from Lesson 5 (Argo CD v3.6.1 / Flux v2.10.0) appear in Modules 4 and 7 as “another field manager”.
- Optional: Helm 3.22 binary (for the side-by-side comparison in Module 7), installed at
~/bin/helm3,do not overwrite Helm 4.
Step 1: Check tools and cluster
helm version --short kind get clusters kubectl config use-context kind-lab kubectl get nodes kubectl create namespace faults
v4.3.2+g<commit> lab Switched to context "kind-lab". NAME STATUS ROLES AGE VERSION lab-control-plane Ready control-plane 6d v1.37.0 namespace/faults created
If you do not have a cluster yet: kind create cluster --name lab --image kindest/node:v1.37.0.
Step 2: Generate the faultbox chart and add “fault switches”
mkdir -p ~/helm-lab && cd ~/helm-lab helm create faultbox # Append fault switches (coexists with the defaults generated by helm create) cat >> faultbox/values.yaml <<'EOF' # ===== Lesson 7 fault switches ===== hook: enabled: false # Module 3: pre-upgrade migration Job fail: false # true = Job fails with exit code 1 sleep: 2 # Job run time in seconds (used to simulate a timeout) deletePolicy: before-hook-creation outputLogPolicy: "" # Helm 4: hook-failed / hook-succeeded widget: enabled: false # Module 8: use the CRD in crds/ color: "" blob: enabled: false # Module 6: render a large file into a ConfigMap EOF
{{- if .Values.hook.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "faultbox.fullname" . }}-migrate
labels:
{{- include "faultbox.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-weight": "0"
"helm.sh/hook-delete-policy": {{ .Values.hook.deletePolicy | quote }}
{{- with .Values.hook.outputLogPolicy }}
"helm.sh/hook-output-log-policy": {{ . | quote }}
{{- end }}
spec:
backoffLimit: 0
template:
spec:
restartPolicy: Never
containers:
- name: migrate
image: busybox:1.37
command:
- sh
- -c
- |
echo "migrating schema to revision {{ .Release.Revision }}"
sleep {{ .Values.hook.sleep }}
{{- if .Values.hook.fail }}
echo 'ERROR: relation "orders" already exists' >&2
exit 1
{{- else }}
echo "migration done"
{{- end }}
{{- end }}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: widgets.lab.example.com
spec:
group: lab.example.com
names: {kind: Widget, plural: widgets, singular: widget}
scope: Namespaced
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
size: {type: integer}
{{- if .Values.widget.enabled }}
apiVersion: lab.example.com/v1
kind: Widget
metadata:
name: {{ include "faultbox.fullname" . }}
spec:
size: 3
{{- with .Values.widget.color }}
color: {{ . | quote }}
{{- end }}
{{- end }}
Step 3: Deploy the baseline release fb
cd ~/helm-lab helm lint faultbox helm upgrade --install fb ./faultbox -n faults --wait --timeout 3m helm history fb -n faults helm get metadata fb -n faults | grep -E 'STATUS|APPLY_METHOD' kubectl -n faults get secret -l owner=helm,name=fb
==> Linting faultbox [INFO] Chart.yaml: icon is recommended 1 chart(s) linted, 0 chart(s) failed Release "fb" does not exist. Installing it now. NAME: fb ... STATUS: deployed REVISION: 1 REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION 1 Mon Nov 16 09:02:11 2026 deployed faultbox-0.1.0 1.16.0 Install complete STATUS: deployed APPLY_METHOD: server-side apply NAME TYPE DATA AGE sh.helm.release.v1.fb.v1 helm.sh/release.v1 1 12s
helm history ; ② helm get metadata 's APPLY_METHOD (on a fresh Helm 4 install = server-side apply); ③ the name of the release Secret sh.helm.release.v1.<release>.v<revision> and its labels owner=helm,name=…,status=…,version=…. Every diagnosis in this lesson comes back to these three points.Step 4 (optional): Install Helm 3.22 for side-by-side comparison
# For the latest 3.22 patch number, refer to https://github.com/helm/helm/releases; v3.22.0 is used as the example here mkdir -p ~/bin && cd /tmp curl -fsSLO https://get.helm.sh/helm-v3.22.0-linux-amd64.tar.gz tar -xzf helm-v3.22.0-linux-amd64.tar.gz && mv linux-amd64/helm ~/bin/helm3 ~/bin/helm3 version --short
Warm-up: answer from memory (30 seconds)
Where does Helm store a release's history?
By default it is stored in Secrets in the release's namespace, one per revision, of type helm.sh/release.v1, and named sh.helm.release.v1.fb.vN, whose contents are the release JSON, gzip-compressed and then base64-encoded (including the chart, values, rendered manifest and hooks).
Helm 4's --wait flag: what happens if it is omitted?
The default strategy is hookOnly: it only waits for hook resources to complete, and does not wait for ordinary resources such as Deployments to become ready; writing --wait (with no value) is equivalent to --wait=watcher, using kstatus to determine readiness.
Module 1 · Troubleshooting Methodology and --debug
- Name the seven layers of
helm upgrade --install: chart fetch → values merge and schema validation → template rendering → API validation → apply (SSA/CSA) → wait (kstatus) → release record. - Determine the layer from the error prefix:
failed to fetch,values don't meet the specifications,template: …: executing,error validating data,Apply failed with … conflict,not ready. status: InProgress,another operation … is in progress. - Skillfully combine
--debug,helm template --debug,--dry-run=server,helm get all/manifest/values/hooks/metadataandkubectl get events.
What: the seven-layer model
| Layer | What Helm does (v4.3.2 source location) | Typical errors | Preferred tool |
|---|---|---|---|
| ① Chart fetch | Resolve a local directory / .tgz / oci:// / repository index; download and load (pkg/downloader,loader.Load) | failed to fetch … 401,chart "x" version "y" not found,no cached repo found | helm pull --debug,helm show chart,helm registry login |
| ② values | merge default values, the parent chart,-f,--set; handling --reuse-values; JSON Schema validation | values don't meet the specifications of the schema(s), type mismatches | helm get values --all,helm template --debug |
| ③ Render | Go template executes all templates (pkg/engine), post-renderer plugin | template: faultbox/templates/x.yaml:12:8: executing … nil pointer,error converting YAML to JSON | helm template --debug -s templates/x.yaml |
| ④ API validation | builds objects and performs OpenAPI validation (strict field validation), checks resource ownership | error validating data,unknown field,invalid ownership metadata,resource mapping not found | --dry-run=server,kubectl explain |
| ⑤ Apply | write pending record → pre hooks → SSA patch / CSA three-way merge (KubeClient.Update) | Apply failed with 1 conflict,field is immutable, admission webhook rejection,forbidden | kubectl get events,--show-managed-fields |
| ⑥ Wait | according to the --wait strategy (hookOnly / watcher / legacy) waits for resources and hooks | resource Deployment/faults/fb not ready. status: InProgress + context deadline exceeded | kubectl rollout status,describe,logs |
| ⑦ release record | marks the old revision as superseded, marks the new revision as deployed/failed, and writes back to the Secret | another operation (install/upgrade/rollback) is in progress,data: Too long,has no deployed releases | helm history,kubectl get secret -l owner=helm |
Why: why layering is needed
“Deployment failed” is a phrase with no information value. The first three layers occur entirely on the client side, do not change the cluster, and do not produce a revision. Layer ④ is judged by the API Server during a dry-run or a real request. From layer ⑤ onward, the cluster has already been changed and a pending revision record exists, so a “retry” may run into a half-finished leftover from the previous attempt. Layering lets you know immediately: Has the cluster been changed? What state is the release record in? Can I retry directly as the next step?
How: four core tools
--debug(or environment variableHELM_DEBUG=true): Helm 4 uses structured logging (slog) and prints a DEBUG log for each step to stderr ("preparing upgrade", "creating upgraded release", "performing update", etc.); when rendering fails, it also prints the manifest that failed.helm template --debug: purely client-side rendering (default--dry-run=clientsemantics), which prints the rendered output even when the YAML is invalid, making it easy to see which line is broken; combine it with-s templates/x.yamlto look at a single file.helm upgrade --dry-run=server: fully runs layers ①–④ and has the API Server validate via dry-run (including admission webhooks, quotas and immutable fields), but does not write a release record.helm template --validateIn Helm 4 it is already marked deprecated, suggesting use of--dry-run=server.helm get all fb --revision N: retrieves the values, manifest, hooks and notes of a given revision in one go;helm get metadatashows the status andAPPLY_METHOD.
When: first look at which
appears in the error message template: → layer ③,helm template --debug; when a resource name and is invalid appear → layers ④/⑤,--dry-run=server + kubectl get events; when not ready or context deadline exceeded → layer ⑥, return to Kubernetes troubleshooting; when another operation or has no deployed releases → layer ⑦,helm history.
Comparison with similar tools
| helm template | install/upgrade --dry-run=client | --dry-run=server | helm diff (plugin) | |
|---|---|---|---|---|
| Connects to cluster | No | No | Yes | Yes |
lookup | Returns empty map | Returns empty map | Returns real objects | Depends on plugin parameters |
| admission / immutable fields | Not checked | Not checked | Checked | Partial |
| Writes release record | No | No | No | No |
--debug will show more Kubernetes events” — no, it only shows Helm's own logs; events must be checked with kubectl. ② “helm template passing means it can be installed” — it does not go through layers ④–⑦. ③ “Just rerun the upgrade if it failed” — if the failure happens after layer ⑤, rerunning may hit the pending lock or an SSA conflict. ④ “--dry-run with no value equals server” — in Helm 4, with no value it equals client, and prints a deprecation warning.Seven-layer pipeline and the “observation window” of each layer
Decision: error text → layer
Interactive: error locator
Click a real error to see which of the seven layers it falls in, whether the cluster has already been modified, and the next command to run.
Core Commands
| Command | Layer | Description |
|---|---|---|
helm upgrade fb ./faultbox -n faults --debug | All | DEBUG logs go to stderr; in CI, it is recommended to 2>helm-debug.log and save them as an artifact |
helm template fb ./faultbox --debug -s templates/deployment.yaml | ③ | output the rendered result even if the YAML is invalid |
helm upgrade fb ./faultbox -n faults --dry-run=server | ①–④ | server-side dry-run; lookup available; does not write a release; --hide-secret hides Secret contents |
helm get all fb -n faults --revision 3 | ⑦ | the values, hooks, manifest and notes of a revision |
helm get values fb -n faults --all | ② | all merged values (without --all only shows the user-supplied ones) |
helm get metadata fb -n faults | ⑦ | STATUS, REVISION,APPLY_METHOD |
helm history fb -n faults | ⑦ | STATUS and DESCRIPTION for each revision (failure reasons are written here) |
kubectl -n faults get events --sort-by=.lastTimestamp | ⑤⑥ | Facts on the Kubernetes side |
cd ~/helm-lab helm upgrade fb ./faultbox -n faults --set replicaCount=2 --debug 2>&1 | grep -E 'level=DEBUG' | head -8
time=2026-11-16T09:10:01Z level=DEBUG msg="preparing upgrade" name=fb time=2026-11-16T09:10:01Z level=DEBUG msg="performing update" name=fb time=2026-11-16T09:10:01Z level=DEBUG msg="determined release apply method" ... time=2026-11-16T09:10:01Z level=DEBUG msg="creating upgraded release" name=fb ... time=2026-11-16T09:10:03Z level=DEBUG msg="updating status for upgraded release" name=fb
How to verify:helm history Revision 2 deployed appears. Common mistakes: Pasting --debug output directly into a ticket; it may contain the rendered Secret manifest. In CI, store it only as a protected artifact. Production use: automatically run on failure helm history + helm get all + kubectl get events and upload.
Lab 1: One chart, four different layers of errors (about 5 minutes)
cd ~/helm-lab
helm template fb ./faultbox -s templates/deployment.yaml >/dev/null && echo OK
# Trigger a nil pointer:
printf '{{ .Values.missing.key }}\n' > faultbox/templates/bad.yaml
helm template fb ./faultbox --debug -s templates/bad.yaml
OK
Error: template: faultbox/templates/bad.yaml:1:17: executing "faultbox/templates/bad.yaml" at <.Values.missing.key>: nil pointer evaluating interface {}.key
The error gives file:line:column and the failing expression. After fixing, delete: rm faultbox/templates/bad.yaml.
helm upgrade fb ./faultbox -n faults --set-string replicaCount=two --dry-run=server
Error: UPGRADE FAILED: unable to build kubernetes objects from new release manifest: error validating "": error validating data: ValidationError(Deployment.spec.replicas): invalid type for io.k8s.api.apps.v1.DeploymentSpec.replicas: got "string", expected "integer"
helm history fb -n faults No new revision appears; failures before layer ④ leave no record.
helm upgrade fb ./faultbox -n faults --set image.tag=does-not-exist --wait --timeout 60s helm history fb -n faults | tail -2 kubectl -n faults get events --sort-by=.lastTimestamp | tail -3
Error: UPGRADE FAILED: resource Deployment/faults/fb-faultbox not ready. status: InProgress, message: <reason given by kstatus> context deadline exceeded 3 Mon Nov 16 09:14:20 2026 failed faultbox-0.1.0 1.16.0 Upgrade "fb" failed: resource Deployment/faults/fb-faultbox not ready... ... Warning Failed pod/fb-faultbox-7d9c... Failed to pull image "nginx:does-not-exist": ... not found
Resource names follow your fullname (the release name fb does not include the chart name, so the fullname is fb-faultbox). Note: revision 3 is failed, and the Deployment in the cluster has already been changed.
helm get metadata fb -n faults | grep -E 'REVISION|STATUS' helm rollback fb 2 -n faults --wait helm history fb -n faults
REVISION: 3 STATUS: failed Rollback was a success! Happy Helming! REVISION ... STATUS ... DESCRIPTION 1 superseded Install complete 2 superseded Upgrade complete 3 failed Upgrade "fb" failed: ... 4 deployed Rollback to 2
Case 1: CI only printed “UPGRADE FAILED: context deadline exceeded”
Problem: The team reran the pipeline repeatedly; all three attempts timed out. Approach: Judging by layer, this falls under layer ⑥: Helm simply cannot wait for readiness, and the root cause is in the Pod. Added diagnostic steps after failure to the pipeline: kubectl get events,kubectl describe deploy,kubectl logs --previous. Result: Found that the readinessProbe path in the new version was misconfigured. Limitation: Helm 4's kstatus error messages already include the resource name and status, which is more useful than Helm 3's legacy wait, but they still do not include Pod logs.
Case 2: Local template is fine, but the cluster upgrade is rejected
Problem: An Ingress annotation was rejected by a Kyverno policy. Approach: In CI, replace helm template with helm upgrade --dry-run=server, so the admission webhook is triggered at the merge request stage. Limitation: CI needs dry-run permissions beyond cluster read-only (dry-run requests also go through the RBAC create/patch verbs).
Case 3: --debug log leaked a database password
Problem: When rendering failed, --debug printed a manifest containing a Secret, which was captured by the public pipeline logs. Approach: Do not enable --debug in public logs; add --hide-secret for dry-runs; debug output should only be stored as a restricted artifact.
Common errors and fixes
Error: INSTALLATION FAILED: template: x/templates/a.yaml:7:20: executing … nil pointer evaluating interface {}.port
Layer:③. Cause: Accessed a nested key that does not exist. Diagnosis:helm template --debug -s templates/a.yaml, then helm get values --all check the actual values. Fix: Use dig,default dict or required (Module 5).
Error: UPGRADE FAILED: unable to build kubernetes objects from new release manifest: resource mapping not found for name: "x" namespace: "" from "": no matches for kind "Widget" in version "lab.example.com/v1"
Layer:④. Cause: The CRD does not exist (or it is placed in templates/ and created in the same batch as the CR). Diagnosis:kubectl get crd | grep widgets,kubectl api-resources | grep -i widget. Fix: Install the CRD first (the crds/ directory or a separate chart), and protect the CR with .Capabilities.APIVersions.Has .
Error: UPGRADE FAILED: … invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"
Layer:④ (resource ownership check). Cause: A resource with the same name already exists in the cluster but was not created by this release. Fix: After confirming the resource can be adopted, use --take-ownership (available in Helm 4 install/upgrade), or manually add the annotation meta.helm.sh/release-name,meta.helm.sh/release-namespace and labels app.kubernetes.io/managed-by=Helm.
--dry-run did not trigger lookup / admission, so the result differs from a real install
Cause: In Helm 4, --dry-run with no value equals client (and prints a warning). Fix: explicitly write --dry-run=server.
Error: Kubernetes cluster unreachable: Get "https://127.0.0.1:xxxxx/version": dial tcp … connect: connection refused
Layer: Connectivity check before ④. Diagnosis:kubectl config current-context,echo $KUBECONFIG,helm env | grep KUBE. The ports change after a kind cluster restarts, so re- kind export kubeconfig --name lab.
1. Without modifying the cluster, verify whether an upgrade would pass the API Server's admission and field validation, and hide Secret contents.
helm upgrade fb ./faultbox -n faults -f prod.yaml --dry-run=server --hide-secret
2. Retrieve the full values (including defaults) and manifest of revision 3, save them to files, and compare.
helm get values fb -n faults --revision 3 --all > r3-values.yaml helm get manifest fb -n faults --revision 3 > r3.yaml helm get manifest fb -n faults --revision 2 > r2.yaml diff r2.yaml r3.yaml
An upgrade reports “context deadline exceeded”, and a colleague suggests increasing --timeout to 30m and retrying. How do you respond?
First determine the layer: this is layer ⑥, where Helm is waiting for resources to become ready. Increasing the timeout only helps when it genuinely takes a long time (rolling many replicas, slow startup). If the Pod is in ImagePullBackOff or CrashLoopBackOff, it will never become ready no matter how long you wait, and a longer timeout just keeps the release in pending-upgrade for longer, increasing the risk of it getting stuck when CI kills the job (Module 2). The correct approach: kubectl get events,describe,logs find the root cause; if necessary, helm rollback; the timeout should be estimated from maxUnavailable, the number of replicas, and startup time.
Verified instructional videos
Official documentation
Video storyboard (about 90 seconds)
Visual: seven boxes line up from left to right; the left three are blue “client side” and the right three are red “cluster already modified”.
Narration: every helm upgrade passes through seven layers, so first determine which layer the error is in.
Visual: the error text flies in; the keyword “template:” is highlighted and lands on the third box; “not ready” lands on the sixth box.
Narration: the keywords in an error are the address of the layer.
Visual: the terminal shows the output differences between helm template --debug and --dry-run=server side by side.
Narration: template renders only locally; dry-run=server also has the API Server check it.
Visual: in the helm history table, the failed row is circled and the DESCRIPTION column is zoomed in.
Narration: the failure reason is written into the release record; check history first, then decide whether to retry or roll back.
Module 2 · Release Stuck: pending-install / pending-upgrade / pending-rollback
- State the record order of a Helm 4 upgrade: read the last revision → if it is pending, report an error → write a new revision (
pending-upgrade, "Preparing upgrade") → hooks → apply → wait → change the old revision to superseded and the new revision to deployed. - Distinguish three kinds of interruption: SIGINT/SIGTERM (Helm 4 catches the signal and marks the revision as failed),SIGKILL / node outage / OOM (no time to write, so a pending is left behind),API Server unreachable (write-back fails).
- Choose the recovery method by state: pending-upgrade/pending-rollback →
helm rollback <release> <the last deployed revision>; for a revision 1 pending-install →helm uninstallthen reinstall; deleting the release Secret is a last resort, and the risks must be stated clearly.
What: the full set of release states (pkg/release/common/status.go)
| State | Meaning | Written by | Does it “lock” the next upgrade? |
|---|---|---|---|
pending-install | First install in progress; DESCRIPTION is "Initial install underway" | install, before creating resources | Yes |
pending-upgrade | Upgrade in progress; DESCRIPTION is "Preparing upgrade" | upgrade, before hooks and apply | Yes |
pending-rollback | Rollback in progress; DESCRIPTION is "Rollback to N" | rollback, before apply | Yes |
deployed | Currently effective revision (normally only one) | When the operation completes successfully | No |
failed | Operation failed; DESCRIPTION records the reason | Failure handling / received SIGINT or SIGTERM | No (you can upgrade again directly) |
superseded | Was deployed, later replaced by a new revision | A successful upgrade/rollback | No |
uninstalling / uninstalled | Uninstalling / uninstalled but history retained (--keep-history) | uninstall | — |
Why: why the pending record is written first
Helm has no server-side component; it uses the release record itself for concurrency control. The v4.3.2 source pkg/action/upgrade.go 's comments state it plainly: concurrent helm upgrade operations either fail at the step “the last revision is pending” (errPending), or fail with “already exists” when creating a Secret of the same name —this is a pessimistic lock. The cost of the lock: if the process holding it never gets a chance to clean up, the lock is never released.
errPending = errors.New("another operation (install/upgrade/rollback) is in progress")
How: when a pending state is left behind
| Interruption method | Helm 4 behavior | Result |
|---|---|---|
| Ctrl+C (SIGINT) / SIGTERM | helm upgrade A signal handler is registered: it prints Release fb has been cancelled., cancels the context, and marks the revision as failed (reason context canceled) | Not stuck; you can retry or roll back directly |
SIGKILL (kill -9), CI runner timeout followed by a forced kill, Pod OOMKilled / evicted, laptop lid closed with network disconnected | The process has no chance to execute any code | pending is left behind permanently |
| API Server unreachable during cleanup (control plane upgrade, VPN disconnected) | Write-back to the Secret fails | pending may be left behind |
| Two pipelines upgrading the same release concurrently | the latecomer reads pending → errPending | normal protection; waits for the first one to finish |
Key amplifiers: --wait and --timeout. When it is not written, --wait (Helm 4 default hookOnly), the pending window is only “hooks + apply”, lasting a few seconds; with --wait --timeout 15m, the pending window lasts up to 15 minutes. If the CI job's own timeout is 10 minutes, the job is killed before Helm finishes cleanup,almost certainly leaving a pending-upgrade behind. Rule: the CI job timeout must be clearly greater than Helm's --timeout (including hook time).
When: how to recover
- First confirm that no other process is actually running: check whether CI has a job for the same release,
kubectl get secret -l owner=helm,name=fb,status=pending-upgrade's creation time (labelcreatedAt) to see whether it was a long time ago. helm history fbFind the last deployed revision N.helm rollback fb N --waitNote: rollback does not check the pending state. It creates a new revision (pending-rollback → deployed), and applies using the manifest of the pending revision as the “current” and the manifest of N as the “target”, so partially applied changes are reverted too. Afterwards the old pending revision remains in the history (until it is cleaned up by--history-max), which does not affect later operations.- For revision 1's
pending-installthere is no version to roll back to:helm uninstall fbthen reinstall (orhelm install --replaceapplies only to failed/uninstalled, not pending). - Last resort: delete the pending Secret (
sh.helm.release.v1.fb.v5). Risks: resources created by that revision are no longer recorded by any revision (they may later become orphans or cause ownership conflicts on the next upgrade); accidentally deleting the deployed revision makes Helm lose the “current state”; before the operation, alwayskubectl get secret … -o yaml > backup.yaml. Changing only the status label on the Secret does not work— Helm reads the release object encoded in the Secret data.
helm rollback fb (without a revision) always returns to the last good version” — it actually goes to “current revision − 1”; if that one failed, you get back its failed configuration. In production, always specify the revision. ② “--rollback-on-failure (originally --atomic) prevents getting stuck” — it only takes effect while the Helm process is alive; SIGKILL still leaves a pending behind. ③ “pending times out and is released automatically” — no, nothing will change it. ④ “Deleting the Secret is the standard fix” — rollback is; deleting the Secret loses the audit record.Record sequence of an upgrade (v4.3.2)
Recovery decision
Core animation: causes and recovery of a release stuck in pending-upgrade
Three swim lanes: the helm process in CI, the release Secret in the namespace, and the Deployment in the cluster. Click “Next step” to step through; switch “Interruption method” to compare SIGKILL with SIGTERM.
helm upgrade --wait --timeout 10m.Core commands
| Command | Purpose |
|---|---|
helm history fb -n faults | STATUS, CHART and DESCRIPTION for each revision; --max default 256; -o json convenient for scripting |
helm list -n faults --pending / --failed / -A | filter stuck or failed releases (without a status argument,helm list shows the latest revision of each release, regardless of status) |
kubectl -n faults get secret -l owner=helm,name=fb -L status,version,createdAt | inspect the storage layer directly: each revision's status label and creation time (Unix seconds) |
helm rollback fb 4 -n faults --wait --timeout 5m | return to the manifest and values of revision 4, creating a new revision |
helm uninstall fb -n faults | The way out for pending-install |
helm history fb -n faults -o json | jq '[.[]|select(.status=="deployed")][-1].revision' | find the last deployed revision in the script |
# One-click diagnosis function, which can go into the CI failure step
helm_stuck() {
local rel=$1 ns=$2
helm history "$rel" -n "$ns" --max 5
kubectl -n "$ns" get secret -l owner=helm,name="$rel" -L status,version,createdAt \
--sort-by=.metadata.creationTimestamp | tail -5
}
helm_stuck fb faults
REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION 3 Mon Nov 16 09:14:20 2026 failed faultbox-0.1.0 1.16.0 Upgrade "fb" failed: ... 4 Mon Nov 16 09:16:02 2026 deployed faultbox-0.1.0 1.16.0 Rollback to 2 5 Mon Nov 16 09:30:41 2026 pending-upgrade faultbox-0.1.0 1.16.0 Preparing upgrade NAME TYPE DATA AGE STATUS VERSION CREATEDAT sh.helm.release.v1.fb.v4 helm.sh/release.v1 1 15m deployed 4 1763284562 sh.helm.release.v1.fb.v5 helm.sh/release.v1 1 2m pending-upgrade 5 1763285441
How to verify recovery: The last line is deployed, and helm upgrade no longer reports errPending. Common mistakes: Running rollback while another pipeline is still running, so two processes change resources at the same time.
Lab 2: Deliberately create and recover a pending-upgrade (about 6 minutes)
cd ~/helm-lab helm upgrade fb ./faultbox -n faults --set image.tag=does-not-exist --wait --timeout 10m & HPID=$! sleep 10 kill -9 $HPID helm history fb -n faults --max 3
[1]+ Killed helm upgrade fb ./faultbox ... REVISION ... STATUS ... DESCRIPTION 4 deployed Rollback to 2 5 pending-upgrade Preparing upgrade
helm upgrade fb ./faultbox -n faults --set replicaCount=2 helm list -n faults --pending
Error: UPGRADE FAILED: another operation (install/upgrade/rollback) is in progress NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION fb faults 5 ... pending-upgrade faultbox-0.1.0 1.16.0
At this point the Deployment in the cluster already uses the bad image (the v5 manifest has been applied), and the Pods of the old ReplicaSet are still serving. This is the “half-finished” state.
LAST=$(helm history fb -n faults -o json | jq '[.[]|select(.status=="deployed")][-1].revision') echo "rollback to $LAST" helm rollback fb "$LAST" -n faults --wait --timeout 3m helm history fb -n faults --max 3 kubectl -n faults get deploy -o wide
rollback to 4 Rollback was a success! Happy Helming! 4 superseded Rollback to 2 5 pending-upgrade Preparing upgrade 6 deployed Rollback to 4 NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES fb-faultbox 2/2 2 2 40m faultbox nginx:1.16.0
Revision 5 remains in the history but is no longer the “last one”, so the lock is released. Without jq, read the number directly from helm history the output.
helm upgrade fb ./faultbox -n faults --set image.tag=does-not-exist --wait --timeout 10m & HPID=$!; sleep 10; kill -TERM $HPID; wait $HPID helm history fb -n faults --max 2 helm rollback fb 6 -n faults --wait
Release fb has been cancelled. Error: UPGRADE FAILED: context canceled 7 failed Upgrade "fb" failed: context canceled
Conclusion: if the CI cancel button sends SIGTERM and allows a sufficient grace period, Helm 4 marks the revision as failed instead of leaving the lock behind.
helm install fb2 … --wait & then kill -9), and then helm upgrade --install fb2 … observe errPending, and use helm uninstall fb2 -n faults to recover.Case 1: GitLab runner times out after 1 hour, and the Helm --timeout is also 1 hour
Problem: Occasional slow upgrades of a large StatefulSet; after the runner forcibly kills the job, the release is stuck in pending-upgrade, and every subsequent release fails. Approach: Helm --timeout 40m, with the job timeout set to 60m; the failure branch runs helm history and, if pending, automatically helm rollback <last deployed> (prerequisite: a CI resource group ensures only one job runs per release). Limitation: Automatic rollback must assume “no concurrency”; otherwise it will fight with an upgrade that is still running.
Case 2: Argo CD and a manual helm both manage one release
Problem: An engineer manually helm upgrade ran it while the laptop lost its network connection, leaving a pending state; Argo CD uses helm template plus its own sync. It does not read release records, so everything “looks fine”, yet the manual helm keeps reporting errPending. Approach: Make it explicit that a release can have only one manager (GitOps or the helm CLI), and clean up leftover release records.
Case 3: “Ghost” resources appear after deleting a Secret
Problem: To unlock, the pending v12 Secret was deleted directly. The CronJob newly added in v12 had already been created, but v11 does not include it, so later upgrades neither delete nor manage it, and the CronJob keeps running. Approach: Prefer rollback (it uses the v12 manifest as the “current” and will delete the resources v12 added). If the Secret must be deleted, first helm get manifest fb --revision 12 save the manifest and check the newly added resources.
Common errors and fixes
Error: UPGRADE FAILED: another operation (install/upgrade/rollback) is in progress
Cause: The last revision is pending-*. Diagnosis:helm history, the Secret's createdAt labels, and whether CI has concurrent jobs. Fix: After confirming there is no concurrency, helm rollback fb <last deployed>. Prevention: CI timeout > Helm timeout; serialize releases for the same release (resource group / concurrency group); send SIGTERM when cancelling a job.
Error: INSTALLATION FAILED: cannot reuse a name that is still in use
Cause: A release with the same name already has history (including pending-install). --replace The name can be reused only when the final state is failed or uninstalled. Fix: If it already exists, use helm upgrade --install; if stuck in pending-install, helm uninstall.
Error: release has no 0 version
Cause: A rollback without a revision was run on a release that has only revision 1 (target = 1 − 1 = 0). Fix: For pending-install, use uninstall; or specify a revision that exists.
Error: UPGRADE FAILED: "fb" has no deployed releases
Cause: No deployed revision can be found, and the last revision is not failed/superseded (for example, history was manually deleted until only uninstalled remains). Diagnosis:kubectl get secret -l owner=helm,name=fb -L status. Fix: Restore the backed-up Secret, or helm uninstall then use --take-ownership to reinstall and adopt the existing resources.
Changed the Secret's status label to deployed, but Helm still reports in progress
Cause: The label is only used for filtering; Helm decodes data.release to read the state from the release object. Fix: Do not edit it by hand; use rollback.
1. List all releases stuck in a pending state across all namespaces.
helm list -A --pending kubectl get secret -A -l owner=helm -L status | grep pending
2. Roll fb back to revision 4; if it fails, delete the resources newly created by this operation, and write up an explanation.
helm rollback fb 4 -n faults --wait --timeout 5m --cleanup-on-fail --description "unlock after runner kill"
Early-morning release: the pipeline shows “Job cancelled”, and after that every retry reports another operation is in progress. The on-call colleague is about to delete all helm Secrets and reinstall. How do you handle it?
Stop the “delete all Secrets” plan: it would lose all history, and a reinstall could still hit ownership conflicts because the resources already exist. Steps: ① confirm no other job is running; ② helm history find the pending revision and the last deployed N; ③ kubectl get deploy,sts -o wide inspect the half-finished state; ④ helm rollback fb N --wait; ⑤ review whether the cancel sent SIGKILL, whether the CI timeout was less than the Helm timeout, and whether a serialization lock is needed.
Verified instructional videos
No verified video specifically covering pending-upgrade getting stuck and its recovery was found; please refer to this module's animation and storyboard.
Official documentation
Video storyboard (about 90 seconds)
Visual: the helm process writes a yellow card “v5 pending-upgrade”, with a lock hanging from the card.
Narration: before touching the cluster, Helm first writes a pending record; that is its lock.
Visual: the progress bar is in the “waiting for readiness” stage; the CI timer hits its limit first, and a lightning bolt cuts the process down.
Narration: if the process is force-killed, it has no chance to change the record to deployed or failed.
Visual: a second pipeline hits the lock, and “another operation is in progress” pops up.
Narration: the next upgrade reads the last record as pending and rejects it outright.
Visual: the helm history table; a finger points to v4, the last deployed; helm rollback produces a green v6.
Narration: find the last deployed version, roll back to that revision, and the lock is released.
Module 3 · Hook Failures and Timeouts
- Understand how a hook failure affects the release: if a pre-* hook fails, resources are not applied and the revision is marked failed; if a post-* hook fails, resources have already been applied and the revision is still marked failed.
- Understand the three deletion policies
before-hook-creation(default),hook-succeeded,hook-failedand their relation to diagnostic capability; usehelm.sh/hook-output-log-policyto have Helm print the hook Pod logs to stderr. - Set correctly
--timeout(for each individual Kubernetes operation, including waiting for each hook) and the Job'sbackoffLimit/activeDeadlineSeconds; understand--no-hooksthe consequences of skipping a migration.
What: where hooks sit in an upgrade
The order of an upgrade in v4.3.2: write pending record → pre-upgrade hooks (ascending by weight, same weight by name) → apply resources → wait (if --wait) → post-upgrade hooks → finalization. Each hook resource is created (not updated), then Helm waits for it to “complete”: a Job must finish successfully, a Pod must reach Succeeded, and other kinds are considered complete once created.
| Failure point | Cluster state | release record | Error prefix |
|---|---|---|---|
| pre-upgrade hook | Regular resources Unchanged | failed | pre-upgrade hooks failed: … |
| post-upgrade hook | Regular resources Already on the new version | failed | post-upgrade hooks failed: … |
| hook resource creation failed (for example, a Job with the same name already exists) | Unchanged | failed | warning: Hook pre-upgrade … failed: … already exists |
Why: the deletion policy determines whether you can still see logs
| hook-delete-policy | When to delete | Can you still kubectl logs after failure? |
|---|---|---|
before-hook-creation (default when no annotation is set) | Before the next creation of a hook with the same name | Yes, until the next upgrade |
hook-succeeded | After the hook succeeds | Yes (failed ones are not deleted) |
hook-failed | After the hook fails | No— the evidence is deleted immediately |
hook-succeeded,hook-failed | Regardless of success or failure | No |
Helm 4 provides helm.sh/hook-output-log-policy annotation (accepted values hook-succeeded,hook-failed; multiple values can be combined with commas): for Jobs (selecting Pods by job-name=<hook name> ), and for Pod-type hooks, Helm, after determining success or failure and before executing the deletion policy, it writes the container logs to stderr. This makes “hook-failed deletion plus logs still available” possible.
How: how timeouts are calculated
--timeout(default 5m) is the waiting limit for “any single Kubernetes operation”: each hook separately waits at most this long, and resource readiness waits also take at most this long. So an upgrade with 3 pre-upgrade hooks has a worst case of ≈ 3×timeout + the apply wait.- The Job's default
backoffLimit: 6, so failed Pods are retried with exponential backoff at 10s, 20s, 40s…; a migration Job that is certain to fail may take several minutes before it is marked Failed, often hitting--timeout, which shows up as a timeout rather than a failure. For migration-type hooks, it is recommended to setbackoffLimit: 0to 0 or 1, and setactiveDeadlineSeconds. - In Helm 4, when
--waitis not written, the default ishookOnly: hooks are still waited for, but ordinary resources are not.
When: the risks of --no-hooks
--no-hooks Skip this operation's all hooks (install/upgrade/rollback/uninstall all have this flag). It suits emergencies where the hook itself is buggy and skipping it has been confirmed safe. Risks: database migrations are not executed, so the new version connects to the old schema; pre-delete cleanup (for example, deregistering external DNS or deleting cloud resources) is not executed and leaves residue; post-install initialization does not run. After use, the hook's work must be done manually and recorded in the change log.
--rollback-on-failure; when a post hook fails, resources are already on the new version. ② “A hook Job will be helm uninstall removed along with the release”—hook resources are not part of the release manifest, so uninstall does not delete them; they are handled only by the deletion policy. ③ “--timeout is the total duration of the whole command” — it is the upper limit for a single operation. ④ “A hook is updated by upgrade” — hooks are always treated as “newly created”; an old Job with the same name that was not deleted will report immutable / already exists, or may even be misjudged as successful (see the troubleshooting page).Hook lifecycle and the “evidence window”
Interactive: hook policy combination simulator
Choose the deletion policy, log policy, Job behavior and timeout, then click “Run helm upgrade” to see Helm's output, the release state, and what evidence is still available afterwards.
Core commands
| Command | Purpose |
|---|---|
helm get hooks fb -n faults --revision N | View the hook manifest rendered for this revision (including annotations) |
helm status fb -n faults | DESCRIPTION contains the hook failure reason; test hooks show as TEST SUITE |
kubectl -n faults get jobs,pods -l job-name=fb-faultbox-migrate | Whether the hook Job and Pod still exist |
kubectl -n faults logs job/fb-faultbox-migrate | Job logs (while the Job exists) |
kubectl -n faults get events --field-selector involvedObject.kind=Job | After the Job is deleted, events (kept for about 1 hour by default) may still be there |
helm upgrade … --timeout 10m | Waiting limit for a single operation (each hook) |
helm upgrade … --no-hooks | Skip all hooks (risks are explained on the Theory page) |
annotations: "helm.sh/hook": pre-upgrade "helm.sh/hook-weight": "0" "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded "helm.sh/hook-output-log-policy": hook-failed
Meaning: deletes on success; on failure, keeps the Job for investigation and Helm immediately prints the logs to stderr (visible in the CI log); cleans up the old Job before the next upgrade to avoid already exists.
Lab 3: Failed pre-upgrade migration Job (about 6 minutes)
cd ~/helm-lab helm upgrade fb ./faultbox -n faults --set hook.enabled=true,hook.fail=true \ --set hook.deletePolicy=hook-failed --timeout 2m kubectl -n faults get jobs helm history fb -n faults --max 1
Error: UPGRADE FAILED: pre-upgrade hooks failed: resource Job/faults/fb-faultbox-migrate not ready. status: Failed, message: ... No resources found in faults namespace. REVISION ... STATUS ... DESCRIPTION 9 failed Upgrade "fb" failed: pre-upgrade hooks failed: ...
The Job was deleted by the hook-failed policy,kubectl logs so there is nothing to go on; you can only rely on luck to check the events.
helm upgrade fb ./faultbox -n faults --set hook.enabled=true,hook.fail=true \ --set hook.deletePolicy=hook-failed --set hook.outputLogPolicy=hook-failed --timeout 2m
migrating schema to revision 10 ERROR: relation "orders" already exists Error: UPGRADE FAILED: pre-upgrade hooks failed: ...
The evidence goes to Helm's stderr, and therefore into the CI log.
helm upgrade fb ./faultbox -n faults --set hook.enabled=true,hook.fail=true \
--set hook.deletePolicy='before-hook-creation\,hook-succeeded' --timeout 2m
kubectl -n faults logs job/fb-faultbox-migrate
kubectl -n faults get deploy fb-faultbox -o jsonpath='{.spec.template.spec.containers[0].image}{"\n"}'
migrating schema to revision 11 ERROR: relation "orders" already exists nginx:1.16.0
Note: --set commas in the value need escaping \,. The Deployment image did not change: the pre-upgrade hook failed, so regular resources were not applied.
helm upgrade fb ./faultbox -n faults --set hook.enabled=true,hook.sleep=200 \ --set hook.deletePolicy=before-hook-creation --timeout 60s
Error: UPGRADE FAILED: pre-upgrade hooks failed: resource Job/faults/fb-faultbox-migrate not ready. status: InProgress, message: ... context deadline exceeded
The Job is still running (Helm just stops waiting); it may succeed later, but this revision is already failed.
helm upgrade fb ./faultbox -n faults --set hook.enabled=true,hook.fail=false --timeout 2m helm history fb -n faults --max 1 # Reset to the baseline without hooks helm upgrade fb ./faultbox -n faults --reset-values kubectl -n faults delete job -l app.kubernetes.io/instance=fb --ignore-not-found
Case 1: The migration Job failed, but there is nothing at all in the pipeline logs
Problem: To “keep the cluster clean”, the chart author wrote hook-succeeded,hook-failed, and every failure left nothing to investigate. Approach: Changed to before-hook-creation,hook-succeeded + hook-output-log-policy: hook-failed; the migration Job sets backoffLimit: 0,activeDeadlineSeconds: 900, and Helm --timeout 20m. Limitation: output-log-policy only applies to hooks of Job and Pod type.
Case 2: Using --no-hooks to “bypass” a failed migration
Problem: The on-call engineer used --no-hooks to ship the release; ten minutes later the new version was returning many 500s because a database column was missing. Approach: Roll back the application version; fix the migration script; and in the release standard, list --no-hooks as an operation requiring approval. Lesson: A hook carries business prerequisites; skipping it is the same as skipping a deployment step.
Case 3: A post-install hook runs repeatedly in GitOps
Problem: Argo CD does not run Helm hooks; instead, it maps hook annotations to its own sync hooks (PreSync/PostSync). Some semantics (such as post-install running only on the first install) cannot be mapped one-to-one, so the initialization Job runs on every sync. Approach: Compare against the Helm hook mapping table in the Argo CD documentation, and make the Job idempotent. Limitation: For mapping details, refer to the Argo CD v3.6 documentation.
Common errors and fixes
Error: UPGRADE FAILED: pre-upgrade hooks failed: … status: Failed
Diagnosis:kubectl logs job/<hook>; when the Job has been deleted, check kubectl get events, and check helm get hooks 's deletion policy. Fix: Fix the script; add output-log-policy; when a pre-hook fails the resources are unchanged, so once fixed, simply re-upgrade.
Error: UPGRADE FAILED: warning: Hook pre-upgrade faultbox/templates/hook-job.yaml failed: … field is immutable / already exists
Cause: The previous hook Job with the same name still exists, and the deletion policy does not include before-hook-creation. In v4.3.2, creating a hook on an SSA release is a server-side apply patch: when the Job template has changed, it reports spec.template: … field is immutable; if the template is exactly the same, the patch is a no-op, and Helm sees the old completed Job and directly judges success, so the migration did not actually run again. A client-side apply release (a release migrated from Helm 3) reports already exists. Fix:kubectl delete job fb-faultbox-migrate, add before-hook-creation to the policy, or include {{ .Release.Revision }} (note that this leaves multiple Jobs behind).
post-upgrade hooks failed, but the new version's Pods are already running
Cause: The post hook runs after resources have been applied (and waited on). Decision: Is the new version healthy? If it is, fix the hook and re-upgrade (with the same values); if it is not healthy, helm rollback.
the hook stays “running” until context deadline exceeded
Cause: The Job is in backoff retries, the image cannot be pulled, or it is waiting for a dependency (the database is not ready). Diagnosis:kubectl describe job,kubectl get pods -l job-name=…. Fix:backoffLimit,activeDeadlineSeconds, and a more reasonable --timeout.
After helm uninstall, the hook Job still exists
Cause: Hook resources are not part of the release manifest. Fix: Add hook-succeeded to the deletion policy; or clean up manually by label.
1. Check which deletion policy is used in the hook definition of revision 9.
helm get hooks fb -n faults --revision 9 | grep -A1 hook-delete-policy
2. The hook Job has been deleted; find the events related to it from within the last hour.
kubectl -n faults get events --field-selector involvedObject.name=fb-faultbox-migrate kubectl -n faults get events --sort-by=.lastTimestamp | grep -i migrate
A chart has 3 pre-upgrade hooks (weights -5, 0, 5), --timeout 5m, and the CI job times out at 10m. What problems will occur? How should it be adjusted?
In the worst case, the 3 hooks each wait 5 minutes = 15 minutes, plus resource waiting, which far exceeds CI's 10 minutes; the job is killed and leaves a pending-upgrade behind (Module 2). Adjustment: set the Job itself with activeDeadlineSeconds and a smaller backoffLimit; set the CI timeout based on the worst path to be ≥ total hook duration + resource waiting + margin; or merge the hooks.
Verified instructional videos
Both videos predate Helm 4 and do not cover hook-output-log-policy.
Official documentation
Video storyboard (about 80 seconds)
Visual: on the timeline, the pre-upgrade Job turns red; the Deployment beside it stays gray and unchanged.
Narration: when a pre hook fails, regular resources are not changed.
Visual: the hook-failed policy's broom sweeps the Job away; kubectl logs returns NotFound.
Narration: the deletion policy may delete the evidence before you ever see the logs.
Visual: the output-log-policy annotation lights up; the logs are copied to the CI window first, and only then is the Job deleted.
Narration: Helm 4's log policy outputs the logs before deletion, so the evidence stays in the pipeline.
Module 4 · Server-Side Apply (SSA) and Field Ownership Conflicts
- Explain Helm 4's choice of apply method: install defaults to
--server-side=true; upgrade and rollback default to--server-side=auto, inheriting the value recorded in the previous revision'sApplyMethod; a release created by Helm 3 does not have this field and is treated as client-side apply (CSA). - Understand
managedFields, applying SSA rules to decide whether an apply conflicts: a field owned by another manager with a different value = conflict; the same value = shared ownership; a field you no longer declare and that nobody shares = deleted. - Handle conflicts with kubectl, HPA and GitOps controllers:
--force-conflicts(which is mutually exclusive with--force-replace), let the chart give up the field, or explicitly migrate a Helm 3 release to--server-side=true.
What: two apply methods
| Client-side apply CSA (Helm 3 approach) | Server-side apply SSA (default for new Helm 4 installs) | |
|---|---|---|
| Who computes the diff | Helm: performs a three-way merge using the “previous revision manifest / new manifest / current cluster object” and generates a patch | API Server: Helm sends the complete “desired fields”, and the server merges them according to field ownership |
| Fields changed by others | field in the chart unchanged→ keep others' value (drift preserved); field in the chart changed→ silently overwritten | Value differs and is owned by someone else → conflict, operation fails, unless --force-conflicts |
| Where the record lives | managedFields has operation=Update, manager=helm | managedFields has operation=Apply, manager=helm |
| When Helm 4 uses each | Releases migrated from Helm 3 (auto), or explicitly --server-side=false | New installs, or explicitly --server-side=true |
Why: why Helm 4 switched to SSA
The three-way merge has two old problems: ① it cannot see “who” changed a field, and can only choose between two options based on whether the chart changed, so it either keeps drift or overwrites silently; ② it is based on the previous revision's manifest, so when the manifest and the cluster disagree (for example, resources were deleted by hand or the post-renderer changed), the patch goes wrong. SSA records ownership with the API Server, and conflicts are explicitly surfaced at apply time, so multiple managers (Helm, HPA, cert-manager injection, GitOps controllers) can safely own different fields.
How: the decision logic of v4.3.2
- install:
--server-sideis a boolean, defaulttrue; the release recordApplyMethod=ssa,helm get metadatashowsAPPLY_METHOD: server-side apply. - upgrade / rollback:
--server-sideis a stringtrue|false|auto, defaultauto: the previous revision isssato use SSA; a Helm 3 release (empty field) showsclient-side apply (defaulted)and continues to use CSA. - When switching from CSA to SSA (
--server-side=true), Helm takes the fields it originally owned via Update and upgrades them to Apply ownership (in the source code, asupgradeClientSideFieldManager), so that after the switch it does not conflict with “its past self”. - The field manager name is fixed to
helm(set viacmd/helm/helm.gokube.ManagedFieldsManager = "helm"); programs using the Helm SDK that do not set it will use the executable name. --force-conflicts: with SSA, forcibly take ownership of conflicting fields; mutually exclusive with--force-replace(delete and recreate, originally--force) — specifying both is rejected by argument parsing.
SSA conflict decision rules (Kubernetes documentation)
- For each field helm declares this time: if no other manager owns it → helm owns it, set to the declared value.
- Owned by another manager, and the same value → no conflict; helm and the other party share ownership.
- Owned by another manager, and a different value → conflict; with force, helm takes ownership and the other party loses the field.
- Fields helm declared last time but does not declare this time: if no other manager → deleted (or restored to default); if there are sharers → kept, but helm no longer owns it.
- Any write operation that “changes a field value” (kubectl edit/patch/scale, controller Update) makes the writer the owner of that field.
When: typical sources of conflict
| Source | Common fields | Recommended handling |
|---|---|---|
On-call engineers kubectl scale/edit/patch | .spec.replicas, image, environment variables | Write the change back to values, then use --force-conflicts to reclaim it once; permanently ban manual edits in the long run |
| HPA (via the scale subresource) | .spec.replicas | When HPA is enabled, the chart should not render replicas (helm create template already does this) |
| GitOps controllers (Argo CD, Flux) | the whole object | An object can have only one “declaration source”; do not mix Helm CLI and GitOps management |
| Injecting controllers (Istio, Linkerd, certificate injection) | annotations, CA bundle | The chart does not declare these fields |
--server-side=true. ② “--force-conflicts and --force are the same” — the former only takes field ownership; the latter (now named --force-replace) deletes and recreates resources, which causes an outage. ③ “SSA conflicts are a bug, so force should always be added” — a conflict is a reminder that there is another manager; blindly forcing will fight with HPA back and forth. ④ “Fields not written in the chart are deleted by SSA” — only fields that helm once owned, no longer declares, and nobody shares are deleted.managedFields illustration
Path for migrating a Helm 3 release into Helm 4
Core animation: the SSA field conflict decision process
The left side shows the current values of the object in the cluster and their field owners; the right side shows the values helm is declaring this time. Click “Decide field by field” to see how the API Server handles each field; switch --force-conflicts or change helm's declaration and retry.
| Field | Current cluster value | Current owner | helm declaration | Decision |
|---|
Core commands
| Command | Purpose |
|---|---|
helm get metadata fb -n faults | APPLY_METHOD: server-side apply / client-side apply / client-side apply (defaulted) |
kubectl get deploy fb-faultbox -n faults -o yaml --show-managed-fields | kubectl hides managedFields by default; this flag is required |
kubectl get deploy fb-faultbox -n faults -o json | jq '.metadata.managedFields[] | {manager, operation, subresource}' | Quickly list all managers |
helm upgrade … --force-conflicts | Forcibly take over conflicting fields with SSA |
helm upgrade … --server-side=true|false|auto | Explicitly choose the apply method (rollback supports it too) |
kubectl apply --server-side --field-manager=helm --dry-run=server -f r.yaml | Reproduce, outside Helm, an apply with the same name as Helm's to check for conflicts (read-only rehearsal) |
kubectl -n faults get deploy fb-faultbox -o json \ | jq -r '.metadata.managedFields[] | "\(.manager)\t\(.operation)\t\(.subresource // "-")\t\(.fieldsV1 | tostring | .[0:80])"'
helm Apply - {"f:metadata":{"f:annotations":{"f:meta.helm.sh/release-name":{},"f:meta.helm.sh/re
kube-controller-manager Update status {"f:metadata":{"f:annotations":{"f:deployment.kubernetes.io/revision":{}}},"f:statu
ops-hotfix Update - {"f:spec":{"f:replicas":{}}}
Lab 4: Grab a field → conflict → two fixes → compare with CSA (about 7 minutes)
kubectl -n faults patch deploy fb-faultbox --field-manager=ops-hotfix \
--type=merge -p '{"spec":{"replicas":3}}'
kubectl -n faults get deploy fb-faultbox -o json | jq -r '.metadata.managedFields[] | "\(.manager) \(.operation)"'
deployment.apps/fb-faultbox patched helm Apply kube-controller-manager Update ops-hotfix Update
cd ~/helm-lab helm upgrade fb ./faultbox -n faults
Error: UPGRADE FAILED: conflict occurred while applying object faults/fb-faultbox apps/v1, Kind=Deployment: Apply failed with 1 conflict: conflict with "ops-hotfix" using apps/v1: .spec.replicas
Even though the chart did not change, helm still declares replicas: 1, and this field now belongs to ops-hotfix with the value 3 → conflict. This revision is recorded as failed, and the cluster is not modified.
helm upgrade fb ./faultbox -n faults --set replicaCount=3
kubectl -n faults get deploy fb-faultbox -o json | jq -r '.metadata.managedFields[] | select(.fieldsV1|tostring|test("replicas")) | .manager'
Release "fb" has been upgraded. Happy Helming! helm ops-hotfix
kubectl -n faults patch deploy fb-faultbox --field-manager=ops-hotfix --type=merge -p '{"spec":{"replicas":4}}'
helm upgrade fb ./faultbox -n faults --set replicaCount=2 --force-conflicts
kubectl -n faults get deploy fb-faultbox -o jsonpath='{.spec.replicas}{"\n"}'
helm upgrade fb ./faultbox -n faults --set replicaCount=2 --force-conflicts --force-replace
deployment.apps/fb-faultbox patched Release "fb" has been upgraded. Happy Helming! 2 Error: if any flags in the group [force-replace force-conflicts] are set none of the others can be; [force-conflicts force-replace] were all set
helm install fbcsa ./faultbox -n faults --server-side=false
helm get metadata fbcsa -n faults | grep APPLY_METHOD
kubectl -n faults patch deploy fbcsa-faultbox --field-manager=ops-hotfix --type=merge -p '{"spec":{"replicas":3}}'
helm upgrade fbcsa ./faultbox -n faults # auto → stays on CSA
kubectl -n faults get deploy fbcsa-faultbox -o jsonpath='{.spec.replicas}{"\n"}'
helm upgrade fbcsa ./faultbox -n faults --set replicaCount=2
kubectl -n faults get deploy fbcsa-faultbox -o jsonpath='{.spec.replicas}{"\n"}'
APPLY_METHOD: client-side apply Release "fbcsa" has been upgraded. Happy Helming! 3 Release "fbcsa" has been upgraded. Happy Helming! 2
CSA: when the chart is unchanged, drift (3) is silently preserved; when the chart changes, it is silently overwritten (2). There is no error at all; this is the problem SSA is meant to solve.
helm upgrade fbcsa ./faultbox -n faults --set replicaCount=2 --server-side=true helm get metadata fbcsa -n faults | grep APPLY_METHOD helm uninstall fbcsa -n faults helm upgrade fb ./faultbox -n faults --reset-values --force-conflicts
APPLY_METHOD: server-side apply release "fbcsa" uninstalled
Case 1: The first --server-side=true upgrade after migrating to Helm 4 fails
Problem: For years on-call engineers manually changed the resource limits of many Deployments, and CSA kept those changes silently. When switching to SSA, 40 conflicts were exposed at once. Approach: First use --dry-run=server --server-side=true to list the conflicts; decide for each one whether to “write back to values” or “give up the field”; after writing everything back, use one --force-conflicts to reclaim. Limitation: The dry-run conflict list depends on the API Server's SSA implementation; complex CRDs (lists without listType annotations) may be treated as a single atomic field.
Case 2: HPA and the chart's replicas tug-of-war
Problem: The chart still renders replicas: 2 when HPA is enabled. Under Helm 3, every release reset the replica count to 2, and HPA pulled it back to 8, causing a momentary capacity drop during the release; under Helm 4 SSA, it reports a conflict directly. Approach: Wrap the template with {{- if not .Values.autoscaling.enabled }} around replicas (consistent with helm create generated templates). Note: In the upgrade that switches from “rendering replicas” to “not rendering”, if helm is the only owner, SSA deletes that field and the Deployment falls back to the default of 1 replica. First confirm that HPA has taken over (once HPA writes to the scale subresource it becomes the field owner), then release.
Case 3: Mixing Argo CD and the helm CLI
Problem: Argo CD (with the ServerSideApply sync option enabled) applies resources under its own field manager, and an engineer then used the helm CLI to upgrade the same release; the two conflict with each other. Approach: Each object has only one declaration source; when a temporary manual change is needed, pause automatic sync in Argo CD and write the change back to Git.
Common errors and fixes
Error: UPGRADE FAILED: conflict occurred while applying object faults/fb-faultbox apps/v1, Kind=Deployment: Apply failed with 1 conflict: conflict with "kubectl-edit" using apps/v1: .spec.template.spec.containers[name="faultbox"].image
Cause: Someone used kubectl edit to change the image, so the current value differs from the chart. Diagnosis:--show-managed-fields, confirm the owner and time (managedFields[].time). Fix: If the manual change should be kept → write it into values (same value means shared); otherwise --force-conflicts. The manager name should be taken from what is actually displayed in managedFields.
conflict with "kube-controller-manager" … .spec.replicas
Cause: HPA modified the replica count through the scale subresource. Fix: When HPA is enabled, the chart does not render replicas; do not use force to tug-of-war with HPA.
Error: if any flags in the group [force-replace force-conflicts] are set none of the others can be
Cause: The two flags are mutually exclusive (--force and --force-conflicts are likewise mutually exclusive). Fix: Use --force-conflicts; only use --force-replace when deletion and recreation is required (immutable fields).
A Helm 3-era release still “silently overwrites” manual changes after an upgrade
Cause:--server-side=auto It continues to use CSA. Diagnosis:helm get metadata shows client-side apply (defaulted). Fix: Plan a one-time --server-side=true migration.
After switching to SSA, some field is deleted (for example, an annotation or the replica count)
Cause: helm was once the only owner of that field, and the new chart no longer declares it. Fix: If it should be kept, let the real manager (a controller or a person) first write to the field to become its owner, or keep declaring it in the chart.
1. List all Helm releases in all namespaces that still use client-side apply.
for r in $(helm list -A -o json | jq -r '.[] | "\(.name)/\(.namespace)"'); do
n=${r%%/*}; ns=${r##*/}
m=$(helm get metadata "$n" -n "$ns" | awk -F': ' '/APPLY_METHOD/{print $2}')
echo "$ns/$n: $m"
done | grep client-side2. Without modifying the cluster, rehearse whether migrating release fb to SSA would conflict.
helm upgrade fb ./faultbox -n faults --server-side=true --dry-run=server
The platform team wants to add --force-conflicts uniformly to all helm upgrade commands in CI, “so conflicts don't interrupt releases”. Your opinion?
I don't recommend a blanket rule. A conflict means another manager exists. For HPA, force resets the replica count, causing a capacity drop, and HPA changes it back the next moment, creating a tug-of-war. For an emergency patch from the security team (for example, changing an image), force silently rolls the patch back. Recommendations: do not add it by default; when a conflict occurs, have CI output the conflicting fields and their managers; establish a process that “manual changes must be written back to values”; use force only in a single, confirmed release.
Verified instructional videos
Official documentation
- Kubernetes · Server-Side Apply (conflicts, ownership transfer)
- Helm 4 Overview (SSA default and migration notes)
- helm upgrade (--server-side, --force-conflicts)
Video storyboard (about 90 seconds)
Visual: beside each field of the Deployment are name tags: helm, ops-hotfix, kube-controller-manager.
Narration: server-side apply records an owner for every field.
Visual: helm hands over a form with replicas equal to 1; the API Server sees the tag ops-hotfix and the value 3, and a red light comes on.
Narration: a field owned by someone else with a different value is a conflict.
Visual: the three ways out are demonstrated in turn: the same value shares the tag; force tears off the tag and replaces it with helm; the chart gives up the field to HPA.
Narration: first work out who should own this field, then decide how to resolve the conflict.
Module 5 · Template Debugging and Rendering Performance
- Use
requiredandfailto write errors with context (Helm wraps them asexecution error at (file:line:column): message), and understand how they manifest inhelm lint. - Master the 4 techniques for printing intermediate values:
toYamlwriting into comments,fail (toYaml $x)interrupting dump,printf "%T"/kindOfchecking types,-sand--output-dirnarrowing the scope. - Know the main sources of rendering time (number of dependencies, repeated
include/tpl,lookupnetwork calls, huge.Files), and can usetimeandHELM_PPROF_CPU_PROFILEto measure; understandlookuphow it behaves under template / client / server dry-run.
What: readable failures
{{- define "faultbox.validate" -}}
{{- $repo := required "image.repository must not be empty: set the image repository in values" .Values.image.repository -}}
{{- if and .Values.ingress.enabled (not .Values.ingress.hosts) -}}
{{- fail "when ingress.enabled=true, at least one ingress.hosts entry must be configured" -}}
{{- end -}}
{{- if and (not .Values.autoscaling.enabled) (lt (int .Values.replicaCount) 1) -}}
{{- fail (printf "replicaCount must be ≥ 1 (currently %v, type %T)" .Values.replicaCount .Values.replicaCount) -}}
{{- end -}}
{{- end -}}
In deployment.yaml , add the following line at the top {{ include "faultbox.validate" . }} (it outputs nothing). On failure, Helm's engine formats the template error as:
Error: execution error at (faultbox/templates/deployment.yaml:1:3): when ingress.enabled=true, at least one ingress.hosts entry must be configured
| Function | Purpose | In helm lint, |
|---|---|---|
required "msg" .Values.x | fails when the value is empty (nil or empty string); otherwise returns it unchanged | In lint mode,does not fail (the value may be provided at install time); it only gives a hint |
fail "msg" | Unconditionally fails, used for composite condition validation | fails |
values.schema.json | Structure and type validation, before rendering (layer ②) | fails |
Why: why not hand everything to the schema
JSON Schema is good at types, enums and required fields; cross-field business rules (“an ingress must have a host when enabled”, “the built-in postgres must be turned off when an external database is enabled”) are written with if/then are hard to write, whereas fail can give directly actionable hints. In practice the two are used together: the schema manages structure, and fail manages business rules.
How: techniques for printing intermediate values
- write into comments:
# DEBUG {{ .Values.resources | toJson }}, visible in the rendered output, and does not affect the YAML (remove after debugging). - interrupting dump:
{{ fail (toYaml $ctx) }}— to view, in a complexrange/withblock, the current.value, exactly what it is; the error message is the dump content. - Check type:
{{ printf "%T" .Values.replicaCount }},kindOf,typeOf. Numbers coming from--setare int64, while numbers from a YAML file are float64,--set-stringis a string — comparing witheqis a common cause of failure. - Narrow the scope:
helm template -s templates/deployment.yaml;--output-dir out/outputs per file, convenient for diff;--debugstill outputs the rendered result when the YAML is invalid.
When: why rendering is slow
| Source | Cause | Optimization |
|---|---|---|
| Number of dependencies | The templates of the parent chart and all subcharts are parsed into one template set and executed one by one; the values of each subchart must be merged | Disable unused subcharts (condition); split very large umbrella charts |
Repetition include | a helper is executed repeatedly for every resource and every container (for example, a helper that generates labels is called hundreds of times) | At the beginning of the template $labels := include … cache in a variable |
tpl | every call has to parse the string as a new template | use only for the small number of values that really need templating |
lookup | each call is a synchronous API request (during server dry-run and real installs) | Avoid calling it inside range ; store the result in a variable |
.Files / huge values | all files in the chart are loaded (they also enter the release record, see Module 6) | .helmignore Exclude |
Measure: time helm template … give end-to-end time; HELM_PPROF_CPU_PROFILE=cpu.out helm template … and HELM_PPROF_MEM_PROFILE (v4.3.2 pkg/cmd/profiling.go), generate a pprof file,go tool pprof -top cpu.out view hotspots.
lookup With dry-run
| Command | Connects to cluster | lookup returns |
|---|---|---|
helm template | No | empty map ({}) |
install/upgrade --dry-run (= client) | No | empty map |
install/upgrade --dry-run=server | Yes | real objects |
| real install/upgrade | Yes | real objects |
helm lint | No | empty map |
So a template that “reuses the password if the Secret already exists, otherwise generates a random one” will, in helm template and in GitOps tools (Argo CD renders with ), a new password is generated every time. Templates must handle an empty map: {{- $s := lookup "v1" "Secret" .Release.Namespace "x" -}}{{- if $s }}…{{- end }}.
required can check that a value is false or 0” — it only tests for nil and the empty string; 0 and false are valid values. ② “If lint passes, all required conditions are met” — in lint mode, required does not fail. ③ “lookup also works in dry-run” — only --dry-run=server. ④ “Slow rendering means Kubernetes is slow” —helm template rendering runs entirely offline; if it is slow, the template itself is slow.Debugging funnel: from the full output to a single variable
Composition of rendering time (illustrative)
Interactive: required / fail validators + lookup behavior
Change values and the execution mode, and observe faultbox.validate 's output, and lookup "v1" "Secret" "faults" "fb-db" returns in that mode.
Core commands
| Command | Purpose |
|---|---|
helm template fb ./faultbox --debug -s templates/deployment.yaml | Renders only one file |
helm template fb ./faultbox --output-dir out/ | Each template is written as one file, convenient for diff -r |
helm template fb ./faultbox --set-json 'ingress={"enabled":true}' | Precisely passing structured values |
helm lint ./faultbox --strict -f ci/values.yaml | Note that required does not fail in lint |
time helm template big ./umbrella >/dev/null | End-to-end rendering time |
HELM_PPROF_CPU_PROFILE=cpu.out helm template … | Generate a CPU profile,go tool pprof -top cpu.out |
helm upgrade … --dry-run=server | so that lookup returns real objects |
# Inside range, see what the “current context” actually is
cat > /tmp/dump.yaml <<'EOF'
{{- range $i, $h := .Values.ingress.hosts }}
{{- if eq $i 0 }}{{ fail (toYaml $h) }}{{ end }}
{{- end }}
EOF
cp /tmp/dump.yaml ~/helm-lab/faultbox/templates/zz-dump.yaml
helm template fb ~/helm-lab/faultbox; rm ~/helm-lab/faultbox/templates/zz-dump.yaml
Error: execution error at (faultbox/templates/zz-dump.yaml:2:20): host: chart-example.local paths: - path: / pathType: ImplementationSpecific
Lab 5: Defensive templates + timing (about 5 minutes)
_validate.tpl to ~/helm-lab/faultbox/templates/_validate.tpl, and insert at the first line of deployment.yaml :
cd ~/helm-lab
sed -i '1i {{- include "faultbox.validate" . }}' faultbox/templates/deployment.yaml
helm template fb ./faultbox --set ingress.enabled=true --set-json 'ingress.hosts=[]'
helm template fb ./faultbox --set replicaCount=0
helm template fb ./faultbox --set image.repository=
Error: execution error at (faultbox/templates/deployment.yaml:1:4): when ingress.enabled=true, at least one ingress.hosts entry must be configured Error: execution error at (faultbox/templates/deployment.yaml:1:4): replicaCount must be ≥ 1 (currently 0, type int64) Error: execution error at (faultbox/templates/deployment.yaml:1:4): image.repository must not be empty: set the image repository in values
The line and column point to where include is located; the actual rule is in the helper. Note --set produces int64.
helm lint ./faultbox --set image.repository=
Observation: in lint mode required does not make lint fail (the LintMode behavior of the v4.3.2 engine), so CI still needs an extra run with real values via helm template.
kubectl -n faults create secret generic fb-db --from-literal=password=s3cr3t
cat > faultbox/templates/zz-lookup.yaml <<'EOF'
{{- $s := lookup "v1" "Secret" .Release.Namespace "fb-db" }}
# lookup-found: {{ if $s }}yes{{ else }}no{{ end }}
EOF
helm template fb ./faultbox -n faults | grep lookup-found
helm upgrade fb ./faultbox -n faults --dry-run=client | grep lookup-found
helm upgrade fb ./faultbox -n faults --dry-run=server | grep lookup-found
rm faultbox/templates/zz-lookup.yaml
# lookup-found: no # lookup-found: no # lookup-found: yes
Only server dry-run can read Secrets from the cluster. If written as a bare --dry-run, Helm 4 treats it as client and prints a deprecation warning.
for i in $(seq 1 300); do printf '# {{ include "faultbox.labels" . | quote }}\n' ; done > faultbox/templates/zz-heavy.yaml
time helm template fb ./faultbox >/dev/null
HELM_PPROF_CPU_PROFILE=/tmp/cpu.out helm template fb ./faultbox >/dev/null && ls -l /tmp/cpu.out
rm faultbox/templates/zz-heavy.yaml
The difference for a small chart is tiny (milliseconds); the key is learning how to measure. On an umbrella chart with dozens of subcharts, the difference is very noticeable.
Case 1: Argo CD rotates the database password on every sync
Problem: The chart uses lookup to reuse an existing password, otherwise randAlphaNum 24. Argo CD renders in helm template mode; lookup is always empty, so a new password is generated on every sync, and the application and database fall out of step. Approach: The password is managed by external secret management (External Secrets / Key Vault), and the chart only references the Secret name. Limitation: Any logic that depends on lookup is not suitable for the GitOps rendering path.
Case 2: An umbrella chart takes 90 seconds to render
Problem: A platform chart containing 60 subcharts; in CI, helm template takes 90 seconds. Approach: pprof shows that most of the time is spent in tpl: every subchart runs tpl over the whole values string. Changed to apply tpl only to a few fields and to use condition to disable unused subcharts, which brought it down to 12 seconds (this figure was recorded for this case and is for reference only).
Case 3: eq A comparison is always false
Problem:{{ if eq .Values.port 8080 }} It has no effect when set in values.yaml. Cause: Numbers in YAML are parsed as float64, which has a different type from an int constant when compared. Approach:eq (int .Values.port) 8080, and use printf "%T" to debug.
Common errors and fixes
Error: execution error at (x/templates/a.yaml:3:4): …(custom message)
This is the business error raised by fail or required . Fix the values according to the message. If the message is unclear, improve the hint text in the chart.
error calling eq: incompatible types for comparison
Cause: Compared different types (for example int64 and string). Diagnosis:printf "%T". Fix:int,toString unify the types.
rendering template has a nested reference name: x: unable to execute template
Cause:include Recursion exceeded the limit (1000 times in v4.3.2). Fix: Check whether a helper includes itself, or whether tpl references itself.
lookup is always empty in CI
Cause: Used helm template or client dry-run. Fix: When real data is needed, use --dry-run=server; make the template compatible with an empty map.
getHostByName always returns an empty string
Cause: Helm disables DNS lookups in templates by default. Fix: When it is really needed, --enable-dns (this makes rendering depend on the network, so it is not recommended).
1. Render the chart to a directory and compare it with the rendering result of the previous version.
helm template fb ./faultbox -f prod.yaml --output-dir /tmp/new git stash && helm template fb ./faultbox -f prod.yaml --output-dir /tmp/old && git stash pop diff -ru /tmp/old /tmp/new
2. Generate a CPU profile for helm template and view the top 10 hotspots.
HELM_PPROF_CPU_PROFILE=cpu.out helm template big ./umbrella >/dev/null go tool pprof -top -nodecount=10 cpu.out
For a chart you need to add the constraint “the built-in postgres must be turned off when the external database is enabled”: use the schema or fail? How should the error message be written?
Cross-field business rules are better suited to fail (the schema's if/then is hard to read and its errors are obscure). Example: {{- if and .Values.externalDatabase.enabled .Values.postgresql.enabled }}{{ fail "when externalDatabase.enabled=true, set postgresql.enabled=false to avoid deploying the built-in database at the same time" }}{{ end }}. A good error message includes which field, the current value, the expected value and how to fix it.
Verified instructional videos
Official documentation
Video storyboard (about 75 seconds)
Visual: an obscure nil pointer error is shown side by side with a clear fail error.
Narration: a good chart tells the user directly which value to change when it fails.
Visual: the funnel narrows from the full output to a single file with -s, and then to a single DEBUG comment.
Narration: narrow step by step from the full output down to one variable.
Visual: switches for the four execution modes; the lookup light turns on only for dry-run=server and real upgrades.
Narration: lookup only returns data when connected to a cluster.
Module 6 · Release Storage, Size Limits and Cleanup
- State how the release record is encoded: release object → JSON → gzip (highest compression level) → base64 → the Secret's
data.release; Secret typehelm.sh/release.v1, labelsowner=helm,name,status,version, when creating or modifying, addcreatedAt/modifiedAt. - Know the Kubernetes per-object size cap for a Secret (and ConfigMap) data 1 MiB , and recognize
data: Too long: must have at most 1048576 bytes, and find out “what made the release larger”. - Choose drivers:
secret(default),configmap,memory,sql(PostgreSQL,HELM_DRIVER_SQL_CONNECTION_STRING); use--history-max(default 10, environment variableHELM_MAX_HISTORY) to control history; understandhelm uninstall --keep-history.
What: what a revision contains
| Part | Content | Common “bloat sources” |
|---|---|---|
chart | Chart.yaml, templates, default values, schema,all files in the chart directory that are not excluded by .helmignore, all subcharts (recursively) | large Grafana dashboard JSON, embedded CRDs, test data, accidentally packaged binaries |
config | user-supplied values (-f / --set) | stuffing certificates and large configuration files into values |
manifest | All rendered manifests | large files embedded in ConfigMaps, hundreds or thousands of resources |
hooks | hook manifests and the last run status | — |
info | status, time, description, NOTES | — |
Encoding (v4.3.2 pkg/storage/driver/util.go): json.Marshal → gzip.BestCompression → base64.StdEncoding. Text content usually compresses to 10%–25%, while binaries that are already compressed or random hardly compress at all; base64 then inflates by 4/3. Therefore the gzipped data must be roughly smaller than 768 KiB, and only after base64 encoding can it fall below 1 MiB.
Why: why there is a 1 MiB limit
The Kubernetes documentation specifies that a single Secret is at most 1 MiB (ConfigMaps likewise limit data to 1 MiB), to prevent large objects from exhausting the memory of the API Server and etcd. This limit is applied to each revision, independent of the number of history entries —--history-max reducing it to 1 cannot save a revision that is already oversized by itself. But the number of history entries determines the total etcd footprint: 10 revisions of 900 KiB each come to about 9 MiB.
How: driver comparison
| HELM_DRIVER | Storage location | Size limit | Suitable scenarios |
|---|---|---|---|
secret (default; can also be written as secrets or left empty) | Secret in the release namespace | 1 MiB / revision | Most scenarios; read access can be restricted with RBAC |
configmap | ConfigMap | 1 MiB | Not recommended: sensitive data in values is readable in plaintext (release content is not encrypted) |
memory | process memory | — | Tests,helm template scenarios; lost when the process ends |
sql | PostgreSQL table releases_v1,custom_labels_v1 | database field limits | Very large releases, centralized auditing; all users need to be configured with the same connection string (HELM_DRIVER_SQL_CONNECTION_STRING), v4.3.2 supports only the postgres dialect |
When: cleanup and history
--history-max: available for upgrade and rollback; the default is 10 (HELM_MAX_HISTORYcan override), 0 means unlimited. When a new revision is created, the oldest records are deleted, but always keeps the last deployed revision.helm uninstall: deletes resources and all history;--keep-historykeeps the history and sets its status touninstalled(helm list --uninstalledis visible, and can behelm rollbackrestored). A release name whose history is retained cannot behelm installreused directly; you need--replaceor must completely uninstall first.- With large numbers of namespaces and releases,
kubectl get secret -A -l owner=helmthe total size is worth monitoring.
From release object to Secret
Pruning with --history-max=3
Interactive: release size calculator
Enter the uncompressed size of each part of the chart to estimate the byte count of data.release in the Secret (the compression ratio is an empirical range; actual measurements prevail).
Core commands
| Command | Purpose |
|---|---|
kubectl -n faults get secret -l owner=helm,name=fb -L status,version | List all revisions of fb |
kubectl -n faults get secret sh.helm.release.v1.fb.v1 -o jsonpath='{.data.release}' | base64 -d | wc -c | Byte count of the release field in the Secret (the API returns data base64-encoded again, so decoding once gives the stored bytes) |
… | base64 -d | base64 -d | gunzip | jq '{chart: (.chart|tostring|length), manifest: (.manifest|length), config: (.config|tostring|length)}' | Break down the size of each part to find the bloat source |
helm upgrade … --history-max 5 | Keep at most 5 revisions |
HELM_DRIVER=sql HELM_DRIVER_SQL_CONNECTION_STRING=postgresql://… helm list | Use the SQL driver (all users must be consistent) |
helm uninstall fb -n faults --keep-history | Delete resources, keep history (state uninstalled) |
helm package faultbox && tar -tzvf faultbox-0.1.0.tgz | sort -k3 -n | tail | Find the largest file in the chart |
S=$(kubectl -n faults get secret -l owner=helm,name=fb,status=deployed -o name)
kubectl -n faults get "$S" -o jsonpath='{.data.release}' | base64 -d | base64 -d | gunzip \
| jq '{chart_templates: ([.chart.templates[].data|length]|add), chart_files: ([.chart.files[]?.data|length]|add), values: (.config|tostring|length), manifest: (.manifest|length)}'
{
"chart_templates": 9840,
"chart_files": 1612,
"values": 2,
"manifest": 2730
}
The chart's template and file content inside the release JSON are themselves base64-encoded (in the []byte field), so the values are about 4/3 of the original size. Without jq, use python3 -m json.tool to view the structure.
Lab 6: Create an “oversized release” and fix it (about 5 minutes)
cd ~/helm-lab mkdir -p faultbox/files && head -c 1500000 /dev/urandom > faultbox/files/blob.bin helm upgrade fb ./faultbox -n faults
Error: UPGRADE FAILED: create: failed to create: Secret "sh.helm.release.v1.fb.v21" is invalid: data: Too long: must have at most 1048576 bytes
Are resources modified? No. Writing the pending record (creating the Secret) is the first step before touching the cluster, and it failed, so this is one of the few cases of a “layer ⑦ error with the cluster unchanged”. helm history Also, v21 does not appear.
helm package faultbox -d /tmp >/dev/null && tar -tzvf /tmp/faultbox-0.1.0.tgz | sort -k3 -n | tail -3
-rw-r--r-- 0/0 1923 ... faultbox/templates/deployment.yaml -rw-r--r-- 0/0 2254 ... faultbox/values.yaml -rw-r--r-- 0/0 1500000 ... faultbox/files/blob.bin
echo "files/*.bin" >> faultbox/.helmignore helm upgrade fb ./faultbox -n faults --history-max 5 kubectl -n faults get secret -l owner=helm,name=fb --no-headers | wc -l
Release "fb" has been upgraded. Happy Helming! 5
This upgrade pruned fb's history to 5 revisions (keeping the last deployed one).
yes '{"panel":"cpu","expr":"rate(container_cpu_usage_seconds_total[5m])"}' | head -c 3000000 > faultbox/files/dash.json
helm upgrade fb ./faultbox -n faults && echo "3 MB of repeated text was gzip-compressed to well under 1 MiB"
rm faultbox/files/dash.json
Highly repetitive text compresses extremely well, so it succeeds; real dashboards compress less, so a few dozen of them may hit the limit.
helm install tmp ./faultbox -n faults --set replicaCount=1 helm uninstall tmp -n faults --keep-history helm list -n faults --uninstalled helm rollback tmp 1 -n faults && helm list -n faults | grep tmp helm uninstall tmp -n faults
Case 1: A kube-prometheus-style umbrella chart suddenly cannot be upgraded
Problem: After adding 30 Grafana dashboard JSON files as chart files, the upgrade reports Too long. Approach: Move the dashboards into standalone ConfigMaps loaded from Git by GitOps or a Grafana sidecar, rather than putting them into the chart; or split them into multiple charts. Limitation: Any design that puts large files into a chart stores a copy in every revision.
Case 2: etcd database bloated by Helm history
Problem: CI deploys a preview environment every 10 minutes, with --history-max 0 (unlimited), and after a few months there are tens of thousands of release Secrets. Approach: Restore the default of 10 or lower; a cleanup script deletes old revisions beyond N (keeping deployed); after use, preview environments are helm uninstall.
Case 3: Audit requirements to keep all release records
Problem: Compliance requires that every release be traceable, but there is no wish to bloat etcd. Approach: Evaluate the SQL driver (PostgreSQL): everyone (CI, on-call, GitOps tools) must use the same driver and connection string, otherwise they will see different “worlds”; or keep the default driver and archive the output of helm get all to object storage. Limitation: Support for the SQL driver in GitOps tools (Argo CD does not use release records; Flux helm-controller uses the Helm SDK and its storage configuration) follows each tool's own documentation.
Common errors and fixes
Error: UPGRADE FAILED: create: failed to create: Secret "sh.helm.release.v1.x.vN" is invalid: data: Too long: must have at most 1048576 bytes
Diagnosis:tar -tzvf Find the large files; decode the previous revision and see how much chart/manifest/config each takes. Fix: exclude with .helmignore, split the chart, and move large configuration out of the chart. Prevention: In CI, check the packaged size against the Secret size of the previous revision.
ConfigMap "sh.helm.release.v1.x.vN" is invalid: []: Too long: must have at most 1048576 bytes
Similar errors when using the configmap driver are handled the same way.
Error: unable to instantiate SQL driver: …
Cause:HELM_DRIVER=sql but the connection string is missing or the database is unreachable. Fix: Set HELM_DRIVER_SQL_CONNECTION_STRING; check network and permissions (the first use runs table migrations).
helm list cannot see the release, but the resources are all there
Cause: The current HELM_DRIVER is different from when it was installed (secret ↔ configmap ↔ sql), or the namespace is wrong. Diagnosis:kubectl get secret,cm -A -l owner=helm | grep NAME,helm env.
Error: INSTALLATION FAILED: cannot reuse a name that is still in use (--keep-history was used before)
Fix:helm install --replace,helm rollback to restore, or helm uninstall (without keep-history) to delete the history completely.
1. Count the number of Helm release Secrets in each namespace of the cluster.
kubectl get secret -A -l owner=helm --no-headers | awk '{print $1}' | sort | uniq -c | sort -rn2. Decode the latest revision of fb and list the chart file names it contains.
V=$(helm history fb -n faults -o json | jq '.[-1].revision')
kubectl -n faults get secret sh.helm.release.v1.fb.v$V -o jsonpath='{.data.release}' \
| base64 -d | base64 -d | gunzip | jq -r '.chart.files[]?.name, .chart.templates[].name'The team wants to switch the release driver to configmap, “because the number of Secrets hurts the readability of kubectl get secret”. Your opinion?
Object. The configmap driver does not change the size limit, but it lets anyone with ConfigMap read permission decode the passwords in values (RBAC is usually stricter for Secrets, and encryption at rest is often configured only for Secrets). Solve the readability problem with label filtering: kubectl get secret --field-selector type!=helm.sh/release.v1.
Verified instructional videos
No verified video specifically explaining Helm release storage and the 1 MiB limit was found. The introductory video below covers the concept of release records:
Official documentation
- Advanced Helm Techniques · Storage backends
- Kubernetes Secret · Size limit (1 MiB)
- helm uninstall (--keep-history)
Video storyboard (about 80 seconds)
Visual: one revision is split into the chart, values and manifest blocks, which pass in turn through the JSON, gzip and base64 stages.
Narration: each revision is a complete snapshot; after compression and encoding it is stored in one Secret.
Visual: a random binary file passes through gzip and barely shrinks; the Secret capacity bar turns red and “Too long” pops up.
Narration: a file that is already compressed cannot be compressed again, so it easily exceeds the one-megabyte limit.
Visual: .helmignore blocks the large file; on the timeline old revisions are pruned, while the card for the deployed one is always kept.
Narration: use helmignore to control the size of a single revision, and history-max to control the total number.
Module 7 · Migrating from Helm 3 to Helm 4
- List the Helm 4 changes that affect CI scripts:
--atomic→--rollback-on-failure,--force→--force-replace(old names still work with a warning),--waitbecomes strategy-based (hookOnly/watcher/legacy),--dry-runaccepted values,helm template --validateis deprecated, post-renderer must be a plugin,helm registry loginregistry login only accepts domain names, and plugin installation verifies signatures by default. - Understand the Helm 4 plugin system: plugin types
cli/v1,getter/v1,postrenderer/v1, runtimesubprocessand Wasm (extism/v1); legacy-format plugins still load. - Check compatibility for CI and GitOps tools (Argo CD, Flux, Ansible kubernetes.core, Terraform helm provider), and produce a migration checklist and timeline (Helm 3's last feature release, 3.22, on 2026-09-09; security fixes until 2027-02-10).
What: change overview (verified against the v4.3.2 source and the helm.sh Helm 4 Overview)
| Area | Helm 3 | Helm 4.3 | Impact on scripts |
|---|---|---|---|
| Rollback on failure | --atomic | --rollback-on-failure; --atomic still works, printing Flag --atomic has been deprecated, use --rollback-on-failure instead | works; renaming is recommended; note that it implicitly --wait=watcher |
| force replace | --force | --force-replace (--force is deprecated); new --force-conflicts (SSA), mutually exclusive with | still runs; semantics unchanged (delete and recreate) |
| Wait | --wait boolean; legacy readiness check | --wait = watcher (kstatus); --wait=hookOnly (default when omitted); --wait=legacy; --wait=true/false is deprecated with a warning | Readiness criteria changed: CRD resources that have standard conditions are also waited on |
| Apply method | Client-side three-way merge | New installs default to SSA; existing releases follow their record (auto) | New conflict errors may appear (Module 4) |
| dry-run | --dry-run (= client),--dry-run=server | none|client|server; without a value, it is treated as client with a warning | explicitly write the value |
| template validation | helm template --validate | deprecated, suggests using --dry-run=server | replace |
| post-renderer | --post-renderer ./kustomize.sh (executable path) | --post-renderer <plugin name>, plugin type postrenderer/v1; --post-renderer-args argument passing | breaking: old scripts fail outright |
| Plugin | plugin.yaml + executable | New plugin format (apiVersion: v1,type,runtime: subprocess|extism/v1); old format still loads; helm plugin install default --verify=true | Installing a plugin from a Git repository URL requires --verify=false |
| registry login | a full URL can be written | only accepts domain names (host[:port]) | remove oci:// and the path |
| helm status | --show-resources,--show-desc | v4.3.2's helm status defines only --revision (and common output parameters); DESCRIPTION always shows | delete these two parameters (based on helm status --help ) |
| installation scripts / SDK | get-helm-3; helm.sh/helm/v3 | get-helm-4; Go module helm.sh/helm/v4 | update images and dependencies |
| Chart | apiVersion v2 | apiVersion v2 is unchanged (v3 still needs HELM_EXPERIMENTAL_CHART_V3) | The chart does not need to change |
Why: why migrate now
Helm official blog (Helm 3 End of Life): Helm 3's bug fixes end with its last feature release 3.22 (2026-09-09) ends; security fixes continue until 2027-02-10 (extended from the originally planned 2026-11). After that, Helm 3 gets no CVE fixes. Today (2026-11) is about 3 months before the cutoff, and the following must be completed: tool image upgrades, script parameter corrections, post-renderer plugin conversion, GitOps tool compatibility confirmation, and (optionally) migration of existing releases to SSA.
How: the three strategies of --wait
| Form | Strategy | Behavior |
|---|---|---|
| Not written | hookOnly | waits only for hooks (same as Helm 3 when --wait is not written) |
--wait or --wait=watcher | kstatus observation | judges Current based on the resource's status/conditions; error messages include the resource and status |
--wait=legacy | Helm 3 readiness check | For transition use; behavior matches Helm 3's --wait closely. |
--rollback-on-failure | Defaults to watcher when --wait is not specified | On failure, rolls back to the most recent deployed/superseded revision (for install, uninstalls) |
When: post-renderer plugin conversion example
apiVersion: v1
type: postrenderer/v1
name: kustomize-pr
version: 0.1.0
runtime: subprocess
runtimeConfig:
platformCommand:
- command: "${HELM_PLUGIN_DIR}/run.sh"
#!/usr/bin/env sh # Read the rendered output from stdin and output the modified manifests cat > "$HELM_PLUGIN_DIR/all.yaml" kubectl kustomize "$HELM_PLUGIN_DIR"
The plugin directory location follows helm env HELM_PLUGINS ; it can also be placed in any directory, then helm plugin install ./kustomize-pr (installation from a local directory is treated as development mode, and signatures are not verified). For field details, follow Migrate v3 Plugins to Helm 4 and HIP-0026.
--rollback-on-failure,--force-replace are Helm 4 parameters; a script that must support both versions needs version branching. ③ “Upgrading the helm binary automatically switches releases to SSA” — no (Module 4). ④ “Wasm plugins are required” — old subprocess plugins keep working; Wasm is an optional runtime.Migration roadmap
Interactive: CI script migration scanner
Paste your Helm 3-era CI scripts (or use the example) and click scan. The scanner gives each line a risk level and modification suggestion based on the v4.3.2 parameter definitions (a regex-based teaching tool; it cannot replace actually running under Helm 4).
Core commands
| Helm 3 syntax | Helm 4.3 syntax |
|---|---|
helm upgrade --install x c --atomic --timeout 10m | helm upgrade --install x c --rollback-on-failure --wait=watcher --timeout 10m |
helm upgrade x c --force | helm upgrade x c --force-replace (or when SSA conflicts --force-conflicts) |
helm upgrade x c --wait=true | helm upgrade x c --wait (= watcher), or during the transition period --wait=legacy |
helm install x c --dry-run | helm install x c --dry-run=client or =server |
helm template x c --validate | helm install x c --dry-run=server |
--post-renderer ./kustomize.sh | --post-renderer kustomize-pr (plugin name) |
helm registry login oci://reg.example.com/charts | helm registry login reg.example.com |
helm plugin install https://github.com/databus23/helm-diff | same as above, and add --verify=false (Git sources do not support signature verification), or switch to a tarball / OCI source with a .prov file |
helm status x --show-resources | helm status x (for resources use kubectl get all -l app.kubernetes.io/instance=x) |
curl … get-helm-3 | bash | curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-4 | bash |
# Wrapper function compatible with two major versions (for use during the transition)
helm_deploy() {
local major; major=$(helm version --template '{{.Version}}' | sed -E 's/^v([0-9]+).*/\1/')
if [ "$major" -ge 4 ]; then
helm upgrade --install "$@" --rollback-on-failure --wait=watcher
else
helm upgrade --install "$@" --atomic --wait
fi
}
helm_deploy fb ./faultbox -n faults --timeout 5m
Lab 7: Side-by-side comparison of Helm 3 and Helm 4 (about 7 minutes)
cd ~/helm-lab helm upgrade fb ./faultbox -n faults --atomic --timeout 2m 2>&1 | head -3 helm upgrade fb ./faultbox -n faults --force --dry-run=server 2>&1 | head -2 helm upgrade fb ./faultbox -n faults --wait=true --timeout 2m 2>&1 | grep -i deprecated helm install x ./faultbox --dry-run 2>&1 | grep -i deprecated
Flag --atomic has been deprecated, use --rollback-on-failure instead Release "fb" has been upgraded. Happy Helming! ... Flag --force has been deprecated, use --force-replace instead ... level=WARN msg="--wait=true is deprecated (boolean value) and can be replaced with --wait=watcher" ... level=WARN msg="--dry-run is deprecated and should be replaced with '--dry-run=client'"
printf '#!/bin/sh\ncat\n' > /tmp/pr.sh && chmod +x /tmp/pr.sh helm template fb ./faultbox --post-renderer /tmp/pr.sh >/dev/null
Error: invalid argument "/tmp/pr.sh" for "--post-renderer" flag: plugin: {Name:/tmp/pr.sh Type:postrenderer/v1} not found
The exact error format follows the actual output; the key point is that Helm 4 looks up the argument as a plugin name.
mkdir -p /tmp/add-label
cat > /tmp/add-label/plugin.yaml <<'EOF'
apiVersion: v1
type: postrenderer/v1
name: add-label
version: 0.1.0
runtime: subprocess
runtimeConfig:
platformCommand:
- command: "${HELM_PLUGIN_DIR}/run.sh"
EOF
cat > /tmp/add-label/run.sh <<'EOF'
#!/bin/sh
sed 's/^ labels:$/ labels:\n migrated-by: helm4-post-renderer/'
EOF
chmod +x /tmp/add-label/run.sh
helm plugin install /tmp/add-label
helm plugin list
helm template fb ./faultbox --post-renderer add-label | grep -c migrated-by
Installing plugin from local directory (development mode) Installed plugin: add-label NAME VERSION TYPE APIVERSION PROVENANCE SOURCE add-label 0.1.0 postrenderer/v1 v1 ... ... 4
helm plugin list 's columns follow the actual output. The sed \n substitution requires GNU sed.
helm plugin install https://github.com/databus23/helm-diff
Error: plugin source does not support verification. Use --verify=false to skip verification
Decide whether to trust the source before using it --verify=false; the compatibility of this plugin with Helm 4 follows its release notes.
~/bin/helm3 template fb ./faultbox > /tmp/h3.yaml helm template fb ./faultbox > /tmp/h4.yaml diff /tmp/h3.yaml /tmp/h4.yaml && echo "Rendered output is identical" ~/bin/helm3 install h3rel ./faultbox -n faults helm get metadata h3rel -n faults | grep APPLY_METHOD helm upgrade h3rel ./faultbox -n faults --server-side=true helm get metadata h3rel -n faults | grep APPLY_METHOD helm uninstall h3rel -n faults
Rendered output is identical APPLY_METHOD: client-side apply (defaulted) APPLY_METHOD: server-side apply
If rendering differs, the common cause is a change in Sprig functions (Helm 4 removed env/expandenv) or .Capabilities different default values.
Case 1: Helm versions in GitOps tools
Problem: The team upgraded CI to Helm 4, but Argo CD (v3.6.1) and Flux (v2.10.0) each embed their own Helm library, independent of the CLI version. Approach: Check the release notes of Argo CD and Flux helm-controller separately to confirm their Helm library version, post-renderer support, and SSA behavior (Argo CD uses helm template to render and then applies on its own, without reading or writing Helm release records; Flux uses the Helm SDK and maintains release records). Limitation: This lesson has not verified the specific Helm version built into each; refer to their own documentation.
Case 2: Ansible and Terraform
Problem: In an Ansible playbook, kubernetes.core.helm uses atomic: true. Approach: kubernetes.core 6.6.0, on detecting Helm 4, maps atomic to --rollback-on-failure (already verified in other lessons of this repository); the Terraform helm provider uses the embedded Helm SDK, and whether it has switched to the Helm 4 SDK follows the provider's release notes.
Case 3: Conflict wave on migration day
Problem: To “unify”, all releases were switched at once with --server-side=true, and on Monday morning there were a large number of conflicts. Approach: Separate the binary upgrade from the SSA migration: first upgrade Helm (releases remain CSA, behavior unchanged); once stable, use --dry-run=server --server-side=true to rehearse each application before migrating it.
Common errors and fixes
Error: invalid argument "./kustomize.sh" for "--post-renderer" flag: plugin: … not found
Cause: Helm 4 only accepts plugin names. Fix: Wrap the script as a postrenderer/v1 plugin and install it.
Error: plugin source does not support verification. Use --verify=false to skip verification
Cause:helm plugin install Verification is on by default, but Git repositories and non-tarball HTTP sources are not supported. Fix: Use a tarball with provenance or an OCI source; once you have confirmed it is trusted, --verify=false.
Error: unknown flag: --show-resources
Cause: v4.3.2's helm status does not have this flag. Fix: Delete the flag and use kubectl to query resources by app.kubernetes.io/instance label.
Error: invalid wait input "yes". Valid inputs are watcher, hookOnly, and legacy
Cause:--wait It is now a strategy string (true/false are still compatible but emit a warning). Fix: Use --wait or --wait=watcher.
Under Helm 4, upgrading “waits” longer than Helm 3 or fails early
Cause: kstatus judges resources differently from legacy (for example, it considers the conditions of more resource types). Diagnosis: The resource and status in the error message. Fix: Correct the resource status; during the transition period you can --wait=legacy compare.
Error: login attempt to https://reg.example.com/charts failed …(registry login included a path)
Fix:helm registry login reg.example.com, write only the domain (a port may be included).
1. Find all Helm 3 syntax that needs to change in every script in the repository.
grep -rnE -- '--atomic|--force( |$)|--wait=(true|false)|--dry-run( |$)|--validate|--post-renderer +[./]|--show-resources|--show-desc|get-helm-3' \ .github/ .gitlab-ci.yml ci/ scripts/ 2>/dev/null
2. Confirm the major Helm version in the current CI image, and print the types of all installed plugins.
helm version --template '{{.Version}}{{"\n"}}'
helm plugin listYou are responsible for migrating 40 microservices from Helm 3 to Helm 4, with a deadline before 2027-02-10. Write out your phased plan and rollback plan.
Phase 1 (inventory, 1 week): scan script parameters, post-renderers, plugins, GitOps tool versions, and SDK users; count each release's APPLY_METHOD. Phase 2 (dual run, 2 weeks): run helm3 and helm4 in parallel in CI for the template and diff them; modify scripts (version-branching wrapper functions); convert post-renderers to plugins. Phase 3 (cut over, in batches by service): switch the CI image to Helm 4 and keep releases on CSA; observe for 2 weeks. Phase 4 (optional SSA migration): migrate one by one after --dry-run=server --server-side=true rehearsal and resolving conflicts. Rollback: Helm 4 does not change the release storage format (it is still helm.sh/release.v1), and the Helm 3 binary can continue to read it; but a release already migrated to SSA, when rolled back to Helm 3, will be updated with CSA, so field ownership must be watched.
Verified instructional videos
Official documentation
- Helm 4 Overview
- Helm 4 Released (blog)
- Helm 3 End of Life (blog)
- Migrate v3 Plugins to Helm 4
- HIP-0026 plugin system
Video storyboard (about 90 seconds)
Visual: timeline showing the last feature release, Helm 3.22, and the security-fix cutoff on February 10, 2027, with a red countdown.
Narration: Helm 3's security fixes end on February 10, 2027.
Visual: in the CI script, --atomic and --force are crossed out and replaced with --rollback-on-failure and --force-replace, with a yellow warning appearing beside them.
Narration: the old parameters still work but emit warnings; it is advisable to rename them now.
Visual: the post-renderer's sh script is packed into a plugin box labeled postrenderer/v1.
Narration: post-renderers must become plugins; this is the most common breaking change.
Visual: checklist items are ticked off one by one.
Narration: inventory, update scripts, convert to plugins, dual-run verification, cut over in batches.
Module 8 · Mixed Fault Blind Box
- Without knowing the fault type in advance, complete the diagnosis following “symptom → layer → evidence → root cause → fix → prevention”.
- Cover 8 faults: stuck releases, failed hooks, SSA conflicts, selector changes, CRDs not updated, oversized releases, unexpected values merging, and Helm 3 parameter differences under Helm 4.
- After each fix, be able to state one preventive measure (a CI check, chart convention or process).
What: overview of the 8 faults
| # | Fault | First symptom | Layer | Key evidence | Fix | Prevention |
|---|---|---|---|---|---|---|
| 1 | Stuck release | another operation (install/upgrade/rollback) is in progress | ⑦ | helm history Last line pending-upgrade | rollback to the last deployed | CI timeout > Helm timeout; serialize |
| 2 | Failed hook (no evidence) | pre-upgrade hooks failed, the Job no longer exists | ⑤ | helm get hooks in hook-failed policy; events | add output-log-policy and rerun, fix the script | default before-hook-creation,hook-succeeded |
| 3 | SSA conflict | Apply failed with 1 conflict: conflict with "ops-hotfix" | ⑤ | managedFields | write back to values, or --force-conflicts | ban manual edits; HPA fields are not rendered |
| 4 | Selector change | spec.selector: Invalid value … field is immutable | ⑤ | helm get manifest before/after diff | revert the selector change; when it must change, --force-replace (interrupt) or blue-green with a new name | selector helper is never modified |
| 5 | CRD not updated | new CR field reports unknown field or is pruned | ④ | kubectl get crd -o yaml and crds/ compared | kubectl apply --server-side -f crds/ , then upgrade | manage CRDs independently |
| 6 | Oversized release | data: Too long: must have at most 1048576 bytes | ⑦ | tar -tzvf largest file | .helmignore | check package size in CI |
| 7 | Unexpected values merge | upgrade “succeeds”, but replica count and annotations revert to defaults | ② | helm get values --revision before/after comparison | always pass the complete -f; or --reset-then-reuse-values | keep the values files in Git; forbid using only --set |
| 8 | Helm 3 parameter differences | deprecation warning + --post-renderer plugin not found | ①③ | stderr warning, script | rename + convert to plugin | include the migration scan in CI |
Why: the mechanism of fault 7 (the easiest to overlook)
v4.3.2 Upgrade.reuseValues: if this does not provide any values (without -f, no --set), Helm automatically reuses the user values from the previous revision; as soon as any one of --set is provided, the previous user values are no longer used at all; rendering uses the chart defaults plus this run's parameters. --reuse-values will reuse the previous values, but at the same time replace the chart defaults with those of the old chart (defaults newly added in the new chart version will not take effect); --reset-then-reuse-values Using the new chart defaults and overlaying the previous user values is usually the intended semantics.
How: diagnostic cadence (≤ 3 minutes per fault)
- Read the full error message and determine the layer (Module 1).
helm history+helm get metadata: what state is the release in?- Gather evidence: events / managedFields / get values / get manifest / tar listing.
- Fix and verify:
helm historyThe last line is deployed, and the resources match expectations. - Write one line of prevention.
--force-replace just”—it deletes and recreates the Deployment, which causes a brief outage and makes all Pods restart at the same time. ② “Fault 7 is a Helm bug” — it is a documented behavior. ③ “Fault 5 can be fixed by reinstalling to update the CRD” — CRDs already present in crds/ are skipped even on install.Where the 8 faults sit in the seven-layer model
Interactive: in-browser fault blind box simulator
Click “Draw a fault”; you will only see the symptoms that appear in the CI log. Select diagnostic commands to view their output, then judge the root cause; a correct answer reveals the fix steps. Scores are saved in this browser.
fault-box.sh: inject faults randomly on kind
Save as ~/helm-lab/fault-box.sh,chmod +x. Requires Module 0 to be completed (faultbox chart, release fb, namespace faults). The script modifies ~/helm-lab/faultbox, and on first run backs it up to faultbox.orig.
#!/usr/bin/env bash
# Lesson 7 mixed fault blind box: ./fault-box.sh random | N | reveal | reset
set -uo pipefail
NS=faults; REL=fb; LAB=~/helm-lab; CH=$LAB/faultbox; ANS=$LAB/.faultbox-answer
[ -d "$LAB/faultbox.orig" ] || cp -r "$CH" "$LAB/faultbox.orig"
restore_chart() { rm -rf "$CH" && cp -r "$LAB/faultbox.orig" "$CH"; }
base() {
restore_chart
LAST=$(helm history $REL -n $NS -o json 2>/dev/null | jq -r '[.[]|select(.status=="deployed")][-1].revision // empty')
if helm history $REL -n $NS --max 1 2>/dev/null | grep -q pending; then helm rollback $REL "$LAST" -n $NS --wait >/dev/null; fi
helm upgrade --install $REL "$CH" -n $NS --reset-values --force-conflicts --wait --timeout 3m >/dev/null
kubectl -n $NS delete job -l app.kubernetes.io/instance=$REL --ignore-not-found >/dev/null
kubectl -n $NS delete widget --all --ignore-not-found >/dev/null 2>&1
}
f1() { # Stuck release: SIGKILLed while waiting
helm upgrade $REL "$CH" -n $NS --set image.tag=does-not-exist --wait --timeout 10m >/dev/null 2>&1 &
local p=$!; sleep 8; kill -9 $p 2>/dev/null; wait $p 2>/dev/null
echo 'helm upgrade fb ~/helm-lab/faultbox -n faults --set replicaCount=2' > $LAB/next.sh; }
f2() { # Failed hook, deletion policy hook-failed
cat > $LAB/next.sh <<'EOF'
helm upgrade fb ~/helm-lab/faultbox -n faults --set hook.enabled=true,hook.fail=true,hook.deletePolicy=hook-failed --timeout 90s
EOF
}
f3() { # SSA conflict
kubectl -n $NS patch deploy $REL-faultbox --field-manager=ops-hotfix --type=merge -p '{"spec":{"replicas":3}}' >/dev/null
echo 'helm upgrade fb ~/helm-lab/faultbox -n faults' > $LAB/next.sh; }
f4() { # Selector change
sed -i '/define "faultbox.selectorLabels"/a tier: web' "$CH/templates/_helpers.tpl"
echo 'helm upgrade fb ~/helm-lab/faultbox -n faults' > $LAB/next.sh; }
f5() { # CRD not updated: the chart's crds/ added a color field, and the templates start using it
sed -i 's/size: {type: integer}/size: {type: integer}\n color: {type: string}/' "$CH/crds/widgets.yaml"
echo 'helm upgrade fb ~/helm-lab/faultbox -n faults --set widget.enabled=true,widget.color=blue' > $LAB/next.sh; }
f6() { # Oversized release
mkdir -p "$CH/files" && head -c 1500000 /dev/urandom > "$CH/files/archive.dat"
echo 'helm upgrade fb ~/helm-lab/faultbox -n faults' > $LAB/next.sh; }
f7() { # Unexpected values merge: production values were installed with -f, and later someone upgraded with only --set
printf 'replicaCount: 3\npodAnnotations:\n team: payments\n' > $LAB/prod-values.yaml
helm upgrade $REL "$CH" -n $NS -f $LAB/prod-values.yaml --wait >/dev/null
echo 'helm upgrade fb ~/helm-lab/faultbox -n faults --set image.tag=1.16.0 --wait' > $LAB/next.sh; }
f8() { # Deployment script from the Helm 3 era
printf '#!/bin/sh\ncat\n' > $LAB/add-label.sh; chmod +x $LAB/add-label.sh
echo 'helm upgrade fb ~/helm-lab/faultbox -n faults --atomic --force --wait=true --timeout 2m --post-renderer ~/helm-lab/add-label.sh' > $LAB/next.sh; }
case "${1:-random}" in
reset) base; rm -f $ANS $LAB/next.sh; echo "Reset to clean baseline";;
reveal) echo "Injected fault number this round: $(cat $ANS 2>/dev/null || echo none)";;
random|[1-8])
base
n=${1:-random}; [ "$n" = random ] && n=$(( RANDOM % 8 + 1 ))
echo $n > $ANS; f$n
echo "Fault injected. Run the deploy command below and start diagnosing:"; cat $LAB/next.sh;;
*) echo "Usage: $0 random|1..8|reveal|reset"; exit 1;;
esac
The script uses GNU sed and jq. reset Restores the chart, clears pending, forcibly takes back fields and deletes the hook Job. After fault 5 is injected, even after reset the CRD in the cluster may still keep the color field (adding an optional field is harmless).
Lab 8: Blind box drill (about 3 minutes per round, at least 4 rounds)
cd ~/helm-lab && chmod +x fault-box.sh ./fault-box.sh random bash next.sh
Fault injected. Run the deploy command below and start diagnosing: helm upgrade fb ~/helm-lab/faultbox -n faults Error: UPGRADE FAILED: ...
helm history fb -n faults --max 4 helm get metadata fb -n faults | grep -E 'STATUS|APPLY_METHOD' kubectl -n faults get events --sort-by=.lastTimestamp | tail -5 kubectl -n faults get deploy,job,widget 2>/dev/null
helm get values fb -n faults --revision $(( $(helm history fb -n faults -o json | jq '.[-1].revision') - 1 ))
kubectl -n faults get deploy fb-faultbox -o json | jq -r '.metadata.managedFields[] | "\(.manager) \(.operation)"'
helm get hooks fb -n faults | grep -E 'hook|policy'
kubectl get crd widgets.lab.example.com -o jsonpath='{.spec.versions[0].schema.openAPIV3Schema.properties.spec.properties}{"\n"}'
helm package faultbox -d /tmp >/dev/null 2>&1; tar -tzvf /tmp/faultbox-0.1.0.tgz | sort -k3 -n | tail -2./fault-box.sh reveal verify the number, follow the fix column on the Theory page, and confirm helm history the last line is deployed, then ./fault-box.sh reset move on to the next round.Round | Symptom (one sentence) | Layer identified | Key evidence command | Root cause | Fix | Prevention | Time spent 1 | | | | | | | 2 | | | | | | |
Case 1: One release stacked three faults
Problem: A release that changed the selector label (#4) was run under --wait --timeout 20m , and the CI job hit the 15-minute timeout and was force-killed (#1); the on-call engineer used --set to retry with only the image changed (#7). Approach: First unlock (roll back to the last deployed), then use the complete values file to revert the selector change. Lesson: When multiple faults stack, handle them layer by layer from the bottom up (⑦ → ⑤ → ②).
Case 2: The selector “must” change
Problem: Compliance requires a unified labeling scheme, so the Deployment selector must be changed. Approach: Do not change it on the original release; deploy a new Deployment under a new fullname (with the new selector), let the Service selector temporarily match both the old and new labels during the transition, and delete the old Deployment after traffic is switched. Limitation: Requires the chart to support fullnameOverride, and temporarily doubles resources.
Case 3: Turning the blind box into new-hire training
Approach: The platform team randomly injects one fault per week in a shared kind environment; new members diagnose within a time limit, and post-mortem records are accumulated into a question bank for Lesson 8. Effect: The average time to “locate the layer” during real incidents was noticeably reduced (self-reported by the team, not quantitatively verified).
Interactive troubleshooting tree: deep Helm faults
Choose step by step starting from the symptom you see; leaf nodes give the diagnostic commands and fixes.
1. Compare the user values of the last two revisions of fb, and determine whether an “unexpected values merge” occurred.
N=$(helm history fb -n faults -o json | jq '.[-1].revision') diff <(helm get values fb -n faults --revision $((N-1))) <(helm get values fb -n faults --revision $N)
2. Before upgrading, check whether the CRDs match the chart's crds/.
kubectl diff --server-side -f ~/helm-lab/faultbox/crds/
The upgrade reports spec.selector field is immutable. A colleague says “just add --force-replace”. Evaluate this and give your plan.
--force-replace It deletes and recreates the Deployment: all old Pods are deleted, new Pods start from zero, and the service is unavailable in the meantime (a PDB does not protect against deleting the whole Deployment). First confirm why the selector changed (most often a helper was changed by mistake or a label changed due to a chart upgrade), and revert it if possible. If it truly must change, use a new name with parallel deployment and Service cutover, or accept the downtime within a maintenance window and then use force-replace.
Verified instructional videos
Official documentation
- Best Practices · CRDs
- Best Practices · Labels (selector labels)
- helm upgrade (--reuse-values, --reset-then-reuse-values)
Video storyboard (about 90 seconds)
Visual: a blind box opens, 8 fault cards spin and stop on one, and its face shows only the error message.
Narration: look only at the symptoms, not the answer.
Visual: the terminal runs helm history, get metadata and kubectl events in turn; the evidence cards are flipped over one by one.
Narration: first determine the layer, then collect evidence with the standard diagnostic kit.
Visual: after the fix, the last line of history turns green, and the notebook table gets one line of prevention written in it.
Narration: every fix must leave one preventive measure behind.
Command cheat sheet
helm upgrade REL CHART -n NS --debug 2>debug.log helm template REL CHART --debug -s templates/x.yaml helm upgrade REL CHART -n NS --dry-run=server --hide-secret helm get all REL -n NS --revision N helm get values REL -n NS --all helm get metadata REL -n NS # STATUS / APPLY_METHOD kubectl -n NS get events --sort-by=.lastTimestamp
helm list -A --pending helm history REL -n NS kubectl -n NS get secret -l owner=helm,name=REL -L status,version,createdAt helm rollback REL <last deployed> -n NS --wait helm uninstall REL -n NS # only for v1 pending-install # Last resort (back up first): kubectl -n NS get secret sh.helm.release.v1.REL.vN -o yaml > bak.yaml
"helm.sh/hook": pre-upgrade "helm.sh/hook-weight": "0" "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded "helm.sh/hook-output-log-policy": hook-failed
helm get hooks REL -n NS kubectl -n NS logs job/HOOKJOB helm upgrade … --timeout 10m # per operation / per hook helm upgrade … --no-hooks # risk: skips migrations
kubectl get deploy X -o yaml --show-managed-fields
kubectl get deploy X -o json | jq '.metadata.managedFields[]|{manager,operation,subresource}'
helm upgrade … --force-conflicts # take over conflicting fields
helm upgrade … --server-side=true # CSA → SSA migration
helm upgrade … --server-side=false # explicit CSA
helm upgrade … --force-replace # delete and recreate (mutually exclusive with --force-conflicts){{ required "x is required" .Values.x }}
{{ fail (toYaml .) }} # dump context
# DEBUG {{ $v | toJson }}
{{ printf "%T" .Values.n }} # int64 / float64 / string
helm template … --output-dir out/ time helm template … HELM_PPROF_CPU_PROFILE=cpu.out helm template … ; go tool pprof -top cpu.out
kubectl -n NS get secret sh.helm.release.v1.REL.vN -o jsonpath='{.data.release}' \
| base64 -d | base64 -d | gunzip | jq 'keys'
helm upgrade … --history-max 5 # default 10 (HELM_MAX_HISTORY)
HELM_DRIVER=sql HELM_DRIVER_SQL_CONNECTION_STRING=postgresql://… helm list
helm uninstall REL -n NS --keep-history
helm list -n NS --uninstalled| Helm 3 | Helm 4.3 |
|---|---|
--atomic | --rollback-on-failure |
--force | --force-replace |
--wait (boolean) | --wait[=watcher|hookOnly|legacy] |
--dry-run | --dry-run=client|server |
template --validate | --dry-run=server |
--post-renderer ./x.sh | --post-renderer PLUGIN |
registry login oci://h/p | registry login h |
status --show-resources | (removed) |
get-helm-3 | get-helm-4 |
| Form | Previous user values | chart defaults |
|---|---|---|
| Pass no values | reuse | new chart |
--set / -f | discard | new chart |
--reuse-values | reuse | old chart |
--reset-then-reuse-values | reuse | new chart |
--reset-values | discard | new chart |
Comprehensive lab + final quiz
You are the on-call engineer for the platform team. The company plans to migrate all release pipelines from Helm 3 to Helm 4 before 2027-02-10, and wants on-call staff to handle common Helm faults within 10 minutes. Please, in the kind cluster lab 's faults namespace, using fault-box.sh inject faults 1–8 in turn; for each fault, complete “diagnose → fix → prevent”, and finally submit two deliverables: fault diagnosis record table and Helm 3 → 4 migration checklist.
~/helm-lab/fault-box.sh.
cd ~/helm-lab && chmod +x fault-box.sh && ./fault-box.sh reset helm history fb -n faults --max 1
./fault-box.sh 1 && bash next.sh # expected: another operation … in progress # Diagnose + fix: history → rollback to last deployed → re-run next.sh successfully ./fault-box.sh 2 && bash next.sh # expected: pre-upgrade hooks failed, Job no longer exists # Fix: add --set hook.outputLogPolicy=hook-failed and rerun to get the logs → hook.fail=false
./fault-box.sh 3 && bash next.sh # expected: conflict with "ops-hotfix" … .spec.replicas ./fault-box.sh 4 && bash next.sh # expected: spec.selector … field is immutable # Fix 4: revert the changes to _helpers.tpl (diff -r faultbox faultbox.orig)
./fault-box.sh 5 && bash next.sh # expected: unknown field "spec.color" (or the field is pruned)
kubectl apply --server-side -f ~/helm-lab/faultbox/crds/ && bash next.sh
kubectl -n faults get widget fb-faultbox -o jsonpath='{.spec.color}{"\n"}' # blue
./fault-box.sh 6 && bash next.sh # expected: data: Too long./fault-box.sh 7 && bash next.sh # expected: succeeds, but the replica count reverts to 1 and annotations disappear
kubectl -n faults get deploy fb-faultbox -o jsonpath='{.spec.replicas}{"\n"}'
helm upgrade fb ~/helm-lab/faultbox -n faults -f ~/helm-lab/prod-values.yaml --set image.tag=1.16.0 --wait
./fault-box.sh 8 && bash next.sh # expected: deprecation warning + post-renderer plugin not found# Helm 3 → 4 Migration Checklist (deadline: 2027-02-10, end of Helm 3 security fixes) ## A. Tools and images - [ ] Upgrade helm in the CI image / runner to v4.3.x (get-helm-4 or package manager); record the version - [ ] Upgrade developer machines and ops jump hosts in sync; keep the helm3 binary only for comparison - [ ] Go programs depending on helm.sh/helm/v3 → evaluate helm.sh/helm/v4 ## B. Script parameters - [ ] --atomic → --rollback-on-failure (note that it implicitly sets --wait=watcher) - [ ] --force → --force-replace; confirm whether delete-and-recreate is really needed - [ ] --wait=true/false → --wait / --wait=hookOnly; evaluate kstatus judgment differences (use --wait=legacy as a transition if necessary) - [ ] Bare --dry-run → --dry-run=client or --dry-run=server - [ ] helm template --validate → helm install/upgrade --dry-run=server - [ ] helm status --show-resources/--show-desc → remove - [ ] helm registry login: write only the domain ## C. Plugins - [ ] --post-renderer executable → postrenderer/v1 plugin (pass arguments with --post-renderer-args) - [ ] helm plugin install: confirm whether the source supports signature verification; Git sources need --verify=false, and trust must be evaluated - [ ] Helm 4-compatible versions of third-party plugins (diff, secrets, etc.) ## D. Apply method (SSA) - [ ] Inventory APPLY_METHOD of all releases (helm get metadata) - [ ] New installs default to SSA: check whether the chart still renders replicas when HPA is enabled - [ ] Migration plan for existing releases: rehearse with --dry-run=server --server-side=true → resolve conflicts → migrate - [ ] On-call manual: handling SSA conflicts (write back to values / --force-conflicts) ## E. GitOps and IaC tools - [ ] Helm version bundled in Argo CD (currently v3.6.1) and post-renderer support - [ ] Helm SDK version and SSA behavior of the Flux (currently v2.10.0) helm-controller - [ ] Ansible kubernetes.core ≥ 6.6.0 (atomic maps to --rollback-on-failure) - [ ] Helm SDK version used by the Terraform helm provider ## F. Operations safeguards - [ ] CI job timeout > Helm --timeout (including hooks); serialize releases for the same release - [ ] On the failure branch, automatically collect helm history / get all / kubectl events - [ ] Use before-hook-creation,hook-succeeded and hook-output-log-policy: hook-failed uniformly for hooks - [ ] Unify --history-max settings; monitor the number and size of release Secrets - [ ] Dual run: the diff of template output between helm3 and helm4 is empty (or the differences are explained)
./fault-box.sh reset helm uninstall fb -n faults kubectl delete namespace faults kubectl delete crd widgets.lab.example.com helm plugin uninstall add-label 2>/dev/null; rm -rf ~/helm-lab/faultbox.orig
Open-ended self-test
1. Why can't Helm automatically clear the pending state?
Helm has no persistent server-side component, so it cannot tell whether the “lock-holding process” is alive or dead; automatic clearing could conflict with an upgrade that is still running. Recovery must therefore be performed by a person (or by CI that guarantees serialization) after confirming there is no concurrency, by running rollback.
2. Between SSA conflicts and CSA's “silent overwrite”, which is safer? Why do some people still find SSA troublesome?
SSA is safer: it exposes the fact that multiple managers declare the same field at the same time. It feels troublesome because drift that CSA used to hide is exposed all at once during migration, and that needs one round of governance.
3. In what situations does helm upgrade report an error even though the cluster has already been modified? Give two examples.
A post-upgrade hook fails (resources have already been applied); --wait times out (resources have been applied but are not yet ready); while SSA applies multiple resources, one conflicts partway through (earlier resources have already been updated). In these cases the revision is failed, and you must decide whether to roll back or to fix and upgrade again.
4. How can you detect an “oversized release” early in CI?
Check the .tgz size and the largest files after packaging. The memory driver or dry-run cannot detect the Secret limit, so in a pre-production environment you can decode the previous revision, compute the base64 size, and set a threshold (for example, alert at 700 KiB).
5. Which Helm 4 defaults would you write into the team standard?
explicit --wait=watcher and reasonable --timeout; --rollback-on-failure depending on the scenario; --history-max; --dry-run=server for merge-request checks; a hook annotation combination; forbid using only --set to upgrade production.
6. In a GitOps environment, which faults from this lesson will not appear, and which will appear in a different form?
Argo CD does not use release records, so there are no pending locks or 1 MiB Secret problems, but an empty lookup, hook semantic mapping and field conflicts (with other managers) still occur. The Flux helm-controller uses the Helm SDK and release records, so pending, hook and size problems can all occur, appearing as conditions on the HelmRelease status.
Sources and Version Notes
| Topic | Verified conclusion | Source (verification date) |
|---|---|---|
| Helm version | Currently v4.3.2 (2026-11-13); Helm 4.0 was released on 2025-11-12 during KubeCon | Course standard · Helm 4 Released(2026-11-15) |
| Helm 3 lifecycle | The last feature release is 3.22 (2026-09-09), after which bug fixes end; security fixes run until 2027-02-10 (extended from 2026-11) | Helm 3 End of Life(2026-11-16) |
| Helm 4 changes | New installs default to SSA, Helm 3 releases default to CSA; Wasm plugin runtime; post-renderer converted to plugins (breaking); kstatus; --atomic/--force renames; helm registry login accepts only domain names; template --hide-notes/--render-subchart-notes deprecated | Helm 4 Overview(2026-11-16) |
| Parameter definitions | --rollback-on-failure,--atomic (deprecated),--force-replace,--force (deprecated),--force-conflicts (mutually exclusive with the former two), install --server-side default true; upgrade/rollback --server-side default auto; --take-ownership,--timeout default 300s,--history-max default 10,--wait strategy watcher/hookOnly/legacy (hookOnly when omitted),--dry-run none/client/server,template --validate deprecated,helm status only --revision | Helm v4.3.2 source code pkg/cmd/{install,upgrade,rollback,template,status,flags,helpers}.go (2026-11-16) |
| release state machine | full set of states; errPending original text; upgrade first writes pending-upgrade ("Preparing upgrade"); SIGINT/SIGTERM handling marks the revision as failed; rollback does not check pending, and after success marks all deployed revisions as superseded; without a revision the target is current − 1; --rollback-on-failure rolls back to the most recent deployed/superseded | source pkg/action/{action,upgrade,rollback,install,uninstall}.go,pkg/release/common/status.go |
| hooks | three deletion policies; helm.sh/hook-output-log-policy (hook-succeeded / hook-failed), for Jobs (by the job-name label) and Pods output logs to stderr, executed before the deletion policy; hook creation under SSA is an apply patch | source pkg/release/v1/hook.go,pkg/action/hooks.go,pkg/kube/client.go;Chart Hooks |
| SSA | field manager helm; APPLY_METHOD shown; CSA→SSA upgrades the client field manager; conflicts report errors conflict occurred while applying object …; conflict rules | source cmd/helm/helm.go,pkg/kube/client.go,pkg/cmd/get_metadata.go;Kubernetes SSA |
| storage | drivers secret/configmap/memory/sql; SQL only supports postgres, tables releases_v1/custom_labels_v1,HELM_DRIVER_SQL_CONNECTION_STRING; Secret type helm.sh/release.v1, labels name/owner/status/version/createdAt/modifiedAt; JSON → gzip BestCompression → base64; history pruning keeps the last deployed; error prefix create: failed to create: | source pkg/storage/driver/*.go,pkg/storage/storage.go,pkg/action/action.go,pkg/cli/environment.go |
| 1 MiB | a single Secret is at most 1 MiB; exceeding it reports data: Too long: must have at most 1048576 bytes | Kubernetes Secrets |
| values reuse | without any new values, reuses the previous user values; --reuse-values uses the old chart defaults; --reset-then-reuse-values uses the new chart defaults | source pkg/action/upgrade.go reuseValues |
| template engine | execution error at (…) format; include recursion limit 1000; required does not fail in lint mode; DNS disabled by default; HELM_PPROF_CPU_PROFILE/HELM_PPROF_MEM_PROFILE | source pkg/engine/engine.go,pkg/cmd/profiling.go |
| plugins | types cli/v1, getter/v1, postrenderer/v1; runtimes subprocess and extism/v1 (Wasm); --post-renderer looked up by plugin name; plugin install --verify default true; only tarball/OCI sources support verification, and local directories are treated as development mode | source internal/plugin/*,pkg/postrenderer,pkg/cmd/plugin_install.go;Migrate v3 Plugins |
| Environment | Kubernetes v1.37.1; kind v0.33.0 (kindest/node:v1.37.0); Argo CD v3.6.1; Flux v2.10.0; kubernetes.core 6.6.0 atomic mapping | Course standard (verified in other lessons of this repository, 2026-11-15) |
Video verification notes
All of the videos below had their titles and channels checked via the YouTube oEmbed endpoint (https://www.youtube.com/oembed?url=…&format=json, 2026-11-15): DevOps Hint “How to use helm lint, helm –debug –dry run, and helm template | How to Troubleshoot Errors in Helm” (5tHWBVbNmq0); SP Nexa DevOps “Helm Charts Kubernetes Release Lifecycle: Upgrade, Rollback & Dependencies | Part 6” (5XnEK_aPl-U); Rahul Wagh “Helm Upgrade Command | How to use Helm Upgrade Command - Part 12” (6ua2LBzPfxo); Anton Putra “Helm Chart Hooks Tutorial: pre-install VS post-install” (405uPOSwldU); mkdev “How to use Helm Hooks for Fun and Profit” (3GwZGpme4u0); CNCF “Adopting Server Side Apply in Knative - a Case Study - Dave Protasowski, VMware” (1rlTPjQ9dco); The New Stack “Helm 4: What’s New in the Open Source Kubernetes Package Manager?” (7kaLRHmPYNM); Rahul Wagh “Complete Helm Chart Tutorial: From Beginner to Expert Guide” (DQk8HOVlumI); KodeKloud “What is Helm? | Helm Concepts Explained | KodeKloud” (kJscDZfHXrQ); Red Hat “GitOps Guide to the Galaxy (Ep 111) | A belated look at Helm 4” (0UwvPaAvjS8); CNCF “Learn About Helm And Its Ecosystem - Andrew Block & Karena Angell, Matt Farina, Scott Rigby” (8g8K7afFBP8); Relnx “helm upgrade won't update your CRDs: kube-prometheus-stack 93.0.0 #shorts” (2dAykj5LuJQ); Abhishek.Veeramalla “You will never forget HELM after watching this.” (7A5cH8iqgHU). Durations, upload dates and content details were not checked one by one. No dedicated video was found for the two topics of pending-upgrade recovery and release storage size limits, so only storyboard scripts are provided for them. All videos are in English, most were recorded in the Helm 3 era, and for details, follow this lesson and the official documentation.
Audio narration notes
The “Audio” page uses the browser's Web Speech API (en-US) to read the lecture script aloud, with English terms pronounced in en-US; the result depends on the operating system's voice packs. The environment that generated this courseware cannot call a TTS service, so no MP3 is embedded; the lecture script can be passed directly to a TTS tool to generate audio.
Known limitations
- All commands in this lesson were written against the Helm v4.3.2 source code and official documentation, and were not actually run against a kind cluster in the environment that generated this courseware. The revision numbers, times, hashes, resource name suffixes and durations in the “expected output” are examples.
- Error messages for kstatus wait failures and hook Job failures Message part (the message field) varies with resource type and version, so the courseware shows it as “…” or as examples.
- Whether a new CRD field is reported at upgrade time as
unknown field(strict field validation) or silently pruned by the API Server depends on the validation settings and on whether--disable-openapi-validationis used; the courseware lists both. - The default field manager names of each kubectl subcommand (for example
kubectl-edit) and the manager name shown when HPA writes the scale subresource should follow what the cluster's managedFields actually shows; in the labs, the uniform name--field-manager=ops-hotfixis used so results are reproducible. helm plugin list's columns,--post-rendererthe error format when a plugin is not found follows the actual output. Helm 3'shelm status --show-resources/--show-descdoes not exist in the v4.3.2 source code; please refer tohelm status --helpfor the authoritative version.- The built-in Helm library versions of Argo CD, Flux and the Terraform helm provider have not been verified; the courseware only gives directions for checking them. The specific patch number of Helm 3.22 has not been verified; the example uses v3.22.0.
- The numbers in the cases (times, counts) are illustrative and not benchmarks. Lesson 8 was written in parallel with this lesson; cross-lesson references follow the final content of each lesson.