helm template: Usage, Options & Common CI Errors
Render a chart to plain YAML - no cluster required.
helm template runs a chart's templating engine locally and prints the resulting manifests, without talking to a cluster. It is the CI workhorse for validating that a chart renders cleanly before any deploy.
What it does
helm template NAME CHART renders templates with the merged values and writes the manifests to stdout - purely client-side, so it needs no cluster connection. --set / --values feed configuration; --show-only restricts output to one template; --output-dir writes files. It is ideal for piping into kubectl diff or a policy linter in CI.
Common usage
helm template web ./charts/web -f values.prod.yaml
helm template web ./charts/web --show-only templates/deployment.yaml
helm template web ./charts/web | kubectl apply --dry-run=server -f -
helm template web ./charts/web --output-dir ./renderedCommon errors in CI
Because helm template does not reach the cluster, lookup-based templates behave differently: the lookup function returns empty (no cluster to query), so a chart that branches on existing resources renders the wrong path versus a real install. Use helm install --dry-run=server when cluster context matters. Template bugs surface here as "Error: ... at <.Values.x>: nil pointer evaluating interface {}" (a value the template assumed is missing) or "error converting YAML to JSON" (the rendered output is not valid YAML - usually an indentation/quoting bug in the template). These are exactly the errors you want to catch in CI before deploying.
Using this in CI
A runner has no kubeconfig, no cached context, and no interactive auth. Every kubectl invocation in CI needs the context supplied explicitly, and most confusing CI failures here are the command running against the wrong cluster or no cluster at all.
# never rely on the ambient context on a runner
kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get pods
# confirm what you are actually connected to before mutating anything
kubectl config current-context
kubectl cluster-info
# fail fast instead of hanging on an unreachable API server
kubectl --request-timeout=30s get nodes