Hands-on Lab

#Lab: Helm Charts

Package and deploy Kubernetes applications with Helm.

#๐ŸŽฏ Objectives

  • Install and configure Helm
  • Deploy applications using Helm charts
  • Create custom Helm charts
  • Manage releases and upgrades

#๐Ÿ“‹ Prerequisites

  • Kubernetes cluster (minikube, kind, or k3d)
  • kubectl configured

#โฑ๏ธ Duration: 45 minutes


#Task 1: Install Helm (5 min)

bash
1# Linux/macOS
2curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
3
4# Windows (Chocolatey)
5# choco install kubernetes-helm
6
7# Verify installation
8helm version

#Task 2: Add Helm Repositories (5 min)

bash
1# Add popular repositories
2helm repo add bitnami https://charts.bitnami.com/bitnami
3helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
4helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
5
6# Update repos
7helm repo update
8
9# Search for charts
10helm search repo nginx
11helm search repo postgresql

#Task 3: Deploy with Helm (10 min)

bash
1# Simple install
2helm install my-nginx bitnami/nginx
3
4# Check release
5helm list
6kubectl get pods
7
8# Install with custom values
9helm install my-db bitnami/postgresql \
10  --set auth.postgresPassword=secretpassword \
11  --set primary.persistence.size=1Gi
12
13# Or use values file
14cat << 'EOF' > values.yaml
15auth:
16  postgresPassword: secretpassword
17primary:
18  persistence:
19    size: 1Gi
20EOF
21
22helm install my-db2 bitnami/postgresql -f values.yaml

#Task 4: Create Custom Chart (15 min)

bash
1# Create new chart
2helm create myapp
3cd myapp
4
5# View structure
6ls -la
7
8# templates/  - Kubernetes manifest templates
9# Chart.yaml  - Chart metadata
10# values.yaml - Default configuration

#Edit values.yaml

bash
1cat << 'EOF' > values.yaml
2replicaCount: 2
3
4image:
5  repository: nginx
6  tag: "1.25-alpine"
7  pullPolicy: IfNotPresent
8
9service:
10  type: ClusterIP
11  port: 80
12
13resources:
14  limits:
15    cpu: 100m
16    memory: 128Mi
17  requests:
18    cpu: 50m
19    memory: 64Mi
20EOF

#Install Custom Chart

bash
1cd ..
2helm install my-custom-app ./myapp
3
4# Verify
5helm list
6kubectl get pods
7kubectl get svc

#Task 5: Manage Releases (10 min)

bash
1# Upgrade release
2helm upgrade my-nginx bitnami/nginx --set replicaCount=3
3
4# Rollback
5helm rollback my-nginx 1
6
7# View history
8helm history my-nginx
9
10# Uninstall
11helm uninstall my-nginx
12
13# Dry run (preview changes)
14helm install test bitnami/nginx --dry-run --debug

#โœ… Success Criteria

  • Helm installed and configured
  • Deployed chart from repository
  • Created custom Helm chart
  • Performed upgrade and rollback
  • Successfully uninstalled releases

#๐Ÿงน Cleanup

bash
helm uninstall my-nginx my-db my-db2 my-custom-app 2>/dev/null
rm -rf myapp values.yaml