Master Helm: A Complete Guide to Kubernetes Package Management
This comprehensive tutorial explains Helm as the Kubernetes package manager, covering its architecture, installation steps, core concepts like charts, releases, repositories, chart structure, dependencies, templating syntax, built‑in objects, common functions, control structures, named templates, NOTES.txt usage, and debugging techniques for effective Helm chart development.
Overview
Helm is the package manager for Kubernetes, similar to apt‑get/yum. Helm repositories contain only chart manifests; container images are provided by image registries such as Docker Hub.
Official documentation: https://v3.helm.sh/zh/docs/
Helm Architecture
Helm Installation
# Download package
wget https://get.helm.sh/helm-v3.9.4-linux-amd64.tar.gz
# Extract archive
tar -xf helm-v3.9.4-linux-amd64.tar.gz
# Create symlink
ln -s /opt/helm/linux-amd64/helm /usr/local/bin/helm
# Verify
helm version
helm helpHelm Components and Terminology
Helm– client tool for creating, packaging, and managing charts. Chart – a Helm package containing all Kubernetes resources needed for an application. Release – an instance of a chart deployed in a cluster. Repository – a storage location for sharing charts.
Chart Structure
Directory Layout
# helm create nginx
tree nginxnginx/
├── charts # dependent charts
├── Chart.yaml # chart metadata
├── templates/
│ ├── deployment.yaml
│ ├── _helpers.tpl
│ ├── hpa.yaml
│ ├── ingress.yaml
│ ├── NOTES.txt
│ ├── serviceaccount.yaml
│ ├── service.yaml
│ └── tests/
│ └── test-connection.yaml
└── values.yaml # default valuesChart.yaml Fields
apiVersion: chart API version (required)
name: chart name (required)
version: semantic version (required)
kubeVersion: compatible Kubernetes version (optional)
description: one‑line description (optional)
type: chart type (optional)
keywords: list of keywords (optional)
home: project home URL (optional)
sources: list of source URLs (optional)
dependencies: list of required charts (optional)
maintainers: list of maintainers (optional)
icon: URL of an SVG or PNG icon (optional)
appVersion: version of the contained application (optional)
deprecated: boolean flag (optional)
annotations: custom metadata (optional)Note: Starting with v3.3.2, additional fields are no longer allowed. Custom metadata should be added to annotations .
Dependencies
Dependencies are defined in the dependencies list of Chart.yaml. Example:
dependencies:
- name: apache
version: "1.2.3"
repository: "https://example.com/charts"
condition: subchart1.enabled
tags:
- front-end
import-values:
- dataRun helm dependency update to download the specified charts.
Templates and Values
Templates are written in Go templating language with Sprig functions and live in the templates/ directory. Values are supplied via values.yaml, additional -f files, or --set arguments.
Built‑in Objects
Release– provides .Name, .Namespace, .IsInstall, .IsUpgrade, etc. Values – the merged values from all sources. Chart – metadata from Chart.yaml. Files – access to non‑ignored files in the chart. Capabilities – Kubernetes version and API capabilities.
Common Functions
Examples include quote, default, printf, trim, upper, lower, replace, date, and many type‑conversion and list functions.
Control Structures
Use if / else, with, and range for conditional rendering and loops. Example of a range over a list of pizza toppings:
toppings: |-
{{- range .Values.pizzaToppings }}
- {{ . | title | quote }}
{{- end }}Named Templates
Define reusable snippets with {{ define "mychart.labels" }} … {{ end }} and include them via {{ template "mychart.labels" . }} or {{ include "mychart.labels" . | indent 4 }} to preserve indentation.
NOTES.txt
The templates/NOTES.txt file provides post‑install instructions to users. It is processed as a template but rendered as plain text.
Debugging
Useful commands: helm lint, helm install --dry-run --debug, helm template --debug, and helm get manifest. Comment out problematic sections and re‑run to isolate errors.
For the full reference, see the original article: https://www.cnblogs.com/liugp/p/16659802.html
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
