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. 1.YAML syntax error
  2. 2.Invalid type conversion
  3. 3.Missing required value
  4. 4.Template function error
  5. 5.Indentation issue

Step 1: Debug Template

bash
helm template mychart --debug
helm template mychart --set image.tag=latest

Step 2: Check Values

bash
cat values.yaml
helm template mychart -f custom-values.yaml

Step 3: Validate YAML

bash
helm template mychart > output.yaml
kubectl apply --dry-run=client -f output.yaml
yamllint output.yaml

Step 4: Check Indentation

yaml
# Use consistent 2-space indentation
# Verify with:
helm template mychart | grep -A 20 "containers:"

Step 5: Check Type Conversion

yaml
# Use type conversion functions:
containerPort: {{ .Values.port | int }}
replicas: {{ .Values.replicas | int }}

Step 6: Check Required Values

yaml
{{- required "A valid .Values.image.repository is required" .Values.image.repository }}

Step 7: Lint Chart

bash
helm lint mychart
helm lint mychart --strict

Step 8: Check Dependencies

bash
helm dependency list mychart
helm dependency update mychart

Step 9: Check Helper Functions

bash
# Check _helpers.tpl
cat mychart/templates/_helpers.tpl

Step 10: Dry Run Install

bash
helm install myrelease mychart --dry-run
helm upgrade myrelease mychart --dry-run
  • [Fix Helm Upgrade Timeout](/articles/fix-helm-upgrade-timeout)
  • [Fix Kustomize Build Error](/articles/fix-kustomize-build-error)