Part 2: Helm
Part 2: Helm
Section titled “Part 2: Helm”Helm is a package manager for Kubernetes. A Helm chart is a directory of templated YAML files plus a values file. You write the templates once, then deploy multiple instances with different values.
Treat Helm as a package manager. It works well for pulling in third-party charts with one or two commands. For your own manifests, Kustomize is simpler and more pleasant to work with.
Packaging with Helm
Section titled “Packaging with Helm”Creating Your First Chart
Section titled “Creating Your First Chart”# Scaffold a new charthelm create my-site
# Look at what was generatedtree my-site/The scaffold gives you:
Chart.yaml— metadata (name, version, description)values.yaml— default configuration valuestemplates/— Kubernetes manifests with Go template syntaxtemplates/deployment.yaml— the main workloadtemplates/service.yaml— network access to your podstemplates/ingress.yaml— external access rules
values.yaml
Section titled “values.yaml”The key fields to focus on first:
# values.yaml (trimmed to essentials)replicaCount: 1
image: repository: nginx tag: "latest" pullPolicy: IfNotPresent
service: type: ClusterIP port: 80
ingress: enabled: true className: traefik hosts: - host: mysite.example.com paths: - path: / pathType: Prefix tls: - secretName: mysite-tls hosts: - mysite.example.comInstead of one values.yaml, later we will create one per environment. The chart stays the same; only the values change:
my-site/ Chart.yaml values.yaml # defaults values-dev.yaml # local dev overrides values-staging.yaml # staging overrides values-prod.yaml # production overridesSummary
Section titled “Summary”Helm is a package manager. Use it to install third-party charts. Use Kustomize for everything else — see Helm vs Kustomize for the full comparison.