0
0
Kubernetesdevops~10 mins

Chart templates and values.yaml in Kubernetes - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Chart templates and values.yaml
Start: Helm Chart
Read values.yaml
Load templates
Substitute values into templates
Generate Kubernetes manifests
Deploy manifests to cluster
Helm reads values.yaml, loads templates, replaces placeholders with values, then creates Kubernetes manifests for deployment.
Execution Sample
Kubernetes
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Values.name }}-config
  labels:
    app: {{ .Values.app }}
A Helm template for a ConfigMap using values from values.yaml to fill name and app labels.
Process Table
StepActionTemplate LineValue UsedResulting Line
1Read values.yamlname: myappname=myappname: myapp
2Read values.yamlapp: demoapp=demoapp: demo
3Load template linemetadata.name: {{ .Values.name }}-configname=myappmetadata.name: myapp-config
4Load template linelabels.app: {{ .Values.app }}app=demolabels.app: demo
5Generate final manifestFull ConfigMapValues substitutedConfigMap with name 'myapp-config' and label 'app: demo'
💡 All placeholders replaced with values from values.yaml, manifest ready for deployment
Status Tracker
VariableStartAfter Step 1After Step 3Final
nameundefinedmyappmyappmyapp
appundefineddemodemodemo
Key Moments - 2 Insights
Why does {{ .Values.name }} get replaced with 'myapp'?
Because in the execution_table at Step 1, values.yaml defines name as 'myapp', which Helm uses to substitute in the template at Step 3.
What happens if a value is missing in values.yaml?
Helm will leave the placeholder empty or use a default if defined; this is shown by no substitution in the execution_table rows for that value.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at Step 3, what is the resulting line after substitution?
Ametadata.name: config-myapp
Bmetadata.name: {{ .Values.name }}-config
Cmetadata.name: myapp-config
Dmetadata.name: myapp
💡 Hint
Check the 'Resulting Line' column at Step 3 in the execution_table.
At which step does Helm read the values.yaml file?
AStep 1
BStep 3
CStep 5
DStep 4
💡 Hint
Look at the 'Action' column in the execution_table for when values.yaml is read.
If the values.yaml had app: 'testapp' instead of 'demo', what would be the label in the final manifest?
Aapp: demo
Bapp: testapp
Capp: myapp
Dapp: config
💡 Hint
Refer to the variable_tracker for 'app' value changes and the substitution in Step 4.
Concept Snapshot
Helm charts use templates with placeholders like {{ .Values.key }}.
Values.yaml provides the actual values.
Helm reads values.yaml, substitutes values into templates.
Generates Kubernetes manifests ready for deployment.
Missing values can cause empty fields or use defaults.
This process simplifies app configuration and deployment.
Full Transcript
This visual execution shows how Helm uses values.yaml and templates to create Kubernetes manifests. First, Helm reads values.yaml to get values like 'name' and 'app'. Then it loads the template file which contains placeholders such as {{ .Values.name }}. Helm replaces these placeholders with the actual values from values.yaml. For example, {{ .Values.name }} becomes 'myapp'. This substitution happens line by line, resulting in a complete manifest file. The final manifest can then be deployed to the Kubernetes cluster. If a value is missing in values.yaml, Helm may leave the placeholder empty or use a default if specified. This process helps manage configuration easily and consistently.