Creating a Simple “Hello World” Chart
In this section, we will create a Helm chart for a simple “Hello World” application. The application will use an Nginx deployment with two replicas and expose the service through a NodePort. Below are the Kubernetes manifest files for our Hello World application:templates/ folder along with files such as Chart.yaml, values.yaml, LICENSE, and README.md.
Using Helm to Scaffold the Chart
You do not need to manually create this structure. The Helm CLI can generate a skeleton chart for you:templates/ directory. Initially, the generated Chart.yaml file contains default data based on the provided chart name.
Examining and Modifying Chart Metadata
At this stage, you might want to update theChart.yaml file to include more detailed metadata. For instance, if your company is developing this chart for internal use, you can update the file with a more descriptive summary and add maintainer contacts.
To open and edit the file:
templates/ directory:
Static vs. Templated Names
When you install a Helm chart, the objects in the templates are created exactly as defined. For example:hello-world, installing another release of the same chart leads to name conflicts:
{{ .Release.Name }}) with your specified release name:
Basing resource names on the Helm release name ensures that multiple installations in the same namespace do not conflict.
Exposing Configurable Values
Customization is key for production-ready charts. Often, you might want to configure deployment attributes—such as the number of replicas or the container image—to suit different environments. Thevalues.yaml file serves this purpose by storing default configurations that your templates can reference.
Consider the following simple values.yaml:
Summary
When you install a Helm chart, Helm processes the templates in yourtemplates/ directory together with several sources of configuration:
• Release-specific details (such as release name, namespace, and revision)• Default values defined in
values.yaml• Metadata from
Chart.yaml• Information from your Kubernetes cluster The resulting manifest files are then used by Kubernetes to deploy your resources. By designing templates with dynamic naming (using
{{ .Release.Name }}) and configurable values (via values.yaml), you guarantee that each chart installation creates uniquely named objects and can be tailored easily by users.
Happy templating, and see you in the next lesson!
For more information on Helm, visit the Helm Documentation.