Welcome to the Helm Charts Made Easy tutorial β a complete hands-on guide where youβll learn how to simplify Kubernetes deployments using Helm 3 on Amazon EKS.
π₯ Watch the full Video here: Learn Helm for Beginners & Create your own Helm Chart
This session is perfect for DevOps Engineers, Cloud Practitioners, and Kubernetes Enthusiasts who want to understand how Helm simplifies application deployment, versioning, and management in Kubernetes.
By the end of this video, youβll master:
πΉ Setting up EKS Cluster and installing Helm 3
πΉ Understanding What is Helm 3 and how it differs from Helm 2
πΉ Key Helm Commands and workflow
πΉ Creating Your First Helm Chart from scratch
πΉ Using Helm Hooks to automate pre/post install actions
πΉ Working with Dependency Charts
πΉ Understanding and customizing the _helpers.tpl file
πΉ Using Include Files, Loops, and If-Else Conditions in Helm templates
aws configure
aws s3 lscurl -o kubectl https://s3.us-west-2.amazonaws.com/amazon-eks/1.29.0/2024-01-04/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin
kubectl version --clientcurl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm versionaws eks update-kubeconfig --name my-eks-cluster --region ap-south-1
kubectl get nodeshelm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
helm repo list
helm search repo
helm search repo bitnami/nginxhelm install my-nginx bitnami/nginx
helm list
helm status my-nginx
kubectl get pods
kubectl get svc
helm get manifest my-nginxhelm upgrade my-nginx bitnami/nginx --set service.type=LoadBalancer
helm upgrade my-nginx bitnami/nginx \
--set replicaCount=3 \
--set service.type=LoadBalancer \
--set persistence.enabled=true
helm upgrade myapp ./mychart --set replicaCount=4
helm history myapp
helm rollback myapp 1
helm uninstall my-nginx| Repo Name | URL | Notes |
|---|---|---|
| stable | https://charts.helm.sh/stable |
Previously the official stable repo; mostly deprecated now. |
| bitnami | https://charts.bitnami.com/bitnami |
Maintained by Bitnami; includes many popular apps (MySQL, Redis, WordPress, etc.) |
| hashicorp | https://helm.releases.hashicorp.com |
HashiCorp apps like Vault, Consul, Nomad |
| elastic | https://helm.elastic.co |
Elasticsearch, Kibana, Logstash, Beats charts |
| ingress-nginx | https://kubernetes.github.io/ingress-nginx |
Nginx Ingress Controller charts |
| grafana | https://grafana.github.io/helm-charts |
Grafana, Loki, Prometheus Operator charts |
| jetstack | https://charts.jetstack.io |
Cert-Manager charts |
| prometheus-community | https://prometheus-community.github.io/helm-charts |
Prometheus, Alertmanager, Node Exporter charts |
In this section, youβll learn how to create, customize, and deploy your own Helm chart from scratch β a must-know skill for mastering Kubernetes packaging.
helm pull bitnami/nginx --untar
cd nginx
tree
cd
helm template my-nginx ./nginxhelm create mychart
cd mychart
treemkdir mychart
cd mychart
touch Chart.yaml
touch values.yaml
mkdir templates
touch templates/deployment.yamlExpected Folder Structure Output:
mychart/
βββ Chart.yaml
βββ values.yaml
βββ templates/
βββ deployment.yaml
apiVersion: v2
name: mychart
description: A simple Helm chart for Kubernetes by LearnWithMithran
version: 0.1.0
appVersion: "1.0"replicaCount: 2
image:
repository: nginx
tag: latest
service:
type: LoadBalancer
port: 80apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Chart.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
ports:
- containerPort: {{ .Values.service.port }}apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}
labels:
app: {{ .Chart.Name }}
spec:
type: {{ .Values.service.type }}
selector:
app: {{ .Chart.Name }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.port }}
protocol: TCPhelm install myapp ./mychart
helm upgrade myapp ./mychart -f values-prod.yaml -f values-dev.yaml
helm upgrade myapp ./mychart --set replicaCount=3,image.tag=1.23
kubectl get pods
helm lint ./mychart
helm template myapp ./mychart
helm uninstall myappβ Congratulations! Youβve just created and deployed your own Helm chart successfully.
In this section, we dive deeper into advanced Helm features used in real-world Kubernetes deployments β including Helm Hooks, Dependency Charts, Subcharts, and advanced templating with Go functions.
Helm hooks let you run specific resources before or after certain release lifecycle events.
Theyβre useful for running setup, cleanup, or validation tasks (e.g., running a Job before installing a release).
Example β Pre-install Hook
# templates/hooks-job.yaml
apiVersion: batch/v1
kind: Job
metadata:
name: "{{ .Release.Name }}-precheck"
annotations:
"helm.sh/hook": pre-install
spec:
template:
spec:
containers:
- name: precheck
image: busybox
command: ['sh', '-c', 'echo Pre-install check completed!']
restartPolicy: Neverπ§Ύ Helm Hook Types
| Hook Name | Trigger Event Description |
|---|---|
pre-install |
Before any resources are installed |
post-install |
After all resources are installed |
pre-delete |
Before any resources are deleted |
post-delete |
After all resources are deleted |
pre-upgrade |
Before upgrading resources |
post-upgrade |
After upgrade is complete |
pre-rollback |
Before rollback begins |
post-rollback |
After rollback completes |
test |
Runs with helm test command |
Helm supports adding dependencies inside your chart using the Chart.yaml file.
For example, you can add Redis as a dependency:
# Chart.yaml
dependencies:
- name: redis
version: "17.1.0"
repository: "https://charts.bitnami.com/bitnami"Then run:
cd mychart
helm dependency update
helm install myapp ./mychartHelm will automatically pull and package the Redis subchart under charts/ inside your chart.
Subcharts are charts placed inside the charts/ directory of your main chart.
They help you modularize and reuse charts.
mychart/
βββ charts/
β βββ redis/
β βββ backend/
βββ templates/
βββ values.yaml
Subcharts inherit values via namespaces.
You can override them in your main chartβs values.yaml using:
redis:
replica:
replicaCount: 2_helpers.tpl allows you to define reusable template snippets and functions.
Example:
# _helpers.tpl
{{- define "mychart.fullname" -}}
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" -}}
{{- end -}}Then include it in another file:
metadata:
name: {{ include "mychart.fullname" . }}You can also define labels:
# _helpers.tpl
{{- define "mychart.labels" -}}
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/version: {{ .Chart.Version }}
{{- end -}}Use with indentation:
metadata:
labels:
{{- include "mychart.labels" . | nindent 4 }}Helm can embed external files such as JSON or scripts into manifests.
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-config
data:
app-config.json: |-
{{ .Files.Get "files/app-config.json" | nindent 4 }}Or for shell scripts:
command: ["sh", "-c", "{{ .Files.Get "files/init-script.sh" | quote }}"]If-Else Example
{{- if eq .Values.service.type "LoadBalancer" }}
externalTrafficPolicy: Cluster
{{- else }}
clusterIP: None
{{- end }}Range Example
{{- range $key, $value := .Values.appSettings }}
{{ $key }}: "{{ $value }}"
{{- end }}Nested Example
{{- if .Values.enabled }}
{{- range $env := .Values.environments }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" $.Release.Name $env.name }}
data:
REGION: {{ $env.region }}
{{- end }}
{{- end }}| Function | Description | Example | Output |
|---|---|---|---|
upper |
Convert to uppercase | {{ upper "hello" }} |
HELLO |
lower |
Convert to lowercase | {{ lower "HELLO" }} |
hello |
default |
Default value if undefined | {{ .Values.name | default "guest" }} |
"guest" |
quote |
Add quotes around text | {{ quote "text" }} |
"text" |
len |
Count elements | {{ len .Values.env }} |
2 |
replace |
Replace text | {{ replace "app" "a" "A" }} |
App |
add |
Math addition | {{ add 2 3 }} |
5 |
b64enc / b64dec |
Base64 encode/decode | {{ "mypassword" | b64enc }} |
Base64 string |
For a full list of available functions, refer to the official Go template Sprig library: π https://masterminds.github.io/sprig/
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "mychart.fullname" . }}
labels:
{{- include "mychart.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.app.replicas }}
template:
spec:
containers:
- name: {{ .Values.app.name | default "demo" }}
image: nginx:latest
env:
{{- range .Values.env }}
- name: {{ .name | upper }}
value: {{ .value | quote }}
{{- end }}β With these features β Hooks, Dependencies, Helpers, Includes, and Functions β you now understand how Helm templates can dynamically generate powerful and reusable Kubernetes manifests.
- Helm Official Documentation
- Helm Template Functions (Sprig Library)
- Helm Best Practices Guide
- Kubernetes Manifest Reference
π Learn Helm for Beginners & Create your own Helm Chart
Phone: +91 91500 87745
Join our Discord Community
π Click here to connect
Subscribe to my YouTube Channel β Learn With Mithran
π― Watch Now