Interview Prep/Helm/Templating & Rendering Errors

`Error: template: shop/templates/api-deployment.yaml:24:28: executing "shop/templates/api-deployment.yaml" at <.Values.api.image.tag>: nil pointer evaluating interface {}.tag`

BeginnerTroubleshootingTemplating & Rendering Errors
Answer

Likely causes → A parent key in the path is missing: api.image does not exist in the merged values (typo, a values file set image: null, or the key was renamed).

Diagnose →

helm template shop ./shop -f values-prod.yaml --debug 2>&1 | head -5
yq '.api' values.yaml values-prod.yaml

Fix → Add the missing default to values.yaml, or make the template defensive: {{ (.Values.api.image | default dict).tag | default .Chart.AppVersion }}, or wrap in with.

Prevent → Defaults for every referenced key and a schema requiring the parent objects.

All Helm questions Roadmap: Helm

More on Templating & Rendering Errors