Kubernetes·7 min read·

Helm Basics: Packaging and Templating Kubernetes Charts

Package manifests into reusable Helm charts, parameterize values with Go templates, and install releases with a single command.

NB

Netbay Developer Relations

Netbay Engineering

On this page

Writing raw manifests works, but once you deploy the same workload in several environments, you want one source of truth with configurable switches. Helm is the package manager for Kubernetes. A chart is a collection of templates plus a values file; installing a chart renders the templates into final manifests and tracks them as a release. Upgrading and rolling back become single commands.

Chart anatomy

A chart is a directory with a specific layout: Chart.yaml describes metadata, values.yaml holds default configuration, and templates/ holds Go-template files that render to YAML.

text
myapp/
  Chart.yaml
  values.yaml
  templates/
    deployment.yaml
    service.yaml

A templated deployment

Templates reuse a lot of boilerplate and substitute values with template expressions. Common helpers include .Values.name and .Release.Name.

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ${ .Values.name }
  namespace: ${ .Values.namespace }
spec:
  replicas: ${ .Values.replicas }
  selector:
    matchLabels:
      app: ${ .Values.name }
  template:
    metadata:
      labels:
        app: ${ .Values.name }
    spec:
      containers:
        - name: app
          image: "${ .Values.image.repository }:${ .Values.image.tag }"
          resources:
            requests:
              cpu: ${ .Values.resources.cpu }

The backslash escapes the dollar so the file stays a valid template literal; Helm sees the expression and substitutes the value at render time.

The values file

values.yaml supplies the defaults that the templates read.

yaml
name: myapp
namespace: default
replicas: 2
image:
  repository: nginx
  tag: "1.27"
resources:
  cpu: 100m

Rendering and installing

Preview what Helm will render, then install or upgrade it. The workflow is dry-run first, then apply.

bash
helm template myapp ./myapp
helm install myapp ./myapp --namespace production
helm list --namespace production
helm upgrade myapp ./myapp --set image.tag=1.26
helm rollback myapp 1

The --set flag overrides values without editing the file, which is handy for throwaway changes.

How templating composes into a release

chart templates *.yaml with expressions values.yaml name, replicas, image helm render final manifests release: myapp tracks versions, rolls back

When to reach for Helm

Helm shines for installing third-party components with many options and for shipping your own multi-resource apps. For a tiny static manifest, the extra abstraction is overkill — pick it when the config surface is genuinely variable.

Takeaway

Helm turns a pile of manifests into a versioned, parameterized chart you can install, upgrade, and roll back in one command each. Templates handle variation; values.yaml keeps defaults central. Practice by charting one of your k3s apps on a Netbay VPS, then use helm install to redeploy it cleanly anywhere — netbayhosts.in.

Keep reading

Follow along on a real VPS

Deploy Linux in under 60 seconds

These guides are written against Ubuntu, Debian, and RHEL-family images — the same ones on NetBay.

Deploy an instance