Lesson 02 Your First Chart
Theme:

Lab Guide

Time estimate: 30–45 minutes  ·  Prerequisites: Helm installed, a running Kubernetes cluster (minikube, kind, or Docker Desktop)

Setup

This lab walks you through creating your first Helm chart, exploring its structure, deploying it to a cluster, and managing the full release lifecycle. You will use a local Kubernetes cluster throughout.

Before You Begin

Verify your environment is ready:

# Confirm Helm is installed
helm version

# Confirm kubectl can reach your cluster
kubectl cluster-info

# Confirm you have a namespace to work in
kubectl get namespaces

If kubectl cluster-info fails, start your local cluster first (e.g., minikube start or kind create cluster).

Exercise 1: Scaffold and Explore a Chart

Goal

Create a new Helm chart with helm create and understand every file in the generated structure.

Steps

  1. Create a working directory and scaffold a chart:
    mkdir -p ~/helm-labs/lesson02 && cd ~/helm-labs/lesson02
    helm create myapp
  2. List the generated files:
    find myapp -type f | sort

    Expected output:

    myapp/.helmignore
    myapp/Chart.yaml
    myapp/charts
    myapp/templates/NOTES.txt
    myapp/templates/_helpers.tpl
    myapp/templates/deployment.yaml
    myapp/templates/hpa.yaml
    myapp/templates/ingress.yaml
    myapp/templates/service.yaml
    myapp/templates/serviceaccount.yaml
    myapp/templates/tests/test-connection.yaml
    myapp/values.yaml
  3. Examine Chart.yaml:
    cat myapp/Chart.yaml

    Expected output (key fields):

    apiVersion: v2
    name: myapp
    description: A Helm chart for Kubernetes
    type: application
    version: 0.1.0
    appVersion: "1.16.0"
  4. Examine the default values:
    cat myapp/values.yaml

    Note the nested structure: image.repository, image.tag, service.type, service.port, etc.

  5. Look at the helper templates:
    cat myapp/templates/_helpers.tpl

    Identify the named templates: myapp.name, myapp.fullname, myapp.labels, and myapp.selectorLabels.

  6. Preview the rendered output without installing:
    helm template my-release myapp

    This renders all templates with default values and prints the resulting Kubernetes YAML to stdout. Verify that the Deployment uses nginx as the image and the Service is type ClusterIP.

Self-check: You can identify the purpose of every file in the chart directory and the rendered output contains valid Kubernetes manifests.

Exercise 2: Install, Inspect, and Upgrade

Goal

Deploy the chart to your cluster, inspect the release, and perform an upgrade with modified values.

Steps

  1. Install the chart as a release named my-release:
    helm install my-release myapp

    Expected output (excerpt):

    NAME: my-release
    LAST DEPLOYED: ...
    NAMESPACE: default
    STATUS: deployed
    REVISION: 1
    NOTES:
    1. Get the application URL by running these commands:
      export POD_NAME=$(kubectl get pods ...
      echo "Visit http://127.0.0.1:8080 ..."
      kubectl --namespace default port-forward $POD_NAME 8080:80
  2. List all releases:
    helm list

    Expected output:

    NAME        NAMESPACE  REVISION  ...  STATUS    CHART        APP VERSION
    my-release  default    1              deployed  myapp-0.1.0  1.16.0
  3. Get detailed status:
    helm status my-release
  4. Verify the Kubernetes resources were created:
    kubectl get deployment,service,pod -l app.kubernetes.io/instance=my-release
  5. Upgrade the release to 3 replicas:
    helm upgrade my-release myapp --set replicaCount=3

    Expected output (excerpt):

    Release "my-release" has been upgraded. Happy Helming!
    ...
    REVISION: 2
  6. Verify the upgrade:
    # Check revision history
    helm history my-release
    
    # Confirm 3 pods are running
    kubectl get pods -l app.kubernetes.io/instance=my-release

    Expected: helm history shows 2 revisions. kubectl get pods shows 3 pods.

  7. Retrieve the values used for the current revision:
    helm get values my-release

    Expected output:

    USER-SUPPLIED VALUES:
    replicaCount: 3

Self-check: helm list shows revision 2, and 3 pods are running in the cluster.

Exercise 3: Rollback and Uninstall

Goal

Roll back to the original revision and then clean up by uninstalling the release.

Steps

  1. Roll back to revision 1 (1 replica):
    helm rollback my-release 1

    Expected output:

    Rollback was a success! Happy Helming!
  2. Verify the rollback created a new revision:
    helm history my-release

    Expected output:

    REVISION  ...  STATUS      ...  DESCRIPTION
    1              superseded       Install complete
    2              superseded       Upgrade complete
    3              deployed         Rollback to 1

    Notice revision 3 was created, not revision 1 restored. History is never rewritten.

  3. Confirm only 1 pod is running again:
    kubectl get pods -l app.kubernetes.io/instance=my-release
  4. View the rendered manifests for the current revision:
    helm get manifest my-release | head -40
  5. Uninstall the release:
    helm uninstall my-release

    Expected output:

    release "my-release" uninstalled
  6. Confirm everything is cleaned up:
    # No releases listed
    helm list
    
    # No resources remain
    kubectl get deployment,service,pod -l app.kubernetes.io/instance=my-release

    Expected: Empty results for both commands.

Self-check: helm list returns no results. No Kubernetes resources remain from the release.

Clean Up

You can remove the lab directory when finished:

rm -rf ~/helm-labs/lesson02/myapp

Or keep it around for the homework exercises.