Create Custom Helm Charts
Intermediate20 minTrending
Scaffold, structure, and build custom Helm charts for your applications with proper templates, helpers, and values files.
Prerequisites
- -Helm 3 installed
- -Basic understanding of Kubernetes manifests
- -Familiarity with Go templates
Steps
1
Scaffold a new chart
Generate the default Helm chart directory structure.
$ helm create myapp
The scaffold includes a Deployment, Service, ServiceAccount, Ingress, and HPA template ready to customize.
2
Explore the chart structure
Understand the key files and directories in the generated chart.
$ find myapp -type f | sort
3
Edit the values file
Customize the default values that will be used across your templates.
$ cat myapp/values.yaml
Keep values.yaml well-documented with comments explaining each parameter and its default.
4
Add a custom template
Create a ConfigMap template using Helm template syntax.
$ cat > myapp/templates/configmap.yaml << 'EOF'
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "myapp.fullname" . }}-config
labels:
{{- include "myapp.labels" . | nindent 4 }}
data:
APP_ENV: {{ .Values.config.environment | quote }}
LOG_LEVEL: {{ .Values.config.logLevel | quote }}
EOF
5
Render templates locally
Preview the generated Kubernetes manifests without deploying.
$ helm template my-release myapp --set config.environment=production --set config.logLevel=warn
6
Package the chart
Create a versioned .tgz archive of the chart for distribution.
$ helm package myapp --version 1.0.0 --app-version 1.0.0
Full Script
FAQ
Discussion
Loading comments...