Overview
Helm is the package manager for Kubernetes, often described as 'apt-get for Kubernetes.' This comprehensive guide covers chart creation, repository management, and deployment strategies that align with Certified Kubernetes Administrator (CKA) exam requirements.
What this tutorial covers:
- Installing and configuring Helm 3
- Understanding Helm chart structure and templates
- Working with Helm repositories
- Deploying applications using Helm charts
- Managing releases with upgrades and rollbacks
- Creating custom charts from scratch
Prerequisites:
- Working Kubernetes cluster (v1.19+)
- kubectl installed and configured
- Basic understanding of Kubernetes manifests (Deployments, Services, ConfigMaps)
- Familiarity with YAML syntax
Why this matters for CKA: Helm is extensively covered in CKA exam domains related to application deployment and cluster management. Understanding helm commands, chart structure, and release management is critical for exam success and real-world Kubernetes operations.
Getting Started
Installing Helm 3
Helm 3 is the current stable version. Installation is straightforward across all platforms:
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bashVerify the installation:
helm version
helm repo listInitialize Helm and Add Repositories
Helm 3 doesn't require initialization, but you should add official repositories immediately:
# Add stable Helm repositories
helm repo add stable https://charts.helm.sh/stable
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add jetstack https://charts.jetstack.io
# Update local index
helm repo updateList available repositories:
helm repo listSearch for Charts
Before deploying, search for available charts:
# Search for nginx chart
helm search repo nginx
# Search with version information
helm search repo nginx --versions
# Search in specific repository
helm search repo bitnami/postgresqlUnderstanding Helm Charts and Templates
What is a Helm Chart?
A Helm chart is a collection of files that describe a set of Kubernetes resources. Think of it as a template package that allows you to define, install, and upgrade Kubernetes applications with variables and logic.
Chart Directory Structure
Create a new chart to understand the structure:
helm create myappThis generates the standard chart structure:
myapp/
├── Chart.yaml # Chart metadata
├── values.yaml # Default configuration values
├── charts/ # Dependency charts
├── templates/ # Kubernetes manifest templates
│ ├── deployment.yaml
│ ├── service.yaml
│ ├── configmap.yaml
│ ├── _helpers.tpl # Template helper functions
│ └── NOTES.txt # Post-deployment notes
└── .helmignore # Files to ignoreWorking with Templates
Edit templates/deployment.yaml to understand templating:
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}
labels:
app: {{ .Chart.Name }}
version: {{ .Chart.AppVersion }}
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 }}
env:
- name: LOG_LEVEL
value: {{ .Values.logLevel | quote }}Understanding values.yaml
The values.yaml file provides default values for template variables:
replicaCount: 3
image:
repository: nginx
tag: '1.21.0'
pullPolicy: IfNotPresent
service:
type: ClusterIP
port: 80
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 250m
memory: 256Mi
logLevel: infoCommon Pitfalls:
- Quote strings: Use the
| quotefilter to avoid YAML parsing errors with special characters - Indentation: YAML indentation errors are the most common template issue—use 2 spaces consistently
- Missing ranges: When iterating over values, always close
{{- range }}with{{- end }} - Null values: Use
defaultfilter to handle missing values:{{ .Values.optional | default 'fallback' }}
Advanced Chart Management and Deployments
Installing and Managing Releases
Deploy a chart from a repository:
# Install a chart from repository
helm install my-release stable/nginx-ingress
# Install with custom values
helm install my-app ./myapp --values custom-values.yaml
# Install with inline value overrides
helm install my-app ./myapp --set replicaCount=5 --set image.tag=1.22.0Upgrading Releases
Helm makes updating deployments simple and safe:
# Upgrade a release with new values
helm upgrade my-app ./myapp --set replicaCount=5
# Upgrade with new chart version
helm upgrade my-release stable/nginx-ingress --version 3.35.0
# Dry-run to preview changes
helm upgrade my-app ./myapp --dry-run --debugRollback Deployments
If an upgrade fails, rollback instantly:
# View release history
helm history my-app
# Rollback to previous release
helm rollback my-app 1
# Rollback to specific revision
helm rollback my-app 2Managing Dependencies
Charts can depend on other charts. Define dependencies in Chart.yaml:
dependencies:
- name: postgresql
version: '11.0.0'
repository: 'https://charts.bitnami.com/bitnami'
condition: postgresql.enabledUpdate dependencies:
helm dependency update myapp/
helm dependency list myapp/Validating Charts
Before deploying, validate chart syntax and values:
# Lint chart for errors
helm lint myapp/
# Dry-run installation to validate all manifests
helm install my-app ./myapp --dry-run --debug
# Template rendering without installing
helm template my-app ./myapp --values values.yamlBest Practices:
- Use semantic versioning: Follow SemVer for chart versions (e.g., 1.2.3)
- Document values: Add comments in values.yaml explaining each parameter
- Test before upgrading: Always use
--dry-runbefore production upgrades - Pin chart versions: In dependencies, specify exact versions, not ranges
- Use ConfigMaps/Secrets: Externalize configuration away from chart code
Exam Tips for Certified Kubernetes Administrator (CKA)
Key Helm Concepts for CKA:
- Chart Anatomy: Understand every file in a chart structure, especially templates/ and values.yaml
- Template Syntax: Be familiar with Go template syntax (range, if, with, default filters)
- Release Management: Know the difference between install, upgrade, and rollback commands
- Repository Operations: Add, remove, update, and search repositories confidently
- Values Override: Understand precedence: CLI flags > custom values.yaml > Chart defaults
Common Exam Scenarios:
- Deploy an application using Helm: Install a chart from bitnami repo with custom values
- Create a custom chart: Use
helm createand modify templates for specific requirements - Upgrade and rollback: Update a release and rollback if necessary
- Troubleshoot deployments: Use
helm get values,helm template, andhelm statusto debug
Quick Reference Commands:
# Essential commands for exam
helm install RELEASE CHART
helm upgrade RELEASE CHART
helm rollback RELEASE REVISION
helm uninstall RELEASE
helm list
helm status RELEASE
helm get values RELEASE
helm template RELEASE CHART
helm lint CHART
helm search repo CHART
helm repo add NAME URL
helm dependency update CHARTSummary
Key Takeaways:
- Helm 3 simplifies Kubernetes application deployment through templating and package management
- Charts consist of templates, values, and metadata—understand each component thoroughly
- Always validate with
--dry-runand use--debugfor troubleshooting - Rollback capability makes upgrades safer and more reversible
- Repository management and chart searching are fundamental daily operations
- Mastery of Helm values override mechanisms is critical for flexible deployments
Next Steps:
- Create a custom chart from scratch for an application you know well
- Practice upgrading and rolling back releases in a test cluster
- Explore complex charts from Bitnami or Jetstack to learn advanced patterns
- Study Helm chart best practices and security considerations
- Review our CKA Certification Preparation Guide for comprehensive exam coverage

