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

  1. Run helm create mychart.
  2. Edit Chart.yaml with metadata.
  3. Place Kubernetes manifests in templates/.
  4. Define defaults in values.yaml.
  5. 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 lint and helm template to validate charts.
  • Keep charts generic with configurable values.yaml.
  • Use helm upgrade --install for idempotent deployments.

Common issues

  • Templating syntax errors cause cryptic YAML parse failures.
  • Values not defined in values.yaml may be empty if not required.
  • Chart dependencies are managed with Chart.lock.