Go Template Basics
Helm renders templates with Go's template engine — double curly braces inject values into your YAML.
{{ .Values.someKey }}Helm templating is built on the Go template language. Anything inside {{ }} is an action — an expression Helm evaluates and replaces with text.
The rendering flow
Helm merges your values with the chart's built-in objects, then walks each template file replacing actions with computed strings. The output is plain Kubernetes YAML.
Actions vs text
Everything outside {{ }} is copied verbatim. So your files look like normal YAML with small template snippets sprinkled in.
Example
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-config
data:
greeting: {{ .Values.greeting }}
env: {{ .Values.environment }}When to use it
- A chart author uses {{ .Values.image.tag }} in a Deployment template so operators can pin a specific container image version without editing any manifest directly.
- A developer uses {{ if .Values.ingress.enabled }} to conditionally render an Ingress resource only when the operator opts in by setting the value to true.
- A platform engineer uses helm template to render a chart locally with production values and diff the output against what is currently deployed, catching regressions before they reach the cluster.
More examples
Inject a value into YAML
Shows the fundamental pattern: double-brace expressions are replaced with values at render time, producing plain Kubernetes YAML.
# templates/deployment.yaml
metadata:
name: {{ .Release.Name }}-web
spec:
replicas: {{ .Values.replicaCount }}
template:
spec:
containers:
- image: {{ .Values.image.repository }}:{{ .Values.image.tag }}Conditional block in template
Uses an if block to include the loadBalancerIP field only when the service type is LoadBalancer.
# templates/service.yaml
spec:
type: {{ .Values.service.type }}
{{- if eq .Values.service.type "LoadBalancer" }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}Render chart locally
Renders all templates to stdout without contacting Kubernetes, useful for reviewing the final YAML before applying.
helm template my-release ./myapp \
--set image.tag=v2.1.0 \
-f values-staging.yaml
Discussion