Bird
Raised Fist0
Kubernetesdevops~20 mins

Creating custom Helm charts in Kubernetes - Practice Exercises

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
Challenge - 5 Problems
🎖️
Helm Chart Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Helm template rendering output
You have a Helm chart with a template that uses the following snippet:
{{- if .Values.service.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: {{ .Release.Name }}-service
spec:
  type: {{ .Values.service.type }}
{{- end }}

If the values.yaml contains:
service:
  enabled: true
  type: ClusterIP

What will be the output of helm template mychart . regarding the Service resource?
AThe Service resource is included but the name is missing.
BNo Service resource is included because the template has a syntax error.
CThe Service resource is included but with type LoadBalancer regardless of values.yaml.
DThe Service resource YAML is included with type ClusterIP and name mychart-service.
Attempts:
2 left
💡 Hint
Check how the if condition uses the values.yaml to include the Service resource.
Configuration
intermediate
2:00remaining
Correct Helm Chart directory structure
Which of the following directory structures is the correct minimal layout for a custom Helm chart named myapp?
A
myapp/
  Chart.yaml
  values.yaml
  templates/
    deployment.yaml
    service.yaml
B
myapp/
  chart.yaml
  values.yaml
  templates/
    deployment.yaml
C
myapp/
  Chart.yaml
  values.yaml
  template/
    deployment.yaml
D
myapp/
  Chart.yaml
  values.yaml
  templates.yaml
Attempts:
2 left
💡 Hint
Remember Helm requires a Chart.yaml file and a templates directory.
Troubleshoot
advanced
2:00remaining
Helm install failure due to missing values
You run helm install myapp ./mychart and get the error:
Error: YAML parse error on mychart/templates/deployment.yaml: error converting YAML to JSON: yaml: line 10: did not find expected key

What is the most likely cause?
AThe values.yaml file is empty causing the deployment template to fail.
BThe deployment.yaml template has incorrect indentation or missing colon causing YAML syntax error.
CThe Kubernetes cluster is not reachable causing Helm to fail.
DThe Chart.yaml file is missing causing Helm to fail parsing templates.
Attempts:
2 left
💡 Hint
YAML parse errors usually mean indentation or syntax issues in the template files.
🔀 Workflow
advanced
2:00remaining
Helm chart versioning best practice
You want to release a new version of your Helm chart with bug fixes but no API changes. Which version bump is recommended according to semantic versioning in Chart.yaml?
AIncrease the minor version, e.g., from 1.2.3 to 1.3.0
BIncrease the major version, e.g., from 1.2.3 to 2.0.0
CIncrease the patch version, e.g., from 1.2.3 to 1.2.4
DKeep the same version number since only bug fixes were made
Attempts:
2 left
💡 Hint
Semantic versioning uses patch version for bug fixes without API changes.
🧠 Conceptual
expert
3:00remaining
Helm hooks execution order
Given these Helm hook annotations in templates:
  • pre-install
  • post-install
  • pre-upgrade
  • post-upgrade

What is the correct order of execution when you run helm upgrade --install on a new release?
A1, 2
B3, 4
C1, 3, 4, 2
D1, 2, 3, 4
Attempts:
2 left
💡 Hint
For a new release, only install hooks run, not upgrade hooks.

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