Helm Chart Structure: Overview and Example for Kubernetes
Helm chart is a package that contains all the files needed to deploy an application on Kubernetes. Its structure includes a Chart.yaml file for metadata, a templates/ folder for Kubernetes manifests, and a values.yaml file for configuration settings.How It Works
Think of a Helm chart like a recipe book for cooking a dish. The Chart.yaml is the cover page that tells you the name and version of the recipe. The values.yaml file is like the list of ingredients you can adjust to your taste. The templates/ folder contains the actual cooking instructions, which in this case are Kubernetes files that tell the system how to set up your app.
When you use Helm to install a chart, it reads these files and combines them to create the final setup on your Kubernetes cluster. This makes deploying apps easier and repeatable, just like following a recipe ensures the same tasty result every time.
Example
mychart/
Chart.yaml
values.yaml
templates/
pod.yamlExample
Chart.yaml: apiVersion: v2 name: mychart version: 0.1.0 values.yaml: podName: mypod templates/pod.yaml: apiVersion: v1 kind: Pod metadata: name: {{ .Values.podName }} spec: containers: - name: nginx image: nginx:stable ports: - containerPort: 80
When to Use
Use Helm charts when you want to deploy applications on Kubernetes in a simple, repeatable way. They help you manage complex setups by packaging all configuration and templates together.
For example, if you run a web app that needs a database and several services, a Helm chart can bundle all these parts so you can install or update them with one command. It is also useful for sharing your app setup with others or deploying the same app in different environments like testing and production.
Key Points
- Chart.yaml holds metadata like name and version.
- values.yaml stores default settings you can customize.
- templates/ contains Kubernetes manifest files with placeholders.
- Helm combines these files to deploy apps easily on Kubernetes.
- Charts make app deployment repeatable and shareable.