Bird
Raised Fist0
Kubernetesdevops~10 mins

Creating custom Helm charts in Kubernetes - Visual Walkthrough

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Process Flow - Creating custom Helm charts
Start: Define Chart Structure
Create Chart.yaml
Create values.yaml
Create templates/ directory
Add Kubernetes YAML templates
Use placeholders for values
Package and install chart
Chart deployed with custom values
END
This flow shows the step-by-step process of creating a Helm chart: starting with structure, adding metadata, templates, and values, then packaging and deploying.
Execution Sample
Kubernetes
helm create mychart
# Edit mychart/Chart.yaml
# Edit mychart/values.yaml
# Add templates/deployment.yaml with placeholders
helm install myrelease mychart -f custom-values.yaml
This sequence creates a Helm chart, customizes it, and installs it with custom values.
Process Table
StepActionFile/CommandEffect/Result
1Create new chart skeletonhelm create mychartFolder 'mychart' with default files created
2Edit Chart.yamlmychart/Chart.yamlSet chart name, version, description
3Edit values.yamlmychart/values.yamlDefine default configuration values
4Add template with placeholdersmychart/templates/deployment.yamlTemplate uses {{ .Values.key }} for dynamic values
5Package chart (optional)helm package mychartChart packaged as .tgz file
6Install chart with custom valueshelm install myrelease mychart -f custom-values.yamlKubernetes resources deployed with custom settings
7Verify deploymentkubectl get podsPods running as per chart configuration
8Exit-Chart deployed successfully, process complete
💡 Chart installed and Kubernetes resources created, no further steps
Status Tracker
Variable/FileStartAfter Step 2After Step 3After Step 4After Step 6Final
Chart.yamlempty templatename, version setunchangedunchangedunchangedunchanged
values.yamldefault valuesunchangedcustom values addedunchangedused for deploymentunchanged
templates/deployment.yamldefault templateunchangedunchangedplaceholders addedrendered with valuesunchanged
Kubernetes deploymentnonenonenonenonecreated with custom valuesrunning pods
Key Moments - 3 Insights
Why do we use placeholders like {{ .Values.key }} in templates?
Placeholders allow templates to use dynamic values from values.yaml or custom files, as shown in step 4 and step 6 of the execution_table.
What happens if we don't provide a custom values file during install?
Helm uses default values from values.yaml, so deployment uses those defaults (see step 6 and variable_tracker for values.yaml).
Why do we need to edit Chart.yaml if it has defaults?
Chart.yaml defines metadata like name and version, important for identifying the chart, as shown in step 2.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, at which step are placeholders added to templates?
AStep 2
BStep 4
CStep 6
DStep 1
💡 Hint
Check the 'Action' column for 'Add template with placeholders' in execution_table
According to variable_tracker, what is the state of values.yaml after Step 3?
ACustom values added
BDefault values only
CEmpty file
DUsed for deployment
💡 Hint
Look at values.yaml row under 'After Step 3' in variable_tracker
If you skip editing Chart.yaml, what is the likely effect?
AChart will fail to install
BTemplates won't render
CChart installs with default metadata
DValues.yaml is ignored
💡 Hint
Refer to step 2 and the key_moments about Chart.yaml importance
Concept Snapshot
Creating custom Helm charts:
1. Use 'helm create <name>' to scaffold.
2. Edit Chart.yaml for metadata.
3. Define default config in values.yaml.
4. Add templates with {{ .Values.key }} placeholders.
5. Install with 'helm install' and optional custom values.
6. Kubernetes resources deploy using these configs.
Full Transcript
Creating custom Helm charts involves starting with a scaffold using 'helm create'. Then, you edit Chart.yaml to set the chart's name and version. Next, you define default configuration values in values.yaml. Templates in the templates directory use placeholders like {{ .Values.key }} to insert these values dynamically. You can package the chart or install it directly with 'helm install', optionally providing a custom values file to override defaults. This process results in Kubernetes resources deployed with your custom settings.

Practice

(1/5)
1. What is the primary purpose of a Helm chart in Kubernetes?
easy
A. To package and deploy Kubernetes applications easily
B. To monitor Kubernetes cluster health
C. To replace kubectl commands
D. To create virtual machines in Kubernetes

Solution

  1. Step 1: Understand Helm chart role

    A Helm chart bundles Kubernetes resources and configurations for an app.
  2. Step 2: Identify main use

    It simplifies sharing and deploying apps by packaging them.
  3. Final Answer:

    To package and deploy Kubernetes applications easily -> Option A
  4. Quick Check:

    Helm charts = package & deploy apps [OK]
Hint: Helm charts bundle apps for easy deployment [OK]
Common Mistakes:
  • Confusing Helm with monitoring tools
  • Thinking Helm replaces kubectl commands
  • Assuming Helm creates virtual machines
2. Which command initializes a new Helm chart with default files?
easy
A. helm init
B. helm start
C. helm create
D. helm new

Solution

  1. Step 1: Recall Helm commands

    The command to create a new chart with default files is helm create.
  2. Step 2: Eliminate incorrect options

    helm init is deprecated, helm start and helm new do not exist.
  3. Final Answer:

    helm create -> Option C
  4. Quick Check:

    New chart command = helm create [OK]
Hint: Use 'helm create' to start a new chart fast [OK]
Common Mistakes:
  • Using 'helm init' which is deprecated
  • Trying 'helm start' or 'helm new' which are invalid
  • Confusing 'helm create' with 'helm install'
3. Given this snippet in a Helm template file:
{{ .Values.replicaCount }}

If values.yaml sets replicaCount: 3, what will this render in the deployed manifest?
medium
A. {{ .Values.replicaCount }}
B. 3
C. replicaCount
D. null

Solution

  1. Step 1: Understand Helm template variables

    {{ .Values.replicaCount }} inserts the value of replicaCount from values.yaml.
  2. Step 2: Check the value in values.yaml

    Since replicaCount is set to 3, the template renders the number 3.
  3. Final Answer:

    3 -> Option B
  4. Quick Check:

    Template variable renders value = 3 [OK]
Hint: Template {{ .Values.key }} outputs the key's value [OK]
Common Mistakes:
  • Thinking the template syntax prints literally
  • Confusing key name with value
  • Assuming missing values render as null
4. You created a Helm chart but get an error: template: deployment.yaml:10: unexpected EOF. What is the most likely cause?
medium
A. Cluster is not reachable
B. Incorrect image name in values.yaml
C. Helm version is outdated
D. Missing closing bracket in template syntax

Solution

  1. Step 1: Analyze error message

    "unexpected EOF" means the template ended unexpectedly, often due to missing closing brackets.
  2. Step 2: Identify common template syntax errors

    Missing a closing }} or {% causes this error.
  3. Final Answer:

    Missing closing bracket in template syntax -> Option D
  4. Quick Check:

    Unexpected EOF = missing closing bracket [OK]
Hint: Check all {{ }} pairs are closed properly [OK]
Common Mistakes:
  • Blaming image name for syntax errors
  • Assuming cluster issues cause template parse errors
  • Ignoring template syntax mistakes
5. You want to create a Helm chart that allows users to set a custom container port via values.yaml. Which snippet correctly uses this value in the deployment.yaml template?
hard
A. ports: - containerPort: {{ .Values.containerPort }}
B. ports: - containerPort: $containerPort
C. ports: - containerPort: {{ containerPort }}
D. ports: - containerPort: .Values.containerPort

Solution

  1. Step 1: Recall Helm template syntax for values

    Use {{ .Values.key }} to insert values from values.yaml.
  2. Step 2: Check each option

    ports: - containerPort: {{ .Values.containerPort }} uses correct Helm syntax. The other options use invalid or incomplete syntax.
  3. Final Answer:

    ports: - containerPort: {{ .Values.containerPort }} -> Option A
  4. Quick Check:

    Use {{ .Values.key }} for values in templates [OK]
Hint: Use {{ .Values.key }} to access values.yaml keys [OK]
Common Mistakes:
  • Using shell variable syntax like $containerPort
  • Omitting the dot before Values
  • Not using handlebars {{ }} for templating