Helm Charts for Beginners: Deploy Applications Like a Pro
Helm is the package manager for Kubernetes. Just as apt manages packages on Ubuntu or npm manages packages in Node.js, Helm manages applications on Kubernetes. This guide will take you from zero to deploying applications with Helm.
What is Helm?
Helm allows you to:
- Package applications as reusable charts
- Install applications with a single command
- Upgrade and rollback deployments
- Share charts via repositories
Installing Helm
# macOS
brew install helm
# Linux
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
# Verify installation
helm versionHelm Concepts
Chart
A package containing all Kubernetes resource definitions needed to run an application.
Release
An instance of a chart running in a cluster.
Repository
A place where charts are stored and shared.
Your First Helm Commands
Add a Repository
# Add the Bitnami repository
helm repo add bitnami https://charts.bitnami.com/bitnami
# Update repository cache
helm repo update
# Search for charts
helm search repo nginxInstall a Chart
# Install nginx
helm install my-nginx bitnami/nginx
# Install with custom values
helm install my-nginx bitnami/nginx --set service.type=ClusterIP
# Install in a specific namespace
helm install my-nginx bitnami/nginx -n production --create-namespaceManage Releases
# List all releases
helm list
# Get release status
helm status my-nginx
# Upgrade a release
helm upgrade my-nginx bitnami/nginx --set replicaCount=3
# Rollback to previous version
helm rollback my-nginx 1
# Uninstall a release
helm uninstall my-nginxCreating Your Own Chart
# Create a new chart
helm create my-app
# Chart structure
my-app/
├── Chart.yaml # Chart metadata
├── values.yaml # Default configuration
├── templates/ # Kubernetes manifests
│ ├── deployment.yaml
│ ├── service.yaml
│ └── ingress.yaml
└── charts/ # DependenciesChart.yaml
apiVersion: v2
name: my-app
description: My awesome application
version: 1.0.0
appVersion: "1.0"values.yaml
replicaCount: 2
image:
repository: nginx
tag: "1.21"
pullPolicy: IfNotPresent
service:
type: ClusterIP
port: 80Using Values in Templates
# templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
spec:
replicas: {{ .Values.replicaCount }}
template:
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"Helm Best Practices
- Use values.yaml - Never hardcode values in templates
- Version your charts - Semantic versioning for chart updates
- Template everything - Make charts reusable
- Document values - Add comments explaining each value
- Test your charts - Use
helm lintandhelm template
Practice Helm Skills
Helm is part of the CKAD exam curriculum. Practice deploying and managing Helm charts with Sailor.sh in our realistic lab environment.