Interview Prep/Helm/Templating & Rendering Errors

`json: cannot unmarshal string into Go struct field ContainerPort.spec.template.spec.containers.ports.containerPort of type int32`

BeginnerTroubleshootingTemplating & Rendering Errors
Answer

Likely causes → The port was quoted in values (port: "3000") or in the template ({{ .Values.port | quote }}).

Diagnose → helm template ... | yq '.spec.template.spec.containers[].ports'.

Fix → Render as integer: containerPort: {{ .Values.api.port | int }}; keep values unquoted.

Prevent → Schema with "type": "integer" for ports.

All Helm questions Roadmap: Helm

More on Templating & Rendering Errors