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.
More on Templating: Go Templates & Sprig
What template language does Helm use?BeginnerWhat does the dot (`.`) mean in a Helm template?BeginnerWhat is `$` and when do you need it?IntermediateHow does whitespace control (`{{-` and `-}}`) work?BeginnerHow do `if`, `else if` and `else` evaluate truthiness?BeginnerWhat do `and`, `or`, `not`, `eq`, `ne`, `lt`, `gt` look like in Helm?Beginner