In this lesson, you will learn how to deconstruct a Helm chart into its essential components to understand how packages are structured for Kubernetes deployments.
While Kubernetes manifests are excellent for describing individual resources, they quickly become unmanageable in large applications. A Helm chart acts as a template-driven package that allows you to bundle these resources into a single, versionable unit. When you run helm create my-app, Helm generates a standardized directory structure that every chart must follow.
The Core Anatomy
A typical chart folder looks like this:
Chart.yaml: The "identity card" of your package. It contains metadata like the chart version, app version, and dependencies.values.yaml: The heart of your customization. This file contains the default configuration settings. By centralizing variables here, you allow users to override settings (like image tags or replica counts) without editing the underlying templates.templates/: This directory houses the YAML manifest files (e.g.,deployment.yaml,service.yaml). Crucially, these are not static; they contain Go template directives that inject data fromvalues.yamlat runtime.
Putting It Together
Consider a simple deployment.yaml snippet inside your templates/ folder:
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-deployment
spec:
replicas: {{ .Values.replicaCount }}
template:
spec:
containers:
- name: web
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
In this example, the {{ .Values.replicaCount }} syntax acts as a placeholder. When you run helm install, Helm looks into your values.yaml file, finds the replicaCount key, and injects that value into the template before sending it to the Kubernetes API server.
By separating the "recipe" (the templates) from the "ingredients" (the values), you create a flexible package that can be deployed across different environments—like dev, staging, or production—simply by swapping out the values file. This structure is what turns static Kubernetes manifests into a dynamic, reusable, and version-controlled software distribution tool.
Key Takeaway: A Helm chart is a structured directory that separates template logic from environment-specific configuration, allowing you to package complex applications into a single, customizable unit.