Homework
Complete these tasks before Lesson 03. Focus on customizing charts and understanding the relationship between values, templates, and rendered output.
Task 1: Customize a Chart for a Real Application
Goal: Modify the scaffolded chart to deploy a different application image with custom configuration, demonstrating your understanding of values.yaml and Chart.yaml.
Instructions
- Scaffold a new chart:
helm create webapp - Edit
webapp/Chart.yaml:- Change
descriptionto something meaningful (e.g., "A custom web application chart") - Set
appVersionto"latest"
- Change
- Edit
webapp/values.yamlto customize the deployment:- Change
image.repositorytohttpd(Apache) or another image of your choice - Set
image.tagto"2.4" - Set
replicaCountto2 - Set
service.typetoNodePort - Set
service.portto80
- Change
- Render the templates locally and verify the output:
helm template my-webapp webapp - Install the chart, verify the pods are running, then uninstall:
helm install my-webapp webapp kubectl get pods -l app.kubernetes.io/instance=my-webapp helm uninstall my-webapp
Self-Check
- The rendered Deployment uses your chosen image and tag (not nginx)
- The rendered Deployment specifies 2 replicas
- The rendered Service is type NodePort
- The chart installs successfully and 2 pods reach Running state
Task 2: Write a Custom NOTES.txt
Goal: Replace the default NOTES.txt template with a custom one that displays useful information based on the chart’s configured values.
Instructions
- Using the
webappchart from Task 1, openwebapp/templates/NOTES.txt. - Replace the contents with a custom template that:
- Displays the release name and namespace
- Shows the image and tag being deployed
- Provides the correct access command based on
.Values.service.type(ClusterIP vs. NodePort)
- Your NOTES.txt should use at least these template variables:
{{ .Release.Name }}{{ .Release.Namespace }}{{ .Values.image.repository }}{{ .Values.image.tag }}{{ .Values.service.type }}
- Test your NOTES.txt output:
# Render locally to preview helm template my-webapp webapp --show-only templates/NOTES.txt # Install and verify the notes display correctly helm install my-webapp webapp helm status my-webapp - Clean up:
helm uninstall my-webapp
Self-Check
- NOTES.txt renders without errors
- Output includes the release name and namespace
- Output shows the correct image name and tag
- Output adapts based on the service type (test with
--set service.type=ClusterIPvs.--set service.type=NodePort)
Task 3: Multi-Revision Lifecycle Report
Goal: Perform multiple upgrades and a rollback, then document the full revision history to demonstrate your understanding of the Helm release lifecycle.
Instructions
- Install the chart:
helm install my-webapp webapp - Perform three upgrades, changing a value each time:
# Upgrade 1: scale to 3 replicas helm upgrade my-webapp webapp --set replicaCount=3 # Upgrade 2: change image tag helm upgrade my-webapp webapp --set replicaCount=3 --set image.tag="2.4-alpine" # Upgrade 3: switch service to ClusterIP helm upgrade my-webapp webapp --set replicaCount=3 --set image.tag="2.4-alpine" --set service.type=ClusterIP - View the full history:
helm history my-webapp - Roll back to revision 2:
helm rollback my-webapp 2 - Document your findings:
- How many revisions exist after the rollback?
- What is the status of each revision?
- What values are active after the rollback? (Use
helm get values my-webapp)
- Clean up:
helm uninstall my-webapp rm -rf webapp
Self-Check
helm historyshows 5 revisions (1 install + 3 upgrades + 1 rollback)- The rollback created revision 5, not a restoration of revision 2
- The active values after rollback match what was set in revision 2 (
replicaCount=3, default image tag) - Only revision 5 has status
deployed; all others aresuperseded
Grading Rubric
| Criterion | Points | Description |
|---|---|---|
| Task 1: Custom values | 30 | Chart deploys with custom image, replicas, and service type |
| Task 1: Rendered output | 10 | helm template output matches expected configuration |
| Task 2: NOTES.txt template | 20 | Custom template renders correctly with dynamic values |
| Task 2: Conditional logic | 10 | Output adapts based on service type |
| Task 3: Lifecycle commands | 15 | All install/upgrade/rollback/uninstall commands succeed |
| Task 3: History analysis | 15 | Correct understanding of revision numbering and rollback behavior |
| Total | 100 |
Stretch Goal
Create a production-values.yaml file that overrides multiple values at once (replicas, resources, service type, ingress settings). Install the chart using helm install my-webapp webapp -f production-values.yaml and verify all overrides are applied with helm get values my-webapp -a.