docs / articles / Helm Template Command Example

Helm Template Command Example

Noah Aug 16, 2026 2026-08-16 04:58:21

Helm is a powerful package manager for the Kubernetes ecosystem, enabling the discovery, sharing, and use of software built around Kubernetes. The "helm template" command is a crucial component of Helm, allowing you to generate templated Kubernetes manifests before installing or upgrading your chart. This article will guide you through using the Helm template command with a practical example.

Elegant Helm Template For Rails Project
Elegant Helm Template For Rails Project

Helm's functionality offers tremendous flexibility and control in managing Kubernetes application's (ięks/doc>litail年後の Applying a Helm chart to your cluster, editing its values before installing, and even visualizing the resulting manifests are all part of the Helm experience.

Templates — SKS PROPS
Templates — SKS PROPS

Getting Started with Helm Template Command

Before delving into the "helm template" command, ensure you have Helm installed. If not, follow the official Helm installation guide to set it up on your system.

an image of a helmet with measurements and instructions for the parts to be used in this project
an image of a helmet with measurements and instructions for the parts to be used in this project

Once Helm is installed, you can initialize a new Helm project, also known as a chart:

``` helm create my-chart cd my-chart ```

Understanding Chart Structure

Firefighter Helmet Shield Silhouette Images – Browse 920 Stock Photos, Vectors, and Video
Firefighter Helmet Shield Silhouette Images – Browse 920 Stock Photos, Vectors, and Video

A Helm chart consists of several files and directories. The primary file is "Charts.yaml" which contains metadata about the chart. The "templates" directory holds the Go HTML templates for your Kubernetes manifests. The "values.yaml" file contains default configuration values for your chart.

For this example, let's consider a simple chart with a basic deployment and service:

``` apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "my-chart.fullname" . }} spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: app.kubernetes.io/name: {{ include "my-chart.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} template: metadata: labels: app.kubernetes.io/name: {{ include "my-chart.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} spec: {{- with .Values.image }} containers: - name: {{ .name }} image: "{{ .repository }}/{{ .name }}:{{ .tag }}" ports: - name: http containerPort: 8080 protocol: TCP {{- end }} ```

Using Helm Template

Viking Helmet Template – Medium
Viking Helmet Template – Medium

Now you can use the "helm template" command to generate the Kubernetes manifest files from your chart. The command takes the chart path as an argument and outputs the rendered manifests to the console.

Let's generate the manifests for our example chart without any configuration changes:

``` helm template my-chart ```

Customizing Values and Generating Manifests

Drawing of a knight's helmet
Drawing of a knight's helmet

You can customize the generated manifests by changing the values in "values.yaml" or providing a custom values file when running the "helm template" command.

Let's update the replica count to 3 and use a custom values file:

Helmet Gear, Load Bearing Belt Kit, Sbr Setup, Military Helmet Ideas, Special Forces Helmet Setup, Navy Seal Helmet Setup, Fast Helmet Setup, Tactical Setup Ideas, Military Setup
Helmet Gear, Load Bearing Belt Kit, Sbr Setup, Military Helmet Ideas, Special Forces Helmet Setup, Navy Seal Helmet Setup, Fast Helmet Setup, Tactical Setup Ideas, Military Setup
EVA Foam Agamemnon Helmet Template Pattern Inspired by The Odyssey
EVA Foam Agamemnon Helmet Template Pattern Inspired by The Odyssey
FAST XP SETUP LNR07
FAST XP SETUP LNR07
Greek Helmet Template – Large
Greek Helmet Template – Large
a drawing of the dome for roman helmet
a drawing of the dome for roman helmet
Helm: Render Chart Templates Locally
Helm: Render Chart Templates Locally
the diagram shows how to cut out an object in order to make it look like a cone
the diagram shows how to cut out an object in order to make it look like a cone
Master Chief Helm - Scott Bowman
Master Chief Helm - Scott Bowman
the free firefighter helmet template is shown in black and white, with an arrow pointing to
the free firefighter helmet template is shown in black and white, with an arrow pointing to

```yaml # custom-values.yaml replicaCount: 3 ```

Then run:

``` helm template my-chart -f custom-values.yaml ```

Visualizing Manifests with Helm Diff

Before deploying your chart, you can utilize Helm's "diff" subcommand to preview the differences between the current state and the pending manifests.

For example, let's see the differences between the manifests generated with custom values and the ones generated with the default values:

``` helm diff upgrade --recreate-pod my-chart ./my-chart -f custom-values.yaml ```

Applying Generated Manifests

Once satisfied with the generated manifests, you can apply them directly to your Kubernetes cluster using `kubectl`.

First, copy the generated manifests to a file (e.g., "manifests.yaml"), then run:

``` kubectl apply -f manifests.yaml ```

This demonstrates a seamless workflow for managing Kubernetes applications using Helm, from chart creation to deployment. Try exploring more Helm features and commands to further enhance your Kubernetes experience.

Happy Helm-ing!