Lesson 02 Your First Chart
Theme:
Lesson 02 · Slide 1

Your First Chart

Learn how to scaffold, understand, and deploy a Helm chart from scratch — from helm create through the full install/upgrade/rollback lifecycle.

Learning Objectives

Lesson 02 · Slide 2

helm create — Scaffolding a Chart

The helm create command generates a complete, best-practice chart structure ready to customize.

# Create a new chart called "myapp"
helm create myapp

# What gets generated:
myapp/
  Chart.yaml          # Chart metadata
  values.yaml         # Default configuration values
  charts/             # Dependency charts (subcharts)
  templates/          # Kubernetes manifest templates
    deployment.yaml
    service.yaml
    ingress.yaml
    hpa.yaml
    serviceaccount.yaml
    _helpers.tpl       # Reusable template partials
    NOTES.txt          # Post-install message template
    tests/
      test-connection.yaml
  .helmignore          # Files to exclude from packaging

Why Start with helm create?

The scaffolded chart follows Helm best practices: proper labeling, helper templates, and a sensible default deployment. It deploys an nginx container out of the box.

Lesson 02 · Slide 3

Chart.yaml — Chart Metadata

Every chart must contain a Chart.yaml. This file defines the chart’s identity and version information.

apiVersion: v2              # v2 for Helm 3 charts
name: myapp                 # Chart name (must match directory)
description: A Helm chart for my application
type: application           # "application" or "library"
version: 0.1.0              # Chart version (SemVer)
appVersion: "1.0.0"         # Version of the app being deployed
FieldRequiredPurpose
apiVersionYesAlways v2 for Helm 3
nameYesChart name, used in release naming
versionYesChart version — bump on every change
appVersionNoVersion of the deployed application
descriptionNoOne-line summary shown in helm search
typeNoapplication (default) or library
Notes: version tracks the chart packaging. appVersion tracks the application inside it. They are independent — you can update the chart without changing the app, and vice versa.
Lesson 02 · Slide 4

values.yaml — Configuration Defaults

The values.yaml file provides default values that templates consume via {{ .Values.* }}. Users override these at install time.

# values.yaml
replicaCount: 1

image:
  repository: nginx
  pullPolicy: IfNotPresent
  tag: ""               # Defaults to chart appVersion

service:
  type: ClusterIP
  port: 80

ingress:
  enabled: false
  className: ""
  hosts:
    - host: chart-example.local
      paths:
        - path: /
          pathType: ImplementationSpecific

resources:
  limits:
    cpu: 100m
    memory: 128Mi
  requests:
    cpu: 100m
    memory: 128Mi

Override Values at Install Time

# Inline override
helm install myrelease ./myapp --set replicaCount=3

# File override
helm install myrelease ./myapp -f production.yaml
Lesson 02 · Slide 5

The templates/ Directory

Templates are Go-templated Kubernetes manifests. Helm renders them with values to produce valid YAML.

Core Templates

  • deployment.yaml — Pod spec, replicas, image, probes
  • service.yaml — ClusterIP/NodePort/LoadBalancer
  • ingress.yaml — HTTP routing (conditionally rendered)
  • hpa.yaml — Horizontal Pod Autoscaler
  • serviceaccount.yaml — RBAC identity

Special Files

  • _helpers.tpl — Named template definitions (partials). Not rendered directly; included by other templates.
  • NOTES.txt — Post-install instructions shown to users after helm install.
  • tests/ — Templates for helm test validation.
# templates/deployment.yaml (excerpt)
spec:
  replicas: {{ .Values.replicaCount }}
  template:
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          ports:
            - containerPort: {{ .Values.service.port }}
Lesson 02 · Slide 6

The Release Lifecycle

Helm manages releases through four key commands. Each command tracks revisions so you can inspect history and roll back.

# 1. INSTALL — create a new release
helm install myrelease ./myapp --namespace default

# 2. UPGRADE — update an existing release
helm upgrade myrelease ./myapp --set image.tag=2.0.0

# 3. ROLLBACK — revert to a previous revision
helm rollback myrelease 1

# 4. UNINSTALL — remove the release entirely
helm uninstall myrelease

Revision Tracking

ActionRevisionStatus
helm install1deployed
helm upgrade2deployed
helm rollback 13deployed (config from rev 1)

Rollback creates a new revision — it does not delete history.

Lesson 02 · Slide 7

Inspecting Releases

Helm provides several commands to query release state, history, and rendered manifests.

# List all releases in the current namespace
helm list

# Detailed status of a specific release
helm status myrelease

# Revision history with timestamps and descriptions
helm history myrelease

# Get the rendered manifests for the current revision
helm get manifest myrelease

# Get the computed values (defaults + overrides)
helm get values myrelease

helm list output

NAME       REVISION  STATUS    CHART        APP VERSION
myrelease  2         deployed  myapp-0.1.0  1.0.0

helm history output

REVISION  STATUS      DESCRIPTION
1         superseded  Install complete
2         deployed    Upgrade complete
Lesson 02 · Slide 8

NOTES.txt & Lab Preview

The NOTES.txt template renders post-install instructions. Users see this output after every helm install and helm upgrade.

# templates/NOTES.txt
1. Get the application URL by running:
{{- if .Values.ingress.enabled }}
  http://{{ (index .Values.ingress.hosts 0).host }}
{{- else if eq .Values.service.type "NodePort" }}
  export NODE_PORT=$(kubectl get svc {{ include "myapp.fullname" . }} -o jsonpath="{.spec.ports[0].nodePort}")
  echo http://$NODE_IP:$NODE_PORT
{{- else if eq .Values.service.type "ClusterIP" }}
  kubectl port-forward svc/{{ include "myapp.fullname" . }} 8080:{{ .Values.service.port }}
  echo http://127.0.0.1:8080
{{- end }}

Lab Exercises

  1. Scaffold a chart with helm create and explore every file
  2. Install & upgrade the chart, inspecting status at each step
  3. Rollback & uninstall to complete the full lifecycle

Homework Tasks

  1. Customize values.yaml for a real application
  2. Write a custom NOTES.txt template
  3. Document the full revision history after multiple upgrades
1 / ?