Interview Prep/Helm/Templating: Go Templates & Sprig

How do you debug a template that renders wrong output?

IntermediateConceptTemplating: Go Templates & Sprig
Answer
helm template shop ./shop -f values-dev.yaml --debug                 # prints rendered YAML even on YAML errors
helm template shop ./shop -s templates/api-deployment.yaml           # render one file
helm template shop ./shop --set api.replicaCount=0 | yq '.spec.replicas'
helm lint ./shop -f values-prod.yaml --strict

Temporarily print values with {{ toYaml .Values.api | fail }} or {{ printf "%#v" . }} inside the template. For YAML errors, the --debug output shows the broken document, which is faster than guessing the line number.

All Helm questions Roadmap: Helm

More on Templating: Go Templates & Sprig