Kevin Ashcraft

Linux & Radio Tutorials

Helm Charts on Kubernetes

This is an example of how to create a Helm Chart for your application.

A Chart is a group of configuration files used to run your application on Kubernetes.

Chart Structure

A Chart has three basic components. A templates directory where your Services and Deployments will be, a values.yaml file that's used to define any variable values, and a Chart.yaml file with some metadata about the chart.

/templates    # configuration files/templates
/values.yaml  # values used in the templates
/Chart.yaml   # metadata about the Chart

Create a Chart

Chart can be created with the `helm create` command. This will create a new directory with some placeholder files.

helm create example

An Example Chart

This is an example Chart that will setup a Deployment of the latest Nginx container.


apiVersion: v1
appVersion: "1.0"
description: An Example Chart
name: example-com
version: 0.1.0


version: latest


kind: Deployment
apiVersion: apps/v1
  name: example-com-controller
    app: example-com
  replicas: 1
      app: example-com
      name: example-com-pod
        app: example-com
      - name: example-com-nginx
        image: nginx:
        - containerPort: 80

Install a Chart

The Chart can be install with Helm using the `helm install` command. This will apply all of the configuration files within the Chart.

helm install -n example-com /path/to/chart

If you don't specify a name, a random one will be issued. This is fun, but can get confusing over time.

Set Specific Values

Value references used in template files will first be resolved with the values.yaml file. You can override these values by using the `--set` flag when running Helm.

As with our example, if we wanted to install a specific version we could do it by setting the 'version' value,

helm install --set version=1.2.3 /path/to/chart

Upgrade a Chart

You can upgrade a Helm Chart to apply any configuration changes.

To upgrade a chart run the `helm upgrade` command.

helm upgrade example-com /path/to/chart

Additional Commands

List all of the install Charts

helm ls

Delete a Chart completely

helm delete --purge $app-name