Helm Charts as a Registry

Use ksonnet to generate configurations from Helm Charts

The team behind ksonnet is stepping back from the project. As a result, work on ksonnet will end and the GitHub repositories will be archived. You can read more about our decision here.


Starting from ksonnet version 0.12, Helm chart repositories are supported as ksonnet registries. This allows users to gain the convenience of Helm while building on the configurability behind ksonnet.

Although it is not necessary to have an understanding of Helm, it is helpful to understand the purpose of charts and how ksonnet approaches managing configurations differently.

What we’ll build

This tutorial will install the WordPress chart from Helm into your ksonnet application. There should be a working ksonnet application to run these commands. Additionally, create a separate namespace on your cluster as demonstrated in the tutorial to facilitate clean-up.

Note: Some charts contains hooks which allow performing operations during various points of a release cycle. Hooks are currently not supported, and files containing hooks will be skipped during package installation.

Add Helm Repository as a ksonnet Registry

A ksonnet registry manages packages. Helm charts repositories can be added as a registry and use a chart as a package.

Add the registry URL and provide a name for the registry.

$ ks registry add helm-stable https://kubernetes-charts.storage.googleapis.com
Note: The Helm registry cannot be a Github URL or on a local filesystem. See the Helm Chart documentation for setting up your own Helm chart repository.

Add charts

The registry now contains packages for each chart available in the Helm repository. Install the WordPress package.

$ ks registry describe helm-stable
$ ks pkg install helm-stable/wordpress
INFO Retrieved 31 files

Check Prototype for Parameters

Parameters can be passed to a Helm chart through ksonnet when generating a component from a prototype.

Check for these parameters by describing the prototype. There are two types of parameters: required and optional.

$ ks prototype describe helm-stable-wordpress

Helm Chart wordpress from the helm-stable registry

  --name=<name> Name of the component [type: string]

  --version=<version> Version of the Helm chart. If blank, it will use latest installed version [default: 2.1.10, type: string]
  --values=<values>   Helm values [default: {}, type: object]


Pass Parameters to a Chart

Under optional parameters, there is a --values flag that allows additional configuration of the Wordpress chart.

Refer to the chart README for a complete list of possible parameters.

In this example, we will set the default Wordpress email from user@example.com to user@heptio.com.

Create a wordpress component and pass the new email as JSON while taking care to format the escaped quotes.

$ ks generate helm-stable-wordpress wordpress --values='{"wordpressEmail":"user@heptio.com"}'

Verify the JSON is correct in addition to default values set to expected values.

$ ks param list
========= =====   =====
wordpress name    'wordpress'
wordpress values  { wordpressEmail: 'user@heptio.com' }
wordpress version '2.1.10'

Finally, generating the manifest with ks show default will have the updated email address in the Deployment.

Last updated on: September 20, 2018