How to create Helm charts?
· Category: Kubernetes
Short answer
A Helm chart is a collection of Kubernetes manifests organized into a directory with templates, values, and metadata. Use helm create to scaffold a chart, then customize templates and values.
Steps
- Run
helm create mychart. - Edit
Chart.yamlwith metadata. - Place Kubernetes manifests in
templates/. - Define defaults in
values.yaml. - Install with
helm install.
Example
helm create myapp
values.yaml:
replicaCount: 3
image:
repository: nginx
tag: "1.25"
service:
port: 80
Template snippet:
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "myapp.fullname" . }}
spec:
replicas: {{ .Values.replicaCount }}
Tips
- Use
helm lintandhelm templateto validate charts. - Keep charts generic with configurable
values.yaml. - Use
helm upgrade --installfor idempotent deployments.
Common issues
- Templating syntax errors cause cryptic YAML parse failures.
- Values not defined in
values.yamlmay be empty if not required. - Chart dependencies are managed with
Chart.lock.