What's Actually Happening
Helm template rendering fails. Charts cannot be deployed due to syntax or reference errors.
The Error You'll See
```bash $ helm template mychart
Error: INSTALLATION FAILED: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(Deployment.spec.template.spec.containers[0].ports[0].containerPort): invalid type for io.k8s.api.core.v1.ContainerPort.containerPort: got "string", expected "integer" ```
Why This Happens
- 1.YAML syntax error
- 2.Invalid type conversion
- 3.Missing required value
- 4.Template function error
- 5.Indentation issue
Step 1: Debug Template
helm template mychart --debug
helm template mychart --set image.tag=latestStep 2: Check Values
cat values.yaml
helm template mychart -f custom-values.yamlStep 3: Validate YAML
helm template mychart > output.yaml
kubectl apply --dry-run=client -f output.yaml
yamllint output.yamlStep 4: Check Indentation
# Use consistent 2-space indentation
# Verify with:
helm template mychart | grep -A 20 "containers:"Step 5: Check Type Conversion
# Use type conversion functions:
containerPort: {{ .Values.port | int }}
replicas: {{ .Values.replicas | int }}Step 6: Check Required Values
{{- required "A valid .Values.image.repository is required" .Values.image.repository }}Step 7: Lint Chart
helm lint mychart
helm lint mychart --strictStep 8: Check Dependencies
helm dependency list mychart
helm dependency update mychartStep 9: Check Helper Functions
# Check _helpers.tpl
cat mychart/templates/_helpers.tplStep 10: Dry Run Install
helm install myrelease mychart --dry-run
helm upgrade myrelease mychart --dry-runRelated Issues
- [Fix Helm Upgrade Timeout](/articles/fix-helm-upgrade-timeout)
- [Fix Kustomize Build Error](/articles/fix-kustomize-build-error)