Skip to content
devops/architect
03 helm 01 01 helm
0/7 read · lab 0/1
Module 03
// helm

Helm — Kubernetes Package Engineering

Master Helm chart anatomy, Go templating with 100+ Sprig functions, values schema validation, release hooks, OCI registries, and production packaging patterns. Zero to chart publisher.

Startup SME Enterprise Killercoda Udemy

Lesson objective

What it teaches
Under-The-Hood: How Helm Works · Chart Anatomy & Components · WSL Hands-On Lab — Build & Publish a Chart · Real-World Project: Package Your App · Troubleshooting & Disaster Recovery · Interactive Lab Checklist
Why it matters
A required lesson for Platform Engineer, Container/Kubernetes Engineer, Release / CI-CD Engineer. Recommended for DevOps Engineer. See the role paths
What you demonstrate
  • Simulated lab: Run the first command shown in the section “Under-The-Hood: How Helm Works”. Recorded as lab evidence.
  • Predict 3 results this lesson prints. You mark each one yourself.
  • Optional, real environment: 7 hands-on tasks on your own machine or an external lab site (checklist). Not tracked as evidence.
  1. Orient
  2. Read
  3. Predict
  4. Run
  5. Verify
  6. Reflect
  7. Continue

Under-The-Hood: How Helm Works 01

Helm v3 Architecture (Client-Only, No Tiller)

Unlike Helm v2, Helm v3 is a client-only binary. There is no in-cluster Tiller server. All template rendering happens locally on your CLI.

Local Template Rendering Engine
  1. Load chart files: Helm reads Chart.yaml, values.yaml, and all files in templates/.
  2. Merge values hierarchy: Default values ← -f custom.yaml overrides ← --set key=val overrides (highest priority).
  3. Go template rendering: The text/template library processes all {{ }} expressions. 100+ Sprig helper functions are available (upper, trunc, include, tpl, toYaml, nindent, etc.).
  4. Schema validation: If values.schema.json exists, Helm validates user-supplied values against it before rendering.
  5. Hook separation: Helm separates manifests annotated with helm.sh/hook from regular resources.
  6. Deploy to API server: Validated manifests are pushed to the Kubernetes API server via your local kubeconfig context.
  7. Release state storage: Helm stores the complete release state (manifest + values + metadata) as a gzip-compressed, base64-encoded Kubernetes Secret in the release namespace.
Release State Storage (Kubernetes Secrets)

Every helm install or helm upgrade creates a versioned Secret:

Release secrets
$ kubectl get secret -n production -l "owner=helm,name=my-app"
NAME                              TYPE                  DATA   AGE
sh.helm.release.v1.my-app.v1      helm.sh/release.v1    1      5d
sh.helm.release.v1.my-app.v2      helm.sh/release.v1    1      2d
sh.helm.release.v1.my-app.v3      helm.sh/release.v1    1      1h  ← current

# The release payload is base64 → gzip → JSON
$ kubectl get secret sh.helm.release.v1.my-app.v3 \
    -o jsonpath='{.data.release}' | base64 -d | gzip -d | jq '.info.status'
"deployed"
Hook Lifecycle & Weight Ordering

Hooks intercept release operations. Execution order:

  1. Templates are rendered; hook manifests are extracted and sorted by helm.sh/hook-weight (ascending).
  2. Pre-install/pre-upgrade hooks run sequentially (lower weight first). Helm waits for each Job to complete.
  3. If a hook Job fails → release is aborted, marked FAILED.
  4. Standard resources are deployed to the cluster.
  5. Post-install/post-upgrade hooks run.
  6. helm.sh/hook-delete-policy: hook-succeeded cleans up completed hook pods.

Helm Install Execution Flow

graph TD A["helm install my-app ./chart\n-f values-prod.yaml"] --> B["Load Chart files\nChart.yaml + templates/ + values.yaml"] B --> C["Merge Values Hierarchy\ndefault ← -f file ← --set flags"] C --> D["Go text/template Engine\n+ 100+ Sprig Functions"] D --> E["values.schema.json\nValidation"] E --> F{Schema Valid?} F -- "No" --> G["Error: values validation failed\nRelease aborted"] F -- "Yes" --> H["Separate Hook manifests\nSort by hook-weight"] H --> I["Execute pre-install Hooks\ne.g. DB migration Job"] I --> J{Hook succeeded?} J -- "No" --> K["Release marked FAILED\nSecrets stored for debugging"] J -- "Yes" --> L["Apply standard manifests\nto K8s API server"] L --> M["Create Release Secret\nsh.helm.release.v1.my-app.vN\ngzip + base64 encoded"] M --> N["Execute post-install Hooks\ne.g. Slack notification"] N --> O["Print NOTES.txt\n& Release Summary"]
Helm: Undo Mistakes, Boost Your Code! · 59s

Chart Anatomy & Components 02

File / DirectoryRoleKey DirectivesBest Practice
Chart.yamlChart metadata, API version, dependencies listapiVersion: v2, name, version, appVersion, dependenciesKeep version (chart) and appVersion (app) semantically separate. Use SemVer.
values.yamlDefault configuration values. Users override with -f or --setFlat or nested YAML. Supports global: scope for subchartsGroup logically, add YAML comments above every block to self-document defaults.
templates/Go template files rendered into K8s manifests{{ .Values.* }}, {{ .Release.* }}, {{ .Chart.* }}, conditionals, loopsOne resource type per file: deployment.yaml, service.yaml, ingress.yaml.
_helpers.tplReusable named templates (partials). Not rendered directly.{{- define "chart.name" -}}, {{ include }}Prefix helpers with chart name to avoid collision in subcharts.
charts/Dependency chart packages (.tgz) fetched by helm dependency updateAuto-populated from dependencies: in Chart.yamlAdd to .gitignore. Commit only Chart.lock.
values.schema.jsonJSON Schema to validate user-supplied values BEFORE installtype, required, properties, minimum, enum, patternRequired for all production charts. Catches misconfigurations before they reach the cluster.
NOTES.txtInstructions printed to terminal after successful installCan use Go template expressions: {{ .Release.Name }}Include service URL, next steps, and relevant kubectl commands.
Chart.lockExact dependency versions pinned after helm dependency updateDigest hashes for reproducibilityAlways commit this file. Ensures reproducible builds across environments.

WSL Hands-On Lab — Build & Publish a Chart 03

Prerequisites
Requires: helm, kubectl, kind (from Module 02 lab). Estimated time: 90 minutes.

Step 1 — Scaffold & Explore Your First Chart

Create chart scaffold
# Create chart scaffold
$ helm create my-api-chart

my-api-chart/
├── Chart.yaml            ← Chart metadata
├── values.yaml           ← Default values
├── charts/               ← Dependency charts (empty for now)
└── templates/
    ├── _helpers.tpl       ← Reusable template partials
    ├── deployment.yaml
    ├── service.yaml
    ├── serviceaccount.yaml
    ├── hpa.yaml
    ├── ingress.yaml
    └── NOTES.txt

# Validate the chart without installing
$ helm lint ./my-api-chart --strict
[INFO] Chart.yaml: icon is recommended
[INFO] values.yaml: file linted
1 chart(s) linted, 0 chart(s) failed

# Preview rendered manifests (dry run)
$ helm template my-release ./my-api-chart \
    --set replicaCount=3 \
    --debug

# Install with dry-run to check against live cluster
$ helm install my-release ./my-api-chart \
    --dry-run --debug -n default

Step 2 — Write a Production Chart with Schema Validation

Chart.yamlyaml
apiVersion: v2
name: my-api-chart
description: "A production-grade Node.js API Helm chart"
type: application
version: 1.0.0        # Chart release version (SemVer)
appVersion: "2.3.1"    # Application version inside the image
keywords:
  - nodejs
  - api
  - microservice
maintainers:
  - name: DevOps Architect
    email: devops@company.com
dependencies:
  - name: postgresql
    version: 12.1.0
    repository: https://charts.bitnami.com/bitnami
    condition: postgresql.enabled   # Only install if flag is true
values.yamlyaml
# ── Replica Settings ──────────────────────────────
replicaCount: 2

# ── Image Configuration ───────────────────────────
image:
  repository: my-registry/my-api
  pullPolicy: IfNotPresent
  tag: ""    # Defaults to Chart appVersion if empty

# ── Service Account ────────────────────────────────
serviceAccount:
  create: true
  annotations: {}
  name: ""

# ── Service ────────────────────────────────────────
service:
  type: ClusterIP
  port: 3000

# ── Ingress ────────────────────────────────────────
ingress:
  enabled: false
  className: "nginx"
  annotations: {}
  hosts:
    - host: api.example.com
      paths: [{ path: /, pathType: Prefix }]

# ── Resource Limits ────────────────────────────────
resources:
  requests: { cpu: 100m, memory: 128Mi }
  limits:   { cpu: 500m, memory: 256Mi }

# ── Autoscaling ────────────────────────────────────
autoscaling:
  enabled: false
  minReplicas: 2
  maxReplicas: 10
  targetCPUUtilizationPercentage: 80

# ── Database Connection ────────────────────────────
dbConnection:
  host: "postgres-svc"
  port: 5432
  name: "myapp_db"
  username: "app_user"
  passwordSecretName: "db-credentials"
  passwordSecretKey: "password"

# ── PostgreSQL Subchart ─────────────────────────────
postgresql:
  enabled: false   # Set true for local dev
values.schema.jsonjson
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "required": ["replicaCount", "image", "service", "dbConnection"],
  "properties": {
    "replicaCount": {
      "type": "integer",
      "minimum": 1,
      "maximum": 50
    },
    "image": {
      "type": "object",
      "required": ["repository", "pullPolicy"],
      "properties": {
        "repository": { "type": "string" },
        "pullPolicy": {
          "type": "string",
          "enum": ["Always", "IfNotPresent", "Never"]
        },
        "tag": { "type": "string" }
      }
    },
    "service": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": ["ClusterIP", "NodePort", "LoadBalancer"]
        },
        "port": { "type": "integer", "minimum": 1, "maximum": 65535 }
      }
    },
    "dbConnection": {
      "type": "object",
      "required": ["host", "port", "name", "username"],
      "properties": {
        "host":     { "type": "string" },
        "port":     { "type": "integer", "minimum": 1 },
        "name":     { "type": "string" },
        "username": { "type": "string" }
      }
    }
  }
}
templates/_helpers.tplgotmpl
{{/* ── Chart Name ─────────────────────────────── */}}
{{- define "my-api-chart.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end }}

{{/* ── Fully Qualified App Name (max 63 chars) ─── */}}
{{- define "my-api-chart.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end }}

{{/* ── Standard Labels ─────────────────────────── */}}
{{- define "my-api-chart.labels" -}}
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 }}
{{ include "my-api-chart.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/* ── Selector Labels ─────────────────────────── */}}
{{- define "my-api-chart.selectorLabels" -}}
app.kubernetes.io/name: {{ include "my-api-chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/* ── Service Account Name ───────────────────── */}}
{{- define "my-api-chart.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{- default (include "my-api-chart.fullname" .) .Values.serviceAccount.name -}}
{{- else -}}
{{- default "default" .Values.serviceAccount.name -}}
{{- end -}}
{{- end }}
templates/deployment.yamlyaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "my-api-chart.fullname" . }}
  labels:
    {{- include "my-api-chart.labels" . | nindent 4 }}
spec:
  {{- if not .Values.autoscaling.enabled }}
  replicas: {{ .Values.replicaCount }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "my-api-chart.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        {{- include "my-api-chart.selectorLabels" . | nindent 8 }}
    spec:
      serviceAccountName: {{ include "my-api-chart.serviceAccountName" . }}
      securityContext:
        runAsNonRoot: true
        runAsUser: 1000
        fsGroup: 2000
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: {{ .Values.service.port }}
          env:
            - name: DB_HOST
              value: {{ .Values.dbConnection.host | quote }}
            - name: DB_PORT
              value: {{ .Values.dbConnection.port | quote }}
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: {{ .Values.dbConnection.passwordSecretName | quote }}
                  key:  {{ .Values.dbConnection.passwordSecretKey | quote }}
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
          readinessProbe:
            httpGet: { path: /health, port: http }
            initialDelaySeconds: 5
          livenessProbe:
            httpGet: { path: /health, port: http }
            initialDelaySeconds: 15
templates/pre-install-hook.yamlyaml
apiVersion: batch/v1
kind: Job
metadata:
  name: "{{ include "my-api-chart.fullname" . }}-db-migrate"
  annotations:
    # This runs BEFORE install AND upgrade
    "helm.sh/hook":               pre-install,pre-upgrade
    "helm.sh/hook-weight":        "5"
    "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
spec:
  backoffLimit: 3
  template:
    spec:
      restartPolicy: Never
      containers:
        - name: db-migrator
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          command: ["node", "scripts/migrate.js"]
          env:
            - name: DB_HOST
              value: {{ .Values.dbConnection.host | quote }}
            - name: DB_NAME
              value: {{ .Values.dbConnection.name | quote }}
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: {{ .Values.dbConnection.passwordSecretName | quote }}
                  key:  {{ .Values.dbConnection.passwordSecretKey | quote }}

Step 3 — Install, Upgrade & Package

Full Helm workflow
# Install to Kind cluster
$ kubectl create secret generic db-credentials \
    --from-literal=password=supersecret -n default

$ helm install my-api ./my-api-chart -n default

# View release details
$ helm list
NAME     NAMESPACE  REVISION  STATUS    CHART               APP VERSION
my-api   default    1         deployed  my-api-chart-1.0.0  2.3.1

# Upgrade with new values
$ helm upgrade my-api ./my-api-chart --set replicaCount=3

# View history
$ helm history my-api
REVISION  STATUS    CHART               DESCRIPTION
1         superseded my-api-chart-1.0.0  Install complete
2         deployed   my-api-chart-1.0.0  Upgrade complete

# Rollback to revision 1
$ helm rollback my-api 1

# Package chart as .tgz for distribution
$ helm package ./my-api-chart
Successfully packaged chart: ./my-api-chart-1.0.0.tgz

# Push to OCI registry (GitHub Container Registry)
$ helm push my-api-chart-1.0.0.tgz oci://ghcr.io/your-username/charts
Pushed: ghcr.io/your-username/charts/my-api-chart:1.0.0
Digest: sha256:abc123...

# Install directly from OCI registry
$ helm install my-api oci://ghcr.io/your-username/charts/my-api-chart \
    --version 1.0.0

SOPS Encrypted Values: Asymmetric Secrets & Release Secret Exposure

Local secrets architecture and exposure analysis. Assumptions: Helm v3.14+, Mozilla SOPS v3.9+, age v1.2+, and Bash 5+. See official SOPS Documentation, Helm Security Architecture, and Kubernetes Encrypting Secret Data at Rest. No cloud KMS credentials or production keys required.

Passing plaintext passwords via --set db.password="secret" exposes credentials in system process listings (/proc/$PID/cmdline, ps aux), shell history, and CI logs. Using Mozilla SOPS with age encrypts only the value fields of a values YAML file (keeping keys visible for diffs) using AES256-GCM.

secrets.enc.yaml
database:
  host: postgres.production.svc.cluster.local
  username: app_user
  password: ENC[AES256_GCM,data:qW0F6+K8fB0=,iv:8v7n9Q==,tag:Xw==,type:str]
sops:
  kms: []
  age:
    - recipient: age1ql3z7hjy54pw3hyww5ayyfg7zqgvc7w3j2elw8zmrj2kg5sfn9aqmcac8p
      enc: |
        -----BEGIN AGE ENCRYPTED FILE-----
        YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAxMjMK
        -----END AGE ENCRYPTED FILE-----
  lastmodified: "2026-10-15T12:00:00Z"
  mac: ENC[AES256_GCM,data:ab12...,tag:cd34==,type:str]
  version: 3.9.1

Safe invocation prevents writing unencrypted plaintext secrets to disk by decrypting directly into an anonymous file descriptor or FIFO pipe using Bash process substitution:

safe-helm-invocation.sh
# Safe execution: Decrypt directly into a process stream descriptor (/dev/fd/63)
export SOPS_AGE_KEY_FILE="${HOME}/.config/sops/age/keys.txt"
helm upgrade --install my-api ./my-api-chart \
  --namespace production \
  --values values.yaml \
  --values <(sops -d secrets.enc.yaml) \
  --wait --timeout 5m

Release Secret Exposure Warning: Even when values are encrypted in Git, Helm client-side rendering stores the fully-rendered manifests and values inside a base64-encoded, gzipped Kubernetes Secret named sh.helm.release.v1.my-api.v1. Anyone with get secret permissions in the namespace can extract cleartext credentials:

inspect-release-secret.sh
# Demonstrating release Secret cleartext extraction risk
kubectl get secret -n production -l "owner=helm,name=my-api" \
  -o jsonpath='{.items[0].data.release}' \
  | base64 -d | gzip -d \
  | jq '.chart.values.database.password, .manifest'

# Recommended mitigations:
# 1. Enable Kubernetes API server KMS encryption at rest (EncryptionConfiguration)
# 2. Restrict RBAC get/list/watch on 'owner=helm' Secret resources
# 3. Use External Secrets Operator (ESO) to reference secrets by ARN/key rather than passing values

Real-World Project: Package Your App 04

Startup: Your First Helm Chart

Package a Node.js Express API into a reusable Helm chart that you can deploy to Kind locally and push to GHCR for free.

  • Run helm create my-api-chart and explore the structure
  • Update values.yaml with your app's image name and port
  • Run helm lint --strict and fix any warnings
  • Install to Kind with helm install and verify the Pod is running

SME: Multi-Environment Values Override

You have dev, staging, and production environments. Each gets its own values file overriding defaults.

Multi-env deployment
# Development: 1 replica, internal image, local DB
$ helm install my-api ./my-api-chart -f values-dev.yaml -n development

# Staging: 2 replicas, ingress enabled, staging DB
$ helm install my-api ./my-api-chart -f values-staging.yaml -n staging

# Production: 3+ replicas, HPA enabled, Aurora RDS
$ helm install my-api ./my-api-chart -f values-production.yaml -n production \
    --set image.tag=v2.3.1-prod \
    --atomic \
    --timeout 5m

Enterprise: Private Chart Museum + CI/CD Integration

Centralized Chartmuseum (or OCI registry on ECR) with automated chart publishing via GitHub Actions. Semantic versioning enforced by CI.

Enterprise Chart Pipeline
PR merged → GitHub Actions: helm lint → helm test → helm package → chart version bumped → pushed to ECR OCI registry → ArgoCD ApplicationSet picks up new chart version → canary deploy to 5% traffic → full rollout.

Enterprise Canary: 5% Ingress Traffic Splitting & Rollback Analysis

Progressive delivery traffic management. Assumptions: Ingress-Nginx v1.10+, Helm v3.14+, and Prometheus v2.54+. See official Ingress-Nginx Canary Annotations, Argo Rollouts Canary, and Helm Rollback Documentation. Simulated canary telemetry evaluation; no live traffic controller modified.

Standard replica scaling fails for canary testing on small workloads: with 2 pods, routing 1 canary pod exposes 50% of users to new code. Ingress-Nginx decouples traffic weight from replica count by using canary annotations to split exact request percentages.

templates/canary-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-api-canary
  namespace: production
  annotations:
    nginx.ingress.kubernetes.io/canary: "true"
    nginx.ingress.kubernetes.io/canary-weight: "5"
spec:
  ingressClassName: nginx
  rules:
    - host: api.production.company.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: my-api-canary-svc
                port:
                  number: 8080

Canary verification tests traffic metrics against strict operational SLOs: error rate must remain ≤ 1.0% and P99 latency must remain ≤ 200ms over a 10-minute evaluation window:

Evaluation MetricPromQL ExpressionPass ThresholdAction on Failure
HTTP Error Ratesum(rate(nginx_ingress_controller_requests{status=~"5.*"}[2m])) / sum(...)≤ 1.0%Abort → Canary weight 0% → Helm rollback
P99 Latencyhistogram_quantile(0.99, sum(rate(nginx_ingress_controller_request_duration_seconds_bucket[5m])) by (le))≤ 0.200sAbort → Canary weight 0% → Helm rollback
Sample Volumesum(increase(nginx_ingress_controller_requests[5m]))≥ 100 requestsHold evaluation (insufficient statistical significance)
canary-triage-rollback.sh
# 1. Cut canary traffic to 0% immediately upon threshold breach
kubectl annotate ingress my-api-canary \
  nginx.ingress.kubernetes.io/canary-weight="0" --overwrite -n production

# 2. Roll back Helm release to the previous stable revision
helm rollback my-api 0 --wait --timeout 3m -n production

# 3. Confirm 100% stable traffic and capture crash logs
helm status my-api -n production
kubectl logs -n production -l app.kubernetes.io/instance=my-api --tail 100

Troubleshooting & Disaster Recovery 05

Release stuck in pending-upgrade — another operation is in progress

When a CI job is killed mid-deploy, the Helm release Secret is locked. Fix:

Unlock stuck release
# 1. Find the stuck release Secret
$ kubectl get secret -n production -l "owner=helm,name=my-app"

# 2. Decode the release payload
$ kubectl get secret sh.helm.release.v1.my-app.v5 \
    -o jsonpath='{.data.release}' | base64 -d | gzip -d > /tmp/release.json

# 3. Change "status" from "pending-upgrade" to "failed" in /tmp/release.json
$ jq '.info.status = "failed"' /tmp/release.json > /tmp/release-fixed.json

# 4. Re-encode and patch the Secret
$ ENCODED=$(gzip -c /tmp/release-fixed.json | base64 | tr -d '\n')
$ kubectl patch secret sh.helm.release.v1.my-app.v5 -n production \
    --type='json' \
    -p="[{\"op\":\"replace\",\"path\":\"/data/release\",\"value\":\"$ENCODED\"}]"
secret/sh.helm.release.v1.my-app.v5 patched

# 5. Now helm list should show "failed" — you can upgrade normally
$ helm list -n production
$ helm upgrade my-app ./chart -n production
Template rendering error: nil pointer / wrong type
Debug template errors
# Use helm template to see rendering errors without deploying
$ helm template my-release ./my-chart --debug 2>&1 | head -50

# Common fix: use default function to handle nil values
# BAD:  {{ .Values.ingress.annotations }} — panics if ingress is nil
# GOOD: {{ .Values.ingress.annotations | default dict | toYaml }}

# Test schema validation errors separately
$ helm install test ./my-chart --set replicaCount="not-a-number" --dry-run
Error: values don't meet the specifications of the schema(s)
  - replicaCount: Invalid type. Expected: integer, given: string
Dependency chart not found after helm dependency update
Fix dependency issues
# Add the repository first, then update
$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm repo update
$ helm dependency update ./my-api-chart
Saving 1 charts
Downloading postgresql from repo https://charts.bitnami.com/bitnami
Deleting outdated charts
Update Complete. ⎈Happy Helming!⎈

# Verify the lock file is correct
$ cat my-api-chart/Chart.lock

Release Observability: PromQL Telemetry, Alerts & Failure Diagnosis

Production monitoring and release recovery runbook. Assumptions: Helm v3.14+, Prometheus v2.54+, helm-exporter v1.3+, and kube-state-metrics v2.13+. See official Prometheus Alerting Rules, helm-exporter Documentation, and kube-state-metrics Documentation. Simulated metrics; no live cluster scrape required.

Because Helm operates as a transient CLI client rather than a long-running daemon, it has no native /metrics HTTP endpoint. Observability requires two exporter prerequisites: helm-exporter (which monitors release states stored in cluster Secrets) and kube-state-metrics (which tracks Deployment rollout conditions).

monitoring/helm-alerts.yaml
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: helm-release-alerts
  namespace: monitoring
spec:
  groups:
    - name: helm.rules
      rules:
        - alert: HelmReleaseFailed
          expr: sum by (namespace, release) (helm_release_status{status="failed"} == 1)
          for: 5m
          labels:
            severity: critical
          annotations:
            summary: "Helm release {{ $labels.release }} failed in {{ $labels.namespace }}"
            runbook: "https://wiki.internal.net/ops/helm-release-failed"

        - alert: HelmReleaseStuckPending
          expr: sum by (namespace, release) (helm_release_status{status=~"pending-.*"} == 1)
          for: 15m
          labels:
            severity: warning
          annotations:
            summary: "Helm release {{ $labels.release }} stuck in pending state"

        - alert: HelmReleaseRollbackDetected
          expr: delta(helm_release_revision[30m]) < 0
          for: 1m
          labels:
            severity: info
          annotations:
            summary: "Helm release {{ $labels.release }} rolled back to an earlier revision"

When an automated deployment stalls or fails, follow this ordered triage sequence to distinguish hook Job failures from Pod crash loops:

helm-failure-diagnosis.sh
# Step 1: Check release revision status and error messages
helm status my-api -n production
helm history my-api -n production

# Step 2: Differentiate Hook failure vs Workload failure
# If hook Job failed:
kubectl logs -n production -l "helm.sh/hook=pre-install" --tail 50
# If Deployment rollout timed out:
kubectl describe deployment my-api -n production

# Step 3: Clear stuck pending state and restore stable release
# Patch Secret status if release is locked in 'pending-upgrade':
kubectl patch secret -n production -l "owner=helm,name=my-api,status=pending-upgrade" \
  --type='json' -p='[{"op":"replace","path":"/metadata/labels/status","value":"failed"}]'
helm rollback my-api 0 --wait --timeout 3m -n production

Interactive Lab Checklist 06

Helm Hands-On Tasks

  • Create a chart with helm create, inspect every generated file, understand its purpose
  • Run helm lint --strict and helm template --debug on your chartKillercoda
  • Add values.schema.json with required fields. Test that invalid values cause install to fail.
  • Add a pre-install hook Job that prints a database migration message, verify it runs before Deployment
  • Perform helm upgrade and helm rollback, inspect helm history
  • Simulate a stuck release by manually setting the Secret status to pending-upgrade, then fix it
  • Package your chart and push to GHCR OCI registry. Install it back with helm install oci://...

30-Day Learning Roadmap 07

Week 1
Go Templating & Sprig
  • Values hierarchy, context objects
  • if/else, range, with blocks
  • Sprig: trunc, upper, quote, nindent
  • Pipeline expressions
Week 2
Schema & Validation
  • values.schema.json: type, required, enum
  • Custom error messages
  • helm-unittest for template testing
  • Strict linting in CI
Week 3
Hooks & Registries
  • All hook types and weight ordering
  • Delete policies for cleanup
  • OCI registry push/pull
  • Chartmuseum setup
Week 4
GitOps & Hardening
  • ArgoCD + Helm integration
  • SOPS encrypted values
  • Chart dependency management
  • Release state recovery procedures

Predict: results this lesson prints

Write what you expect, then compare with the lesson. You mark each result yourself; it is recorded as predict evidence.

What result does the lesson show for this command?

$ kubectl get secret -n production -l "owner=helm,name=my-app"
Show the lesson's result

The lesson shows in Under-The-Hood: How Helm Works:

NAME                              TYPE                  DATA   AGE
sh.helm.release.v1.my-app.v1      helm.sh/release.v1    1      5d
sh.helm.release.v1.my-app.v2      helm.sh/release.v1    1      2d
sh.helm.release.v1.my-app.v3      helm.sh/release.v1    1      1h  ← current

What result does the lesson show for this command?

$ kubectl get secret sh.helm.release.v1.my-app.v3 \
    -o jsonpath='{.data.release}' | base64 -d | gzip -d | jq '.info.status'
Show the lesson's result

The lesson shows in Under-The-Hood: How Helm Works:

"deployed"

What result does the lesson show for this command?

$ helm lint ./my-api-chart --strict
Show the lesson's result

The lesson shows in WSL Hands-On Lab — Build & Publish a Chart:

[INFO] Chart.yaml: icon is recommended
[INFO] values.yaml: file linted
1 chart(s) linted, 0 chart(s) failed

Practice: troubleshoot and decide

Commit to an answer before each result is shown. Finishing a drill or a decision is recorded as evidence for the sections it builds on.

Troubleshooting drill

Image tag 1.10 deploys version 1.1

Output recorded from a real run on Helm v3.19.0 from the alpine/helm image in Docker, run from Git Bash on Windows; helm template only, no cluster involved. Nothing runs on your machine.

Builds on Chart Anatomy & Components, Troubleshooting & Disaster Recovery.

The web team bumped image.tag in values.yaml from 1.9 to 1.10 and the release rolled out without errors, but production is now running an image from last year: kubectl shows registry.acme.io/web:1.1. The same chart deployed 1.10 correctly in staging, where the pipeline passes the tag with --set.

  1. Step 1 of 3: Production runs :1.1 although values.yaml says 1.10. Where do you look first?

Design decision

Upgrade failed after the migration hook ran: how do you go back?

Builds on WSL Hands-On Lab — Build & Publish a Chart, Troubleshooting & Disaster Recovery.

Release 42 of the orders service ran a pre-upgrade hook Job that renamed the column customer_ref to customer_id and backfilled it, then rolled out the new pods. The new version fails under real traffic (a bad query plan) and the error rate is 12 percent. helm rollback orders 41 would bring back pods that still query customer_ref.

Constraints

  • Orders keep arriving; a snapshot restore loses every order written since the upgrade
  • Error budget allows about 15 more minutes at this error rate
  • The migration tool supports down-migrations, but this one was never tested
  • Future releases go out weekly with the same chart
Which do you choose?

Lab: simulated terminal, nothing runs on your machine

Simulated nothing runs on your machine

  1. 1 Run the first command shown in the section “Under-The-Hood: How Helm Works”
Run the first command shown in the section “Under-The-Hood: How Helm Works”

Ready. Type the command for the current goal.

Check yourself

A chart sets a default value, a custom -f file changes it, and --set supplies a third value for the same key. Which value wins?

Explanation

In 'Under-The-Hood: How Helm Works', Merge values hierarchy gives defaults, then -f overrides, then '--set key=val' at highest priority. Later higher-priority overrides determine this key.

You want invalid user values rejected before chart templates render. Which chart file provides that check?

Explanation

In 'Chart Anatomy & Components', values.schema.json validates user-supplied values before install. 'Under-The-Hood: How Helm Works' explicitly places this validation before rendering; helpers, dependency locks, and notes have other purposes.

An aborted upgrade leaves a Helm release pending-upgrade. The lesson's recovery procedure resets info.status to failed. Which resource holds that release data?

Explanation

In 'Troubleshooting & Disaster Recovery', 'Release stuck in pending-upgrade' updates info.status from pending-upgrade to failed in the data held by the versioned release Secret. Chart validation, dependency, and template files do not hold that release status.

A team passes a database password with --set in CI. Why does the lesson recommend encrypted values and a decryption stream instead?

Explanation

In 'SOPS Encrypted Values', plaintext --set passwords are exposed in process listings, shell history, and CI logs. The section shows SOPS and a decryption stream; values precedence, helpers, and dependency locks address other concerns.

Why doesn't a Helm v3 install require an in-cluster Tiller server?

Helm v3 renders templates locally and sends manifests to the Kubernetes API server through the local kubeconfig.

Space flips the current card.

Capability coverage: L1, L2, L3 covered

No lesson evidence yet. Start reading this lesson, then run its free lab to record demonstrated checks.

Each cell counts this lesson's sections for that skill and level. Complete needs a demonstrated check (today only the lab); reading a section shows Developing. Not covered means the lesson has no material there.

Skills by experience level for this lesson
SkillL1 FoundationL2 PractitionerL3 ProductionL4 Architect
Understand Missing · 2 sections Not covered Not covered Not covered
Operate Not covered Missing · 3 sections Not covered Not covered
Troubleshoot Not covered Not covered Missing · 1 section Not covered
Automate Not covered Missing · 3 sections Not covered Not covered
Secure Not covered Not covered Not covered Not covered
Observe Not covered Not covered Not covered Not covered
Design Not covered Not covered Not covered Not covered
Make trade-offs Not covered Not covered Not covered Not covered

How this lesson fits each role